From 202ecd21dfbd8c5b9026654eaf85120ceff5e1b5 Mon Sep 17 00:00:00 2001 From: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:15:10 +0530 Subject: [PATCH] fix: bug fixes & UI improvements (#2884) * chore: access restriction for api tokens * fix: on create module total issues undefined * fix: cycle board card typo * chore: fetch modules after creation * fix: peek module on delete * fix: peek cycle on delete * fix: cycle detail sidebar copy link toast * chore: router replace -> push --- web/components/cycles/delete-modal.tsx | 4 ++-- web/components/cycles/sidebar.tsx | 3 ++- web/components/modules/delete-module-modal.tsx | 4 ++-- web/components/modules/module-card-item.tsx | 2 +- web/store/module/modules.store.ts | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/web/components/cycles/delete-modal.tsx b/web/components/cycles/delete-modal.tsx index a9d145447..61667659f 100644 --- a/web/components/cycles/delete-modal.tsx +++ b/web/components/cycles/delete-modal.tsx @@ -30,7 +30,7 @@ export const CycleDeleteModal: React.FC = observer((props) => { // states const [loader, setLoader] = useState(false); const router = useRouter(); - const { cycleId } = router.query; + const { cycleId, peekCycle } = router.query; const formSubmit = async () => { setLoader(true); @@ -57,7 +57,7 @@ export const CycleDeleteModal: React.FC = observer((props) => { ); }); - if (cycleId) router.replace(`/${workspaceSlug}/projects/${projectId}/cycles`); + if (cycleId || peekCycle) router.push(`/${workspaceSlug}/projects/${projectId}/cycles`); handleClose(); } catch (error) { diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx index d21825344..0992c279b 100644 --- a/web/components/cycles/sidebar.tsx +++ b/web/components/cycles/sidebar.tsx @@ -102,7 +102,8 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { .then(() => { setToastAlert({ type: "success", - title: "Cycle link copied to clipboard", + title: "Link Copied!", + message: "Cycle link copied to clipboard.", }); }) .catch(() => { diff --git a/web/components/modules/delete-module-modal.tsx b/web/components/modules/delete-module-modal.tsx index 09f9bc6a8..f51367d16 100644 --- a/web/components/modules/delete-module-modal.tsx +++ b/web/components/modules/delete-module-modal.tsx @@ -24,7 +24,7 @@ export const DeleteModuleModal: React.FC = observer((props) => { const [isDeleteLoading, setIsDeleteLoading] = useState(false); const router = useRouter(); - const { workspaceSlug, projectId, moduleId } = router.query; + const { workspaceSlug, projectId, moduleId, peekModule } = router.query; const { module: moduleStore } = useMobxStore(); @@ -43,7 +43,7 @@ export const DeleteModuleModal: React.FC = observer((props) => { await moduleStore .deleteModule(workspaceSlug.toString(), projectId.toString(), data.id) .then(() => { - if (moduleId) router.push(`/${workspaceSlug}/projects/${data.project}/modules`); + if (moduleId || peekModule) router.push(`/${workspaceSlug}/projects/${data.project}/modules`); handleClose(); setToastAlert({ type: "success", diff --git a/web/components/modules/module-card-item.tsx b/web/components/modules/module-card-item.tsx index 054b0f9e8..072fa0ffa 100644 --- a/web/components/modules/module-card-item.tsx +++ b/web/components/modules/module-card-item.tsx @@ -56,7 +56,7 @@ export const ModuleCardItem: React.FC = observer((props) => { const moduleStatus = MODULE_STATUS.find((status) => status.value === module.status); const issueCount = module - ? moduleTotalIssues === 0 + ? !moduleTotalIssues || moduleTotalIssues === 0 ? "0 Issue" : moduleTotalIssues === module.completed_issues ? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}` diff --git a/web/store/module/modules.store.ts b/web/store/module/modules.store.ts index 59f4b08f7..b68c8320a 100644 --- a/web/store/module/modules.store.ts +++ b/web/store/module/modules.store.ts @@ -218,7 +218,7 @@ export class ModuleStore implements IModuleStore { this.loader = false; this.error = null; }); - + this.fetchModules(workspaceSlug, projectId); return response; } catch (error) { console.error("Failed to create module in module store", error);