Skip to content

Commit e905ef9

Browse files
committed
Add remaining surge redirects
1 parent 4054e64 commit e905ef9

File tree

1 file changed

+126
-16
lines changed

1 file changed

+126
-16
lines changed

src/App/routes/index.tsx

Lines changed: 126 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Navigate, Outlet, useParams } from 'react-router-dom';
2-
import { isDefined } from '@togglecorp/fujs';
2+
import { isDefined, isTruthyString } from '@togglecorp/fujs';
33

44
import {
55
wrapRoute,
@@ -1191,30 +1191,32 @@ const surgeCatalogueInformationManagementRolesResponsibility = customWrapRoute({
11911191
},
11921192
});
11931193

1194-
const surgeCatalogueInformationManagementSupport = customWrapRoute({
1194+
// TODO: update view name
1195+
const surgeCatalogueInformationManagementRegionalOfficeSupport = customWrapRoute({
11951196
parent: surgeCatalogueLayout,
1196-
path: 'information-management/support',
1197+
path: 'information-management/regional-office-support',
11971198
component: {
11981199
render: () => import('#views/SurgeCatalogueInformationManagementSupport'),
11991200
props: {},
12001201
},
12011202
wrapperComponent: Auth,
12021203
context: {
1203-
title: 'Information Management Support',
1204+
title: 'Information Management Support - Regional Office',
12041205
visibility: 'anything',
12051206
},
12061207
});
12071208

1208-
const surgeCatalogueInformationManagementOperationSupport = customWrapRoute({
1209+
// TODO: update view name
1210+
const surgeCatalogueInformationManagementGenevaSupport = customWrapRoute({
12091211
parent: surgeCatalogueLayout,
1210-
path: 'information-management/operation-support',
1212+
path: 'information-management/geneva-support',
12111213
component: {
12121214
render: () => import('#views/SurgeCatalogueInformationManagementOperationSupport'),
12131215
props: {},
12141216
},
12151217
wrapperComponent: Auth,
12161218
context: {
1217-
title: 'Information Management Support for Operations',
1219+
title: 'Information Management Support- Geneva',
12181220
visibility: 'anything',
12191221
},
12201222
});
@@ -2703,9 +2705,14 @@ const deploymentCatalogueLayout = customWrapRoute({
27032705

27042706
// eslint-disable-next-line react-refresh/only-export-components
27052707
function DeploymentCatalogueNavigate() {
2706-
const params = useParams<{ catalogueId: string }>();
2708+
const params = useParams<{
2709+
catalogueId: string,
2710+
subCatalogueId: string,
2711+
}>();
27072712

2708-
const catalogueRouteMap: Record<string, MyOutputNonIndexRouteObject<ExtendedProps>> = {
2713+
type WrappedRoute = MyOutputNonIndexRouteObject<ExtendedProps>;
2714+
2715+
const catalogueRouteMap: Record<string, WrappedRoute> = {
27092716
overview: surgeCatalogueOverview,
27102717
emergency: surgeCatalogueEmergencyNeedsAssessment,
27112718
basecamp: surgeCatalogueBasecamp,
@@ -2727,13 +2734,114 @@ function DeploymentCatalogueNavigate() {
27272734
other: surgeCatalogueOther,
27282735
};
27292736

2730-
const newRoute = isDefined(params.catalogueId)
2737+
const subCatalogueRouteMap: Record<string, Record<string, WrappedRoute>> = {
2738+
emergency: {
2739+
'assessment-cell': surgeCatalogueEmergencyNeedsAssessmentCell,
2740+
},
2741+
basecamp: {
2742+
'eru-base-camp-small': surgeCatalogueBasecampEruSmall,
2743+
'eru-base-camp-medium': surgeCatalogueBasecampEruMedium,
2744+
'eru-base-camp-large': surgeCatalogueBasecampEruLarge,
2745+
'facility-management': surgeCatalogueBasecampFacilityManagement,
2746+
},
2747+
cash: {
2748+
cva: surgeCatalogueCashRapidResponse,
2749+
},
2750+
community: {
2751+
'community-engagement-and-accountability': surgeCatalogueCommunityEngagementRapidResponse,
2752+
},
2753+
communications: {
2754+
'communications-emergency-response-tool-cert-3': surgeCatalogueCommunicationErtThree,
2755+
'communications-emergency-response-tool-cert-2': surgeCatalogueCommunicationErtTwo,
2756+
'communications-emergency-response-tool-cert-1': surgeCatalogueCommunicationErtOne,
2757+
},
2758+
health: {
2759+
'eru-pss-module': surgeCatalogueHealthEruPsychosocialSupport,
2760+
'community-case-management-of-malnutrition-ccmm': surgeCatalogueHealthCommunityManagementMalnutrition,
2761+
'safe-and-dignified-burials': surgeCatalogueHealthSafeDignifiedBurials,
2762+
'community-based-surveillance-cbs': surgeCatalogueHealthCommunityBasedSurveillance,
2763+
'community-case-management-of-cholera-ccmc': surgeCatalogueHealthCommunityCaseManagementChlorea,
2764+
'eru-cholera-treatment-center': surgeCatalogueHealthEruChloreaTreatment,
2765+
'emergency-mobile-clinic': surgeCatalogueHealthEmergencyClinic,
2766+
'maternal-newborn-health-clinic': surgeCatalogueHealthMaternalNewbornClinic,
2767+
'surgical-surge': surgeCatalogueHealthEruSurgical,
2768+
'eru-red-cross-red-crescent-emergency-hospital': surgeCatalogueHealthEruHospital,
2769+
'eru-red-cross-red-crescent-emergency-clinic': surgeCatalogueHealthEruClinic,
2770+
},
2771+
infoMgt: {
2772+
// NOTE: sims was probably replace with link to its site
2773+
// 'surge-information-management-support-sims': ,
2774+
'roles-and-resps': surgeCatalogueInformationManagementRolesResponsibility,
2775+
'im-support-for-op': surgeCatalogueInformationManagementRegionalOfficeSupport,
2776+
'ifrc-geneva-im': surgeCatalogueInformationManagementGenevaSupport,
2777+
'composition-of-im-res': surgeCatalogueInformationManagementComposition,
2778+
'Satellite-imagery': surgeCatalogueInformationManagementSatelliteImagery,
2779+
},
2780+
informationTech: {
2781+
'eru-it-telecom': surgeCatalogueInformationTechnologyEruItTelecom,
2782+
},
2783+
livelihoods: {
2784+
'livelihoods-and-basic-needs': surgeCatalogueLivelihoodServices,
2785+
},
2786+
logistics: {
2787+
'lpscm-for-national-societies': surgeCatalogueLogisticsLpscmNs,
2788+
'logistics-eru': surgeCatalogueLogisticsEru,
2789+
},
2790+
operations: {
2791+
'head-of-emergency-operations-heops': surgeCatalogueOperationManagementHeops,
2792+
},
2793+
protection: {
2794+
'protection-gender-and-inclusion': surgeCataloguePgiServices,
2795+
},
2796+
planning: {
2797+
'real-time-evaluation-rte-and-guidance': surgeCataloguePmerRealTimeEvaluation,
2798+
'emergency-plan-of-action-epoa-monitoring-evaluation-plan': surgeCataloguePmerEmergencyPlanAction,
2799+
},
2800+
relief: {
2801+
'eru-relief': surgeCatalogueReliefEru,
2802+
},
2803+
security: {
2804+
'security-management': surgeCatalogueSecurityManagement,
2805+
},
2806+
shelter: {
2807+
'stt-shelter-technical-team': surgeCatalogueShelterTechnicalTeam,
2808+
'sct-shelter-coordination-team': surgeCatalogueShelterCoordinatorTeam,
2809+
},
2810+
water: {
2811+
'household-water-treatment-and-safe-storage-hwts': surgeCatalogueWashHwts,
2812+
'water-supply-rehabilitation-wsr': surgeCatalogueWashWaterSupplyRehabilitation,
2813+
'm40-eru': surgeCatalogueWashKitM40Eru,
2814+
'msm20-eru': surgeCatalogueWashKitMsm20Eru,
2815+
'm15-eru': surgeCatalogueWashKitM15Eru,
2816+
'kit-5': surgeCatalogueWashKit5,
2817+
'kit-2': surgeCatalogueWashKit2,
2818+
},
2819+
other: {
2820+
'civil-military-relations': surgeCatalogueOtherCivilMilitaryRelations,
2821+
'disaster-risk-reduction-drr': surgeCatalogueOtherDisasterRiskReduction,
2822+
'human-resources': surgeCatalogueOtherHumanResources,
2823+
'international-disaster-response-law': surgeCatalogueOtherInternationalDisasterResponseLaw,
2824+
migration: surgeCatalogueOtherMigration,
2825+
'national-society-development': surgeCatalogueOtherNationalSocietyDevelopment,
2826+
'partnership-and-resource-development': surgeCatalogueOtherPartnershipResourceDevelopment,
2827+
'preparedness-for-effective-response-per': surgeCatalogueOtherPreparednessEffectiveResponse,
2828+
recovery: surgeCatalogueOtherRecovery,
2829+
greenresponse: surgeCatalogueOtherGreenResponse,
2830+
},
2831+
};
2832+
2833+
const newCatalogueRoute = isTruthyString(params.catalogueId)
27312834
? catalogueRouteMap[params.catalogueId]
27322835
: undefined;
27332836

2734-
const path = isDefined(newRoute)
2735-
? newRoute.absoluteForwardPath
2736-
: surgeCatalogueOverview.absoluteForwardPath;
2837+
const newSubCatalogueRoute = isTruthyString(params.catalogueId)
2838+
&& isTruthyString(params.subCatalogueId)
2839+
? subCatalogueRouteMap[params.catalogueId]?.[params.subCatalogueId]
2840+
: undefined;
2841+
2842+
const path = newSubCatalogueRoute?.absoluteForwardPath
2843+
?? newCatalogueRoute?.absoluteForwardPath
2844+
?? surgeCatalogueOverview.absoluteForwardPath;
27372845

27382846
return (
27392847
<Navigate
@@ -2763,7 +2871,7 @@ const deploymentCatalogueIndex = customWrapRoute({
27632871

27642872
const deploymentCatalogueChildren = customWrapRoute({
27652873
parent: deploymentCatalogueLayout,
2766-
path: ':catalogueId',
2874+
path: ':catalogueId/:subCatalogueId?',
27672875
component: {
27682876
eagerLoad: true,
27692877
render: DeploymentCatalogueNavigate,
@@ -2914,8 +3022,10 @@ const wrappedRoutes = {
29143022
surgeCatalogueInformationManagement,
29153023
surgeCatalogueInformationManagementSatelliteImagery,
29163024
surgeCatalogueInformationManagementRolesResponsibility,
2917-
surgeCatalogueInformationManagementSupport,
2918-
surgeCatalogueInformationManagementOperationSupport,
3025+
// eslint-disable-next-line max-len
3026+
surgeCatalogueInformationManagementSupport: surgeCatalogueInformationManagementRegionalOfficeSupport,
3027+
// eslint-disable-next-line max-len
3028+
surgeCatalogueInformationManagementOperationSupport: surgeCatalogueInformationManagementGenevaSupport,
29193029
surgeCatalogueInformationManagementComposition,
29203030
surgeCatalogueInformationTechnology,
29213031
surgeCataloguePmer,

0 commit comments

Comments
 (0)