From d1a6f6fc0d84fe0c5e706db57f93030094f1bf4a Mon Sep 17 00:00:00 2001 From: Chukwudumebi Onwuli <37223065+deeonwuli@users.noreply.github.com> Date: Thu, 7 Nov 2024 21:45:31 +0100 Subject: [PATCH] feat: change iap url structure --- src/webapp/components/layout/side-bar/SideBarContent.tsx | 3 ++- src/webapp/hooks/useRoutes.ts | 4 ++-- src/webapp/pages/form-page/useForm.ts | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/webapp/components/layout/side-bar/SideBarContent.tsx b/src/webapp/components/layout/side-bar/SideBarContent.tsx index 2bc100eb..6b57a6d2 100644 --- a/src/webapp/components/layout/side-bar/SideBarContent.tsx +++ b/src/webapp/components/layout/side-bar/SideBarContent.tsx @@ -70,7 +70,8 @@ export const SideBarContent: React.FC = React.memo( component={NavLink} to={ value === RouteName.EVENT_TRACKER || - value === RouteName.IM_TEAM_BUILDER + value === RouteName.IM_TEAM_BUILDER || + value === RouteName.INCIDENT_ACTION_PLAN ? routes[value].replace( ":id", getCurrentEventTracker()?.id || "" diff --git a/src/webapp/hooks/useRoutes.ts b/src/webapp/hooks/useRoutes.ts index 4f92a630..c2b14cc1 100644 --- a/src/webapp/hooks/useRoutes.ts +++ b/src/webapp/hooks/useRoutes.ts @@ -31,7 +31,7 @@ export const routes: Record = { [RouteName.EDIT_FORM]: `/edit/${formType}/:id`, [RouteName.EVENT_TRACKER]: "/event-tracker/:id", [RouteName.IM_TEAM_BUILDER]: "/incident-management-team-builder/:id", - [RouteName.INCIDENT_ACTION_PLAN]: "/incident-action-plan", + [RouteName.INCIDENT_ACTION_PLAN]: "/:id/incident-action-plan", [RouteName.RESOURCES]: "/resources", [RouteName.DASHBOARD]: "/", } as const; @@ -41,7 +41,7 @@ type RouteParams = { [RouteName.EDIT_FORM]: { formType: FormType; id: string }; [RouteName.EVENT_TRACKER]: { id: string }; [RouteName.IM_TEAM_BUILDER]: { id: string }; - [RouteName.INCIDENT_ACTION_PLAN]: undefined; + [RouteName.INCIDENT_ACTION_PLAN]: { id: string }; [RouteName.RESOURCES]: undefined; [RouteName.DASHBOARD]: undefined; }; diff --git a/src/webapp/pages/form-page/useForm.ts b/src/webapp/pages/form-page/useForm.ts index ecb103ff..f5aad7b1 100644 --- a/src/webapp/pages/form-page/useForm.ts +++ b/src/webapp/pages/form-page/useForm.ts @@ -300,7 +300,10 @@ export function useForm(formType: FormType, id?: Id): State { }); break; case "incident-response-action": - if (currentEventTracker?.id) goTo(RouteName.INCIDENT_ACTION_PLAN); + if (currentEventTracker?.id) + goTo(RouteName.INCIDENT_ACTION_PLAN, { + id: currentEventTracker?.id, + }); setGlobalMessage({ text: i18n.t(`Incident Response Actions saved successfully`), type: "success",