From 2e335bc967e8b52cb552e60a6a83f3ac16d90ebf Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Thu, 12 Dec 2024 09:50:43 +0500 Subject: [PATCH] code graph render and show add code graph button and on edit position should be persist --- src/people/widgetViews/WorkspaceMission.tsx | 137 ++++++++++++-------- src/store/main.ts | 2 +- 2 files changed, 81 insertions(+), 58 deletions(-) diff --git a/src/people/widgetViews/WorkspaceMission.tsx b/src/people/widgetViews/WorkspaceMission.tsx index d1235762..e660d204 100644 --- a/src/people/widgetViews/WorkspaceMission.tsx +++ b/src/people/widgetViews/WorkspaceMission.tsx @@ -255,9 +255,13 @@ const WorkspaceMission = () => { const [users, setUsers] = useState([]); const [displayUserRepoOptions, setDisplayUserRepoOptions] = useState>({}); const [codeGraphModal, setCodeGraphModal] = useState(false); - const [codeGraph, setCodeGraph] = useState(null); + const [codeGraph, setCodeGraph] = useState(null); const [codeGraphModalType, setCodeGraphModalType] = useState<'add' | 'edit'>('add'); const [currentCodeGraphUuid, setCurrentCodeGraphUuid] = useState(''); + const [selectedCodeGraph, setSelectedCodeGraph] = useState<{ + name: string; + url: string; + }>(); const fetchCodeGraph = useCallback(async () => { try { @@ -274,6 +278,12 @@ const WorkspaceMission = () => { const openCodeGraphModal = (type: 'add' | 'edit', graph?: CodeGraph) => { if (type === 'edit' && graph) { + if (graph) { + setSelectedCodeGraph({ + name: graph.name, + url: graph.url + }); + } setCurrentCodeGraphUuid(graph.uuid); } else { setCurrentCodeGraphUuid(''); @@ -283,6 +293,11 @@ const WorkspaceMission = () => { }; const closeCodeGraphModal = () => { + setSelectedCodeGraph({ + name: '', + url: '' + }); + setCurrentCodeGraphUuid(''); setCodeGraphModal(false); }; @@ -811,62 +826,70 @@ const WorkspaceMission = () => { - {!codeGraph && ( -