From bf77a67afffaa2c2477f179d6baa67ba50187c39 Mon Sep 17 00:00:00 2001 From: frozenhelium Date: Wed, 22 Nov 2023 14:47:13 +0545 Subject: [PATCH] Restructure country pages - Separate out routes into multiple files - Add dummy views for new country pages --- src/App/routes/CountryRoutes.tsx | 501 ++++ src/App/routes/RegionRoutes.tsx | 186 ++ src/App/routes/SurgeRoutes.tsx | 1506 +++++++++++ src/App/routes/common.tsx | 60 + src/App/routes/index.tsx | 2233 ++--------------- src/components/Link/index.tsx | 10 +- .../domain/CountryPageEmptyMessage/i18n.json | 6 + .../domain/CountryPageEmptyMessage/index.tsx | 30 + .../CountryPageEmptyMessage/styles.module.css | 3 + src/utils/outletContext.ts | 1 + src/views/Country/i18n.json | 8 +- src/views/Country/index.tsx | 29 +- src/views/CountryNsOverview/i18n.json | 9 + src/views/CountryNsOverview/index.tsx | 49 + src/views/CountryNsOverview/styles.module.css | 3 + .../CountryNsOverviewActivities/i18n.json | 6 + .../CountryNsOverviewActivities/index.tsx | 17 + .../styles.module.css | 0 src/views/CountryNsOverviewCapacity/i18n.json | 6 + src/views/CountryNsOverviewCapacity/index.tsx | 17 + .../styles.module.css | 0 .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 src/views/CountryOngoingActivities/i18n.json | 8 + src/views/CountryOngoingActivities/index.tsx | 43 + .../styles.module.css | 3 + .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 src/views/CountryPreviousEvents/i18n.json | 0 src/views/CountryPreviousEvents/index.tsx | 0 .../CountryPreviousEvents/styles.module.css | 0 src/views/CountryProfile/i18n.json | 9 + src/views/CountryProfile/index.tsx | 49 + src/views/CountryProfile/styles.module.css | 3 + src/views/CountryProfileOverview/i18n.json | 6 + src/views/CountryProfileOverview/index.tsx | 17 + .../CountryProfileOverview/styles.module.css | 0 .../CountryProfilePreviousEvents/i18n.json | 6 + .../CountryProfilePreviousEvents/index.tsx | 17 + .../styles.module.css | 0 .../CountryProfileSeasonalRisks/i18n.json | 6 + .../CountryProfileSeasonalRisks/index.tsx | 17 + .../styles.module.css | 0 .../i18n.json | 6 + .../index.tsx | 17 + .../styles.module.css | 0 src/views/CountrySeasonalRisks/i18n.json | 0 src/views/CountrySeasonalRisks/index.tsx | 0 .../CountrySeasonalRisks/styles.module.css | 0 src/views/CountrySupportingPartners/i18n.json | 0 src/views/CountrySupportingPartners/index.tsx | 0 .../styles.module.css | 0 .../CountryOngoingActivities/i18n.json | 0 .../CountryOngoingActivities/index.tsx | 0 .../styles.module.css | 0 66 files changed, 2895 insertions(+), 2107 deletions(-) create mode 100644 src/App/routes/CountryRoutes.tsx create mode 100644 src/App/routes/RegionRoutes.tsx create mode 100644 src/App/routes/SurgeRoutes.tsx create mode 100644 src/App/routes/common.tsx create mode 100644 src/components/domain/CountryPageEmptyMessage/i18n.json create mode 100644 src/components/domain/CountryPageEmptyMessage/index.tsx create mode 100644 src/components/domain/CountryPageEmptyMessage/styles.module.css create mode 100644 src/views/CountryNsOverview/i18n.json create mode 100644 src/views/CountryNsOverview/index.tsx create mode 100644 src/views/CountryNsOverview/styles.module.css create mode 100644 src/views/CountryNsOverviewActivities/i18n.json create mode 100644 src/views/CountryNsOverviewActivities/index.tsx create mode 100644 src/views/CountryNsOverviewActivities/styles.module.css create mode 100644 src/views/CountryNsOverviewCapacity/i18n.json create mode 100644 src/views/CountryNsOverviewCapacity/index.tsx create mode 100644 src/views/CountryNsOverviewCapacity/styles.module.css create mode 100644 src/views/CountryNsOverviewContextAndStructure/i18n.json create mode 100644 src/views/CountryNsOverviewContextAndStructure/index.tsx create mode 100644 src/views/CountryNsOverviewContextAndStructure/styles.module.css create mode 100644 src/views/CountryNsOverviewStrategicPriorities/i18n.json create mode 100644 src/views/CountryNsOverviewStrategicPriorities/index.tsx create mode 100644 src/views/CountryNsOverviewStrategicPriorities/styles.module.css create mode 100644 src/views/CountryOngoingActivities/i18n.json create mode 100644 src/views/CountryOngoingActivities/index.tsx create mode 100644 src/views/CountryOngoingActivities/styles.module.css create mode 100644 src/views/CountryOngoingActivitiesEmergencies/i18n.json create mode 100644 src/views/CountryOngoingActivitiesEmergencies/index.tsx create mode 100644 src/views/CountryOngoingActivitiesEmergencies/styles.module.css create mode 100644 src/views/CountryOngoingActivitiesThreeWActivities/i18n.json create mode 100644 src/views/CountryOngoingActivitiesThreeWActivities/index.tsx create mode 100644 src/views/CountryOngoingActivitiesThreeWActivities/styles.module.css create mode 100644 src/views/CountryOngoingActivitiesThreeWProjects/i18n.json create mode 100644 src/views/CountryOngoingActivitiesThreeWProjects/index.tsx create mode 100644 src/views/CountryOngoingActivitiesThreeWProjects/styles.module.css create mode 100644 src/views/CountryPreviousEvents/i18n.json create mode 100644 src/views/CountryPreviousEvents/index.tsx create mode 100644 src/views/CountryPreviousEvents/styles.module.css create mode 100644 src/views/CountryProfile/i18n.json create mode 100644 src/views/CountryProfile/index.tsx create mode 100644 src/views/CountryProfile/styles.module.css create mode 100644 src/views/CountryProfileOverview/i18n.json create mode 100644 src/views/CountryProfileOverview/index.tsx create mode 100644 src/views/CountryProfileOverview/styles.module.css create mode 100644 src/views/CountryProfilePreviousEvents/i18n.json create mode 100644 src/views/CountryProfilePreviousEvents/index.tsx create mode 100644 src/views/CountryProfilePreviousEvents/styles.module.css create mode 100644 src/views/CountryProfileSeasonalRisks/i18n.json create mode 100644 src/views/CountryProfileSeasonalRisks/index.tsx create mode 100644 src/views/CountryProfileSeasonalRisks/styles.module.css create mode 100644 src/views/CountryProfileSupportingPartners/i18n.json create mode 100644 src/views/CountryProfileSupportingPartners/index.tsx create mode 100644 src/views/CountryProfileSupportingPartners/styles.module.css create mode 100644 src/views/CountrySeasonalRisks/i18n.json create mode 100644 src/views/CountrySeasonalRisks/index.tsx create mode 100644 src/views/CountrySeasonalRisks/styles.module.css create mode 100644 src/views/CountrySupportingPartners/i18n.json create mode 100644 src/views/CountrySupportingPartners/index.tsx create mode 100644 src/views/CountrySupportingPartners/styles.module.css create mode 100644 src/views/CountryThreeWProjects/CountryOngoingActivities/i18n.json create mode 100644 src/views/CountryThreeWProjects/CountryOngoingActivities/index.tsx create mode 100644 src/views/CountryThreeWProjects/CountryOngoingActivities/styles.module.css diff --git a/src/App/routes/CountryRoutes.tsx b/src/App/routes/CountryRoutes.tsx new file mode 100644 index 0000000000..f5fcb6afec --- /dev/null +++ b/src/App/routes/CountryRoutes.tsx @@ -0,0 +1,501 @@ +import { + Navigate, + generatePath, + useParams, +} from 'react-router-dom'; +import { isDefined, isTruthyString } from '@togglecorp/fujs'; + +import { + COUNTRY_AFRICA_REGION, + COUNTRY_AMERICAS_REGION, + COUNTRY_ASIA_REGION, + COUNTRY_EUROPE_REGION, + COUNTRY_MENA_REGION, + REGION_AFRICA, + REGION_AMERICAS, + REGION_ASIA, + REGION_EUROPE, + REGION_MENA, +} from '#utils/constants'; + +import Auth from '../Auth'; +import { + customWrapRoute, + rootLayout, +} from './common'; +import regionRoutes from './RegionRoutes'; +import SmartNavigate from './SmartNavigate'; + +type DefaultCountriesChild = 'ongoing-activities'; +const countriesLayout = customWrapRoute({ + parent: rootLayout, + path: 'countries/:countryId', + forwardPath: 'ongoing-activities' satisfies DefaultCountriesChild, + component: { + render: () => import('#views/Country'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Country', + visibility: 'anything', + }, +}); + +// eslint-disable-next-line react-refresh/only-export-components +function CountryNavigate() { + // FIXME: this function might not be necessary anymore + + const params = useParams<{ countryId: string }>(); + const countryIdToRegionIdMap: Record = { + [COUNTRY_AFRICA_REGION]: REGION_AFRICA, + [COUNTRY_AMERICAS_REGION]: REGION_AMERICAS, + [COUNTRY_ASIA_REGION]: REGION_ASIA, + [COUNTRY_EUROPE_REGION]: REGION_EUROPE, + [COUNTRY_MENA_REGION]: REGION_MENA, + }; + + const countryId = isTruthyString(params.countryId) ? parseInt(params.countryId, 10) : undefined; + const regionId = isDefined(countryId) ? countryIdToRegionIdMap[countryId] : undefined; + + if (isDefined(regionId)) { + const regionPath = generatePath( + regionRoutes.regionIndex.absoluteForwardPath, + { regionId }, + ); + return ( + + ); + } + + return ( + + ); +} + +const countryIndex = customWrapRoute({ + parent: countriesLayout, + index: true, + component: { + eagerLoad: true, + render: CountryNavigate, + props: {}, + }, + context: { + title: 'Country', + visibility: 'anything', + }, +}); + +type DefaultOngoingActivitiesChild = 'emergencies'; +const countryOngoingActivitiesLayout = customWrapRoute({ + parent: countriesLayout, + path: 'ongoing-activities', + forwardPath: 'emergencies' satisfies DefaultOngoingActivitiesChild, + component: { + render: () => import('#views/CountryOngoingActivities'), + props: {}, + }, + context: { + title: 'Country Ongoing Activities', + visibility: 'anything', + }, +}); + +const countryOngoingActivitiesIndex = customWrapRoute({ + parent: countryOngoingActivitiesLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'emergencies' satisfies DefaultOngoingActivitiesChild, + replace: true, + }, + }, + context: { + title: 'Country Ongoing Activities Index', + visibility: 'anything', + }, +}); + +const countryOngoingActivitiesEmergencies = customWrapRoute({ + parent: countryOngoingActivitiesLayout, + path: 'emergencies' satisfies DefaultOngoingActivitiesChild, + component: { + render: () => import('#views/CountryOngoingActivitiesEmergencies'), + props: {}, + }, + context: { + title: 'Country Ongoing Emergencies', + visibility: 'anything', + }, +}); + +const countryOngoingActivitiesThreeWActivities = customWrapRoute({ + parent: countryOngoingActivitiesLayout, + path: 'three-w/activities', + component: { + render: () => import('#views/CountryOngoingActivitiesThreeWActivities'), + props: {}, + }, + context: { + title: 'Country 3W Activities', + visibility: 'anything', + }, +}); + +const countryOngoingActivitiesThreeWProjects = customWrapRoute({ + parent: countryOngoingActivitiesLayout, + path: 'three-w/projects', + component: { + render: () => import('#views/CountryOngoingActivitiesThreeWProjects'), + props: {}, + }, + context: { + title: 'Country 3W Projects', + visibility: 'anything', + }, +}); + +type DefaultNsOverviewChild = 'activities'; +const countryNsOverviewLayout = customWrapRoute({ + parent: countriesLayout, + path: 'ns-overview', + forwardPath: 'activities' satisfies DefaultNsOverviewChild, + component: { + render: () => import('#views/CountryNsOverview'), + props: {}, + }, + context: { + title: 'Country NS Overview', + visibility: 'anything', + }, +}); + +const countryNsOverviewIndex = customWrapRoute({ + parent: countryNsOverviewLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'activities' satisfies DefaultNsOverviewChild, + replace: true, + }, + }, + context: { + title: 'Country National Society Overview Index', + visibility: 'anything', + }, +}); + +const countryNsOverviewActivities = customWrapRoute({ + parent: countryNsOverviewLayout, + path: 'activities', + component: { + render: () => import('#views/CountryNsOverviewActivities'), + props: {}, + }, + context: { + title: 'Country NS Activities', + visibility: 'anything', + }, +}); + +const countryNsOverviewContextAndStructure = customWrapRoute({ + parent: countryNsOverviewLayout, + path: 'context-and-structure', + component: { + render: () => import('#views/CountryNsOverviewContextAndStructure'), + props: {}, + }, + context: { + title: 'Country NS Context and Structure', + visibility: 'anything', + }, +}); + +const countryNsOverviewStrategicPriorities = customWrapRoute({ + parent: countryNsOverviewLayout, + path: 'strategic-priorities', + component: { + render: () => import('#views/CountryNsOverviewStrategicPriorities'), + props: {}, + }, + context: { + title: 'Country NS Context and Structure', + visibility: 'anything', + }, +}); + +const countryNsOverviewCapacity = customWrapRoute({ + parent: countryNsOverviewLayout, + path: 'capacity', + component: { + render: () => import('#views/CountryNsOverviewCapacity'), + props: {}, + }, + context: { + title: 'Country NS Context and Structure', + visibility: 'anything', + }, +}); + +type DefaultCountryProfileChild = 'overview'; +const countryProfileLayout = customWrapRoute({ + parent: countriesLayout, + path: 'profile', + forwardPath: 'overview' satisfies DefaultCountryProfileChild, + component: { + render: () => import('#views/CountryProfile'), + props: {}, + }, + context: { + title: 'Country Profile', + visibility: 'anything', + }, +}); + +const countryProfileIndex = customWrapRoute({ + parent: countryProfileLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'overview' satisfies DefaultCountryProfileChild, + replace: true, + }, + }, + context: { + title: 'Country Profile Index', + visibility: 'anything', + }, +}); + +const countryProfileOverview = customWrapRoute({ + parent: countryProfileLayout, + path: 'overview', + component: { + render: () => import('#views/CountryProfileOverview'), + props: {}, + }, + context: { + title: 'Country Profile Overview', + visibility: 'anything', + }, +}); + +const countryProfileSupportingPartners = customWrapRoute({ + parent: countryProfileLayout, + path: 'supporting-partners', + component: { + render: () => import('#views/CountryProfileSupportingPartners'), + props: {}, + }, + context: { + title: 'Country Profile Supporting Partners', + visibility: 'anything', + }, +}); + +const countryProfilePreviousEvents = customWrapRoute({ + parent: countryProfileLayout, + path: 'previous-events', + component: { + render: () => import('#views/CountryProfilePreviousEvents'), + props: {}, + }, + context: { + title: 'Country Profile Previous Events', + visibility: 'anything', + }, +}); + +const countryProfileSeasonalRisks = customWrapRoute({ + parent: countryProfileLayout, + path: 'seasonal-risks', + component: { + render: () => import('#views/CountryProfileSeasonalRisks'), + props: {}, + }, + context: { + title: 'Country Profile Seasonal Risks', + visibility: 'anything', + }, +}); + +const countryOperations = customWrapRoute({ + parent: countriesLayout, + path: 'ongoing-activities' satisfies DefaultCountriesChild, + component: { + render: () => import('#views/CountryOperations'), + props: {}, + }, + context: { + title: 'Country Operations', + visibility: 'anything', + }, +}); + +type DefaultCountryThreeWChild = 'projects'; +const countriesThreeWLayout = customWrapRoute({ + parent: countriesLayout, + path: 'three-w', + forwardPath: 'projects' satisfies DefaultCountryThreeWChild, + component: { + render: () => import('#views/CountryThreeW'), + props: {}, + }, + context: { + title: 'Country 3W', + visibility: 'anything', + }, +}); + +const countryThreeWIndex = customWrapRoute({ + parent: countriesThreeWLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'projects' satisfies DefaultCountryThreeWChild, + replace: true, + }, + }, + context: { + title: 'Country 3W', + visibility: 'anything', + }, +}); + +const countryThreeWProjects = customWrapRoute({ + parent: countriesThreeWLayout, + path: 'projects' satisfies DefaultCountryThreeWChild, + component: { + render: () => import('#views/CountryThreeWProjects'), + props: {}, + }, + context: { + title: 'Country 3W Projects', + visibility: 'anything', + }, +}); + +const countryThreeWNationalSocietyProjects = customWrapRoute({ + parent: countriesThreeWLayout, + path: 'ns-projects', + component: { + render: () => import('#views/CountryThreeWNationalSocietyProjects'), + props: {}, + }, + context: { + title: 'Country 3W National Society Projects', + visibility: 'anything', + }, +}); + +const countryRiskWatch = customWrapRoute({ + parent: countriesLayout, + path: 'risk-watch', + component: { + render: () => import('#views/CountryRiskWatch'), + props: {}, + }, + context: { + title: 'Country Risk Watch', + visibility: 'anything', + }, +}); + +const countryPreparedness = customWrapRoute({ + parent: countriesLayout, + path: 'preparedness', + component: { + render: () => import('#views/CountryPreparedness'), + props: {}, + }, + context: { + title: 'Country Preparedness', + visibility: 'anything', + }, +}); + +const countryPlan = customWrapRoute({ + parent: countriesLayout, + path: 'plan', + component: { + render: () => import('#views/CountryPlan'), + props: {}, + }, + context: { + title: 'Country Plan', + visibility: 'anything', + }, +}); + +const countryAdditionalInfo = customWrapRoute({ + parent: countriesLayout, + path: 'additional-info', + component: { + render: () => import('#views/CountryAdditionalInfo'), + props: {}, + }, + context: { + title: 'Country Additional Info', + visibility: 'anything', + }, +}); + +export default { + countriesLayout, + countryIndex, + + countryOngoingActivitiesLayout, + countryOngoingActivitiesIndex, + countryOngoingActivitiesEmergencies, + countryOngoingActivitiesThreeWActivities, + countryOngoingActivitiesThreeWProjects, + + countryNsOverviewLayout, + countryNsOverviewIndex, + countryNsOverviewActivities, + countryNsOverviewContextAndStructure, + countryNsOverviewStrategicPriorities, + countryNsOverviewCapacity, + + countryProfileLayout, + countryProfileIndex, + countryProfileOverview, + countryProfileSupportingPartners, + countryProfilePreviousEvents, + countryProfileSeasonalRisks, + + countryAdditionalInfo, + + // TODO: following routes should be removed + countryOperations, + countriesThreeWLayout, + countryThreeWProjects, + countryThreeWNationalSocietyProjects, + countryThreeWIndex, + countryRiskWatch, + countryPreparedness, + countryPlan, +}; diff --git a/src/App/routes/RegionRoutes.tsx b/src/App/routes/RegionRoutes.tsx new file mode 100644 index 0000000000..38babed903 --- /dev/null +++ b/src/App/routes/RegionRoutes.tsx @@ -0,0 +1,186 @@ +import { Navigate } from 'react-router-dom'; + +import Auth from '../Auth'; +import { + customWrapRoute, + rootLayout, +} from './common'; +import SmartNavigate from './SmartNavigate'; + +type DefaultRegionsChild = 'operations'; +const regionsLayout = customWrapRoute({ + parent: rootLayout, + path: 'regions/:regionId', + forwardPath: 'operations' satisfies DefaultRegionsChild, + component: { + render: () => import('#views/Region'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Region', + visibility: 'anything', + }, +}); + +const regionIndex = customWrapRoute({ + parent: regionsLayout, + index: true, + component: { + eagerLoad: true, + render: SmartNavigate, + props: { + to: 'operations' satisfies DefaultRegionsChild, + replace: true, + hashToRouteMap: { + '#operations': 'operations', + '#3w': 'three-w', + '#risk-watch': 'risk-watch', + '#regional-profile': 'profile', + '#preparedness': 'preparedness', + '#additional-info': 'additional-info', + }, + }, + }, + context: { + title: 'Region', + visibility: 'anything', + }, +}); + +const regionOperations = customWrapRoute({ + parent: regionsLayout, + path: 'operations' satisfies DefaultRegionsChild, + component: { + render: () => import('#views/RegionOperations'), + props: {}, + }, + context: { + title: 'Region Operations', + visibility: 'anything', + }, +}); + +const regionThreeW = customWrapRoute({ + parent: regionsLayout, + path: 'three-w', + component: { + render: () => import('#views/RegionThreeW'), + props: {}, + }, + context: { + title: 'Region 3W', + visibility: 'anything', + }, +}); + +type DefaultRegionRiskWatchChild = 'seasonal'; +const regionRiskWatchLayout = customWrapRoute({ + parent: regionsLayout, + path: 'risk-watch', + forwardPath: 'seasonal' satisfies DefaultRegionRiskWatchChild, + component: { + render: () => import('#views/RegionRiskWatch'), + props: {}, + }, + context: { + title: 'Region Risk Watch', + visibility: 'anything', + }, +}); + +const regionRiskIndex = customWrapRoute({ + parent: regionRiskWatchLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'seasonal' satisfies DefaultRegionRiskWatchChild, + replace: true, + }, + }, + context: { + title: 'Region Risk Watch', + visibility: 'anything', + }, +}); + +const regionImminentRiskWatch = customWrapRoute({ + parent: regionRiskWatchLayout, + path: 'imminent', + component: { + render: () => import('#views/RegionRiskWatchImminent'), + props: {}, + }, + context: { + title: 'Region Imminent Risk Watch', + visibility: 'anything', + }, +}); + +const regionSeasonalRiskWatch = customWrapRoute({ + parent: regionRiskWatchLayout, + path: 'seasonal' satisfies DefaultRegionRiskWatchChild, + component: { + render: () => import('#views/RegionRiskWatchSeasonal'), + props: {}, + }, + context: { + title: 'Region Seasonal Risk Watch', + visibility: 'anything', + }, +}); + +const regionPreparedness = customWrapRoute({ + parent: regionsLayout, + path: 'preparedness', + component: { + render: () => import('#views/RegionPreparedness'), + props: {}, + }, + context: { + title: 'Region Preparedness', + visibility: 'anything', + }, +}); + +const regionProfile = customWrapRoute({ + parent: regionsLayout, + path: 'profile', + component: { + render: () => import('#views/RegionProfile'), + props: {}, + }, + context: { + title: 'Region Profile', + visibility: 'anything', + }, +}); + +const regionAdditionalInfo = customWrapRoute({ + parent: regionsLayout, + path: 'additional-info', + component: { + render: () => import('#views/RegionAdditionalInfo'), + props: {}, + }, + context: { + title: 'Region Additional Info', + visibility: 'anything', + }, +}); + +export default { + regionsLayout, + regionIndex, + regionOperations, + regionThreeW, + regionRiskWatchLayout, + regionRiskIndex, + regionImminentRiskWatch, + regionSeasonalRiskWatch, + regionPreparedness, + regionProfile, + regionAdditionalInfo, +}; diff --git a/src/App/routes/SurgeRoutes.tsx b/src/App/routes/SurgeRoutes.tsx new file mode 100644 index 0000000000..1170f1bd97 --- /dev/null +++ b/src/App/routes/SurgeRoutes.tsx @@ -0,0 +1,1506 @@ +import { + Navigate, + Outlet, + useParams, +} from 'react-router-dom'; +import { isDefined, isTruthyString } from '@togglecorp/fujs'; + +import type { MyOutputNonIndexRouteObject } from '#utils/routes'; + +import Auth from '../Auth'; + +import { + customWrapRoute, + rootLayout, + type ExtendedProps, +} from './common'; + +type DefaultSurgeChild = 'overview'; +const surgeLayout = customWrapRoute({ + parent: rootLayout, + path: 'surge', + forwardPath: 'overview' satisfies DefaultSurgeChild, + component: { + render: () => import('#views/Surge'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Surge', + visibility: 'anything', + }, +}); + +const surgeIndex = customWrapRoute({ + parent: surgeLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'overview' satisfies DefaultSurgeChild, + replace: true, + }, + }, + context: { + title: 'Surge', + visibility: 'anything', + }, +}); + +const surgeOverview = customWrapRoute({ + parent: surgeLayout, + path: 'overview' satisfies DefaultSurgeChild, + component: { + render: () => import('#views/SurgeOverview'), + props: {}, + }, + context: { + title: 'Surge Overview', + visibility: 'anything', + }, +}); + +const surgeOperationalToolbox = customWrapRoute({ + parent: surgeLayout, + path: 'operational-toolbox', + component: { + render: () => import('#views/SurgeOperationalToolbox'), + props: {}, + }, + context: { + title: 'Surge Operational Toolbox', + visibility: 'anything', + }, +}); + +type DefaultSurgeCatalogueChild = 'overview'; +const surgeCatalogueLayout = customWrapRoute({ + parent: surgeLayout, + path: 'catalogue', + forwardPath: 'overview' satisfies DefaultSurgeCatalogueChild, + component: { + render: () => import('#views/SurgeCatalogue'), + props: {}, + }, + context: { + title: 'Surge Catalogue', + visibility: 'anything', + }, +}); + +const catalogueIndex = customWrapRoute({ + parent: surgeCatalogueLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: 'overview' satisfies DefaultSurgeCatalogueChild, + replace: true, + }, + }, + context: { + title: 'Surge Catalogue', + visibility: 'anything', + }, +}); + +const surgeCatalogueOverview = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'overview' satisfies DefaultSurgeCatalogueChild, + component: { + render: () => import('#views/SurgeCatalogueOverview'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Surge Catalogue Overview', + visibility: 'anything', + }, +}); + +const surgeCatalogueEmergencyNeedsAssessment = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'emergency-needs-assessment', + component: { + render: () => import('#views/SurgeCatalogueEmergencyNeedsAssessment'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency Needs Assessment', + visibility: 'anything', + }, +}); + +const surgeCatalogueEmergencyNeedsAssessmentCell = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'emergency-needs-assessment/cell', + component: { + render: () => import('#views/SurgeCatalogueEmergencyNeedsAssessmentCell'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Assessment Cell', + visibility: 'anything', + }, +}); + +const surgeCatalogueBasecamp = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'basecamp', + component: { + render: () => import('#views/SurgeCatalogueBasecamp'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Basecamp Catalogue', + visibility: 'anything', + }, +}); + +const surgeCatalogueBasecampEruSmall = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'basecamp/eru-small', + component: { + render: () => import('#views/SurgeCatalogueBasecampEruSmall'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Basecamp ERU Small', + visibility: 'anything', + }, +}); + +const surgeCatalogueBasecampEruMedium = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'basecamp/eru-medium', + component: { + render: () => import('#views/SurgeCatalogueBasecampEruMedium'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Basecamp ERU Medium', + visibility: 'anything', + }, +}); + +const surgeCatalogueBasecampEruLarge = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'basecamp/eru-large', + component: { + render: () => import('#views/SurgeCatalogueBasecampEruLarge'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Basecamp ERU Large', + visibility: 'anything', + }, +}); + +const surgeCatalogueBasecampFacilityManagement = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'basecamp/facility-management', + component: { + render: () => import('#views/SurgeCatalogueBasecampFacilityManagement'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Basecamp Facility Management', + visibility: 'anything', + }, +}); + +const surgeCatalogueCash = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'cash', + component: { + render: () => import('#views/SurgeCatalogueCash'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Cash and Vouchers Assistance', + visibility: 'anything', + }, +}); + +const surgeCatalogueCashRapidResponse = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'cash/rapid-response', + component: { + render: () => import('#views/SurgeCatalogueCashRapidResponse'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Cash and Vouchers Assistance - Rapid Response', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunityEngagement = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'community-engagement', + component: { + render: () => import('#views/SurgeCatalogueCommunityEngagement'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Community Engagement and Accountability (CEA)', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunityEngagementRapidResponse = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'community/rapid-response', + component: { + render: () => import('#views/SurgeCatalogueCommunityEngagementRapidResponse'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Community Engagement and Accountability (CEA) - Rapid Response', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunication = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'communication', + component: { + render: () => import('#views/SurgeCatalogueCommunication'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Communication', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunicationErtOne = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'communication/cert-1', + component: { + render: () => import('#views/SurgeCatalogueCommunicationErtOne'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Communication Emergency Response Tool 1', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunicationErtTwo = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'communication/cert-2', + component: { + render: () => import('#views/SurgeCatalogueCommunicationErtTwo'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Communication Emergency Response Tool 2', + visibility: 'anything', + }, +}); + +const surgeCatalogueCommunicationErtThree = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'communication/cert-3', + component: { + render: () => import('#views/SurgeCatalogueCommunicationErtThree'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Communication Emergency Response Tool 3', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealth = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health', + component: { + render: () => import('#views/SurgeCatalogueHealth'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Health', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEruClinic = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/eru-clinic', + component: { + render: () => import('#views/SurgeCatalogueHealthEruClinic'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'ERU Red Cross Red Crescent Emergency Clinic', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEruHospital = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/eru-hospital', + component: { + render: () => import('#views/SurgeCatalogueHealthEruHospital'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'ERU Red Cross Red Crescent Emergency Hospital', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEruSurgical = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/eru-surgical', + component: { + render: () => import('#views/SurgeCatalogueHealthEruSurgical'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Health Surgical', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthMaternalNewbornClinic = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/maternal-newborn-clinic', + component: { + render: () => import('#views/SurgeCatalogueHealthMaternalNewbornClinic'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Maternal NewBorn Health Clinic', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEmergencyClinic = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/emergency-clinic', + component: { + render: () => import('#views/SurgeCatalogueHealthEmergencyClinic'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency Mobile Clinic', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEruChloreaTreatment = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/eru-chlorea-treatment', + component: { + render: () => import('#views/SurgeCatalogueHealthEruChloreaTreatment'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency Response Unit Chlorea Treatment Center', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthCommunityCaseManagementChlorea = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/community-case-management-chlorea', + component: { + render: () => import('#views/SurgeCatalogueHealthCommunityCaseManagementChlorea'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Community Case Management of Chlorea', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthCommunityBasedSurveillance = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/community-based-surveillance', + component: { + render: () => import('#views/SurgeCatalogueHealthCommunityBasedSurveillance'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Community Based Surveillance', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthSafeDignifiedBurials = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/safe-dignified-burials', + component: { + render: () => import('#views/SurgeCatalogueHealthSafeDignifiedBurials'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Safe and Dignified Burials', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthCommunityManagementMalnutrition = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/community-management-malnutrition', + component: { + render: () => import('#views/SurgeCatalogueHealthCommunityManagementMalnutrition'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Community Case Management of Malnutrition', + visibility: 'anything', + }, +}); + +const surgeCatalogueHealthEruPsychosocialSupport = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'health/eru-psychosocial-support', + component: { + render: () => import('#views/SurgeCatalogueHealthEruPsychosocialSupport'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency Response Unit Psychosocial Support', + visibility: 'anything', + }, +}); + +const surgeCatalogueInformationManagement = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management', + component: { + render: () => import('#views/SurgeCatalogueInformationManagement'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Information Management', + visibility: 'anything', + }, + +}); + +const surgeCatalogueInformationManagementSatelliteImagery = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management/satellite-imagery', + component: { + render: () => import('#views/SurgeCatalogueInformationManagementSatelliteImagery'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Satellite Imagery', + visibility: 'anything', + }, +}); + +const surgeCatalogueInformationManagementRolesResponsibility = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management/roles-responsibility', + component: { + render: () => import('#views/SurgeCatalogueInformationManagementRolesResponsibility'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Roles and Responsibilities', + visibility: 'anything', + }, +}); + +// TODO: update view name +const surgeCatalogueInformationManagementRegionalOfficeSupport = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management/regional-office-support', + component: { + render: () => import('#views/SurgeCatalogueInformationManagementSupport'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Information Management Support - Regional Office', + visibility: 'anything', + }, +}); + +// TODO: update view name +const surgeCatalogueInformationManagementGenevaSupport = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management/geneva-support', + component: { + render: () => import('#views/SurgeCatalogueInformationManagementOperationSupport'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Information Management Support - Geneva', + visibility: 'anything', + }, +}); + +const surgeCatalogueInformationManagementComposition = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-management/composition', + component: { + render: () => import('#views/SurgeCatalogueInformationManagementComposition'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Composition of IM Resources', + visibility: 'anything', + }, +}); + +const surgeCatalogueInformationTechnology = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-technology', + component: { + render: () => import('#views/SurgeCatalogueInformationTechnology'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Information Technology', + visibility: 'anything', + }, +}); + +const surgeCatalogueInformationTechnologyEruItTelecom = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'information-technology/eru-it-telecom', + component: { + render: () => import('#views/SurgeCatalogueInformationTechnologyEruItTelecom'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Information Technology Service', + visibility: 'anything', + }, +}); + +const surgeCatalogueLivelihood = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'livelihood', + component: { + render: () => import('#views/SurgeCatalogueLivelihood'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Livelihoods and Basic Needs', + visibility: 'anything', + }, +}); + +const surgeCatalogueLivelihoodServices = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'livelihood/services', + component: { + render: () => import('#views/SurgeCatalogueLivelihoodServices'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Livelihood Service', + visibility: 'anything', + }, +}); + +const surgeCatalogueLogistics = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'logistics', + component: { + render: () => import('#views/SurgeCatalogueLogistics'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Logistics', + visibility: 'anything', + }, +}); + +const surgeCatalogueLogisticsEru = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'logistics/eru', + component: { + render: () => import('#views/SurgeCatalogueLogisticsEru'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency Response Unit', + visibility: 'anything', + }, +}); + +const surgeCatalogueLogisticsLpscmNs = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'logistics/lpscm-ns', + component: { + render: () => import('#views/SurgeCatalogueLogisticsLpscmNs'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'LPSCM for National Societies', + visibility: 'anything', + }, +}); + +const surgeCatalogueOperationsManagement = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'operations-management', + component: { + render: () => import('#views/SurgeCatalogueOperationsManagement'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Operations Management', + visibility: 'anything', + }, +}); + +const surgeCatalogueOperationManagementHeops = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'operations-management/heops', + component: { + render: () => import('#views/SurgeCatalogueOperationsManagementHeops'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Head of Emergency Operations (HEOPS)', + visibility: 'anything', + }, +}); + +const surgeCataloguePgi = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'pgi', + component: { + render: () => import('#views/SurgeCataloguePgi'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Protection, Gender and inclusion (PGI)', + visibility: 'anything', + }, +}); + +const surgeCataloguePgiServices = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'pgi/services', + component: { + render: () => import('#views/SurgeCataloguePgiServices'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Protection Gender and Inclusion - Services', + visibility: 'anything', + }, +}); + +const surgeCataloguePmer = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'pmer', + component: { + render: () => import('#views/SurgeCataloguePmer'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Planning, Monitoring, Evaluation And Reporting (PMER)', + visibility: 'anything', + }, +}); + +const surgeCataloguePmerEmergencyPlanAction = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'pmer/emergency-plan-action', + component: { + render: () => import('#views/SurgeCataloguePmerEmergencyPlanAction'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Emergency plan of action EPOA monitoring evaluation plan', + visibility: 'anything', + }, +}); + +const surgeCataloguePmerRealTimeEvaluation = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'pmer/real-time-evaluation', + component: { + render: () => import('#views/SurgeCataloguePmerRealTimeEvaluation'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Real time evaluation RTE and guidance', + visibility: 'anything', + }, +}); + +const surgeCatalogueShelter = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'shelter', + component: { + render: () => import('#views/SurgeCatalogueShelter'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Shelter', + visibility: 'anything', + }, +}); + +const surgeCatalogueShelterCoordinatorTeam = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'shelter/coordinator-team', + component: { + render: () => import('#views/SurgeCatalogueShelterCoordinatorTeam'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Shelter Surge Coordinator', + visibility: 'anything', + }, +}); + +const surgeCatalogueShelterTechnicalTeam = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'shelter/technical-team', + component: { + render: () => import('#views/SurgeCatalogueShelterTechnicalTeam'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Shelter Technical Team', + visibility: 'anything', + }, +}); + +const surgeCatalogueWash = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash', + component: { + render: () => import('#views/SurgeCatalogueWash'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Water, Sanitation and Hygiene (WASH)', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashKit2 = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/kit-2', + component: { + render: () => import('#views/SurgeCatalogueWashKit2'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'WASH Kit-2', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashKit5 = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/kit-5', + component: { + render: () => import('#views/SurgeCatalogueWashKit5'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'WASH Kit-5', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashKitM15Eru = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/m15-eru', + component: { + render: () => import('#views/SurgeCatalogueWashKitM15Eru'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'WASH Kit-M15 ERU', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashKitMsm20Eru = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/msm20-eru', + component: { + render: () => import('#views/SurgeCatalogueWashKitMsm20Eru'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Wash Kit-MSM20 ERU', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashKitM40Eru = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/m40-eru', + component: { + render: () => import('#views/SurgeCatalogueWashKitM40Eru'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Wash Kit-M40 ERU', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashWaterSupplyRehabilitation = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/water-supply-rehabilitation', + component: { + render: () => import('#views/SurgeCatalogueWashWaterSupplyRehabilitation'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Water Supply Rehabilitation', + visibility: 'anything', + }, +}); + +const surgeCatalogueWashHwts = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'wash/hwts', + component: { + render: () => import('#views/SurgeCatalogueWashHwts'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Household Water Treatment and Safe Storage (HWTS)', + visibility: 'anything', + }, +}); + +const surgeCatalogueRelief = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'relief', + component: { + render: () => import('#views/SurgeCatalogueRelief'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Relief', + visibility: 'anything', + }, +}); + +const surgeCatalogueReliefEru = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'relief/eru', + component: { + render: () => import('#views/SurgeCatalogueReliefEru'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Relief ERU', + visibility: 'anything', + }, +}); + +const surgeCatalogueSecurity = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'security', + component: { + render: () => import('#views/SurgeCatalogueSecurity'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Security', + visibility: 'anything', + }, +}); + +const surgeCatalogueSecurityManagement = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'security/management', + component: { + render: () => import('#views/SurgeCatalogueSecurityManagement'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Security Management', + visibility: 'anything', + }, +}); + +const surgeCatalogueOther = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other', + component: { + render: () => import('#views/SurgeCatalogueOther'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Other', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherCivilMilitaryRelations = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/civil-military-relations', + component: { + render: () => import('#views/SurgeCatalogueOtherCivilMilitaryRelations'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Civil Military Relations', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherDisasterRiskReduction = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/disaster-risk-reduction', + component: { + render: () => import('#views/SurgeCatalogueOtherDisasterRiskReduction'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Disaster Risk Reduction', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherHumanResources = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/human-resources', + component: { + render: () => import('#views/SurgeCatalogueOtherHumanResources'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Human Resources', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherInternationalDisasterResponseLaw = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/international-disaster-response-law', + component: { + render: () => import('#views/SurgeCatalogueOtherInternationalDisasterResponseLaw'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'International Diaster Response Law', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherMigration = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/migration', + component: { + render: () => import('#views/SurgeCatalogueOtherMigration'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Migration', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherNationalSocietyDevelopment = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/national-society-development', + component: { + render: () => import('#views/SurgeCatalogueOtherNationalSocietyDevelopment'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'National Society Development', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherPartnershipResourceDevelopment = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/partnership-resource-development', + component: { + render: () => import('#views/SurgeCatalogueOtherPartnershipResourceDevelopment'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Partnership Resource Development', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherPreparednessEffectiveResponse = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/preparedness-effective-response', + component: { + render: () => import('#views/SurgeCatalogueOtherPreparednessEffectiveResponse'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Preparedness Effective Response', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherRecovery = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/recovery', + component: { + render: () => import('#views/SurgeCatalogueOtherRecovery'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Recovery', + visibility: 'anything', + }, +}); + +const surgeCatalogueOtherGreenResponse = customWrapRoute({ + parent: surgeCatalogueLayout, + path: 'other/green-response', + component: { + render: () => import('#views/SurgeCatalogueOtherGreenResponse'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Green Response', + visibility: 'anything', + }, +}); + +const allDeployedPersonnel = customWrapRoute({ + parent: rootLayout, + path: 'deployed-personnels/all', + component: { + render: () => import('#views/AllDeployedPersonnel'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'All Deployed Personnel', + visibility: 'anything', + }, +}); + +const allDeployedEmergencyResponseUnits = customWrapRoute({ + parent: rootLayout, + path: 'deployed-erus/all', + component: { + render: () => import('#views/AllDeployedEmergencyResponseUnits'), + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'All Deployed Emergency Response Units', + visibility: 'anything', + }, +}); + +// eslint-disable-next-line react-refresh/only-export-components +function DeploymentNavigate() { + const params = useParams<{ surgeId: string }>(); + + const deploymentRouteMap: Record> = { + overview: surgeOverview, + 'operational-toolbox': surgeOperationalToolbox, + personnel: allDeployedPersonnel, + erus: allDeployedEmergencyResponseUnits, + }; + + const newRoute = isDefined(params.surgeId) + ? deploymentRouteMap[params.surgeId] + : undefined; + + const path = isDefined(newRoute) + ? newRoute.absoluteForwardPath + : surgeOverview.absoluteForwardPath; + + return ( + + ); +} + +const deploymentOthers = customWrapRoute({ + parent: rootLayout, + path: 'deployments/:surgeId/*', + component: { + eagerLoad: true, + render: DeploymentNavigate, + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Catalogue of surge services', + visibility: 'anything', + }, +}); + +const deploymentCatalogueLayout = customWrapRoute({ + parent: rootLayout, + path: 'deployments/catalogue', + component: { + eagerLoad: true, + render: () => , + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Catalogue of surge services', + visibility: 'anything', + }, +}); + +// eslint-disable-next-line react-refresh/only-export-components +function DeploymentCatalogueNavigate() { + const params = useParams<{ + catalogueId: string, + subCatalogueId: string, + }>(); + + type WrappedRoute = MyOutputNonIndexRouteObject; + + const catalogueRouteMap: Record = { + overview: surgeCatalogueOverview, + emergency: surgeCatalogueEmergencyNeedsAssessment, + basecamp: surgeCatalogueBasecamp, + cash: surgeCatalogueCash, + community: surgeCatalogueCommunityEngagement, + communications: surgeCatalogueCommunication, + health: surgeCatalogueHealth, + infoMgt: surgeCatalogueInformationManagement, + informationTech: surgeCatalogueInformationTechnology, + livelihoods: surgeCatalogueLivelihood, + logistics: surgeCatalogueLogistics, + operations: surgeCatalogueOperationsManagement, + protection: surgeCataloguePgi, + planning: surgeCataloguePmer, + relief: surgeCatalogueRelief, + security: surgeCatalogueSecurity, + shelter: surgeCatalogueShelter, + water: surgeCatalogueWash, + other: surgeCatalogueOther, + }; + + const subCatalogueRouteMap: Record> = { + emergency: { + 'assessment-cell': surgeCatalogueEmergencyNeedsAssessmentCell, + }, + basecamp: { + 'eru-base-camp-small': surgeCatalogueBasecampEruSmall, + 'eru-base-camp-medium': surgeCatalogueBasecampEruMedium, + 'eru-base-camp-large': surgeCatalogueBasecampEruLarge, + 'facility-management': surgeCatalogueBasecampFacilityManagement, + }, + cash: { + cva: surgeCatalogueCashRapidResponse, + }, + community: { + 'community-engagement-and-accountability': surgeCatalogueCommunityEngagementRapidResponse, + }, + communications: { + 'communications-emergency-response-tool-cert-3': surgeCatalogueCommunicationErtThree, + 'communications-emergency-response-tool-cert-2': surgeCatalogueCommunicationErtTwo, + 'communications-emergency-response-tool-cert-1': surgeCatalogueCommunicationErtOne, + }, + health: { + 'eru-pss-module': surgeCatalogueHealthEruPsychosocialSupport, + 'community-case-management-of-malnutrition-ccmm': surgeCatalogueHealthCommunityManagementMalnutrition, + 'safe-and-dignified-burials': surgeCatalogueHealthSafeDignifiedBurials, + 'community-based-surveillance-cbs': surgeCatalogueHealthCommunityBasedSurveillance, + 'community-case-management-of-cholera-ccmc': surgeCatalogueHealthCommunityCaseManagementChlorea, + 'eru-cholera-treatment-center': surgeCatalogueHealthEruChloreaTreatment, + 'emergency-mobile-clinic': surgeCatalogueHealthEmergencyClinic, + 'maternal-newborn-health-clinic': surgeCatalogueHealthMaternalNewbornClinic, + 'surgical-surge': surgeCatalogueHealthEruSurgical, + 'eru-red-cross-red-crescent-emergency-hospital': surgeCatalogueHealthEruHospital, + 'eru-red-cross-red-crescent-emergency-clinic': surgeCatalogueHealthEruClinic, + }, + infoMgt: { + // NOTE: sims was probably replace with link to its site + // 'surge-information-management-support-sims': , + 'roles-and-resps': surgeCatalogueInformationManagementRolesResponsibility, + 'im-support-for-op': surgeCatalogueInformationManagementRegionalOfficeSupport, + 'ifrc-geneva-im': surgeCatalogueInformationManagementGenevaSupport, + 'composition-of-im-res': surgeCatalogueInformationManagementComposition, + 'Satellite-imagery': surgeCatalogueInformationManagementSatelliteImagery, + }, + informationTech: { + 'eru-it-telecom': surgeCatalogueInformationTechnologyEruItTelecom, + }, + livelihoods: { + 'livelihoods-and-basic-needs': surgeCatalogueLivelihoodServices, + }, + logistics: { + 'lpscm-for-national-societies': surgeCatalogueLogisticsLpscmNs, + 'logistics-eru': surgeCatalogueLogisticsEru, + }, + operations: { + 'head-of-emergency-operations-heops': surgeCatalogueOperationManagementHeops, + }, + protection: { + 'protection-gender-and-inclusion': surgeCataloguePgiServices, + }, + planning: { + 'real-time-evaluation-rte-and-guidance': surgeCataloguePmerRealTimeEvaluation, + 'emergency-plan-of-action-epoa-monitoring-evaluation-plan': surgeCataloguePmerEmergencyPlanAction, + }, + relief: { + 'eru-relief': surgeCatalogueReliefEru, + }, + security: { + 'security-management': surgeCatalogueSecurityManagement, + }, + shelter: { + 'stt-shelter-technical-team': surgeCatalogueShelterTechnicalTeam, + 'sct-shelter-coordination-team': surgeCatalogueShelterCoordinatorTeam, + }, + water: { + 'household-water-treatment-and-safe-storage-hwts': surgeCatalogueWashHwts, + 'water-supply-rehabilitation-wsr': surgeCatalogueWashWaterSupplyRehabilitation, + 'm40-eru': surgeCatalogueWashKitM40Eru, + 'msm20-eru': surgeCatalogueWashKitMsm20Eru, + 'm15-eru': surgeCatalogueWashKitM15Eru, + 'kit-5': surgeCatalogueWashKit5, + 'kit-2': surgeCatalogueWashKit2, + }, + other: { + 'civil-military-relations': surgeCatalogueOtherCivilMilitaryRelations, + 'disaster-risk-reduction-drr': surgeCatalogueOtherDisasterRiskReduction, + 'human-resources': surgeCatalogueOtherHumanResources, + 'international-disaster-response-law': surgeCatalogueOtherInternationalDisasterResponseLaw, + migration: surgeCatalogueOtherMigration, + 'national-society-development': surgeCatalogueOtherNationalSocietyDevelopment, + 'partnership-and-resource-development': surgeCatalogueOtherPartnershipResourceDevelopment, + 'preparedness-for-effective-response-per': surgeCatalogueOtherPreparednessEffectiveResponse, + recovery: surgeCatalogueOtherRecovery, + greenresponse: surgeCatalogueOtherGreenResponse, + }, + }; + + const newCatalogueRoute = isTruthyString(params.catalogueId) + ? catalogueRouteMap[params.catalogueId] + : undefined; + + const newSubCatalogueRoute = isTruthyString(params.catalogueId) + && isTruthyString(params.subCatalogueId) + ? subCatalogueRouteMap[params.catalogueId]?.[params.subCatalogueId] + : undefined; + + const path = newSubCatalogueRoute?.absoluteForwardPath + ?? newCatalogueRoute?.absoluteForwardPath + ?? surgeCatalogueOverview.absoluteForwardPath; + + return ( + + ); +} + +const deploymentCatalogueIndex = customWrapRoute({ + parent: deploymentCatalogueLayout, + index: true, + component: { + eagerLoad: true, + render: Navigate, + props: { + to: '/surge/catalogue', + replace: true, + }, + }, + wrapperComponent: Auth, + context: { + title: 'Catalogue of surge services', + visibility: 'anything', + }, +}); + +const deploymentCatalogueChildren = customWrapRoute({ + parent: deploymentCatalogueLayout, + path: ':catalogueId/:subCatalogueId?', + component: { + eagerLoad: true, + render: DeploymentCatalogueNavigate, + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'Catalogue of surge services', + visibility: 'anything', + }, +}); + +export default { + surgeLayout, + surgeOverview, + surgeOperationalToolbox, + surgeCatalogueLayout, + surgeIndex, + catalogueIndex, + surgeCatalogueOverview, + surgeCatalogueEmergencyNeedsAssessment, + surgeCatalogueEmergencyNeedsAssessmentCell, + surgeCatalogueBasecamp, + surgeCatalogueBasecampEruSmall, + surgeCatalogueBasecampEruMedium, + surgeCatalogueBasecampEruLarge, + surgeCatalogueBasecampFacilityManagement, + surgeCatalogueCash, + surgeCatalogueCashRapidResponse, + surgeCatalogueCommunityEngagement, + surgeCatalogueCommunityEngagementRapidResponse, + surgeCatalogueCommunication, + surgeCatalogueCommunicationErtOne, + surgeCatalogueCommunicationErtTwo, + surgeCatalogueCommunicationErtThree, + surgeCatalogueHealth, + surgeCatalogueHealthEruClinic, + surgeCatalogueHealthEruHospital, + surgeCatalogueHealthEruSurgical, + surgeCatalogueHealthMaternalNewbornClinic, + surgeCatalogueHealthEmergencyClinic, + surgeCatalogueHealthEruChloreaTreatment, + surgeCatalogueHealthCommunityCaseManagementChlorea, + surgeCatalogueHealthCommunityBasedSurveillance, + surgeCatalogueHealthSafeDignifiedBurials, + surgeCatalogueHealthCommunityManagementMalnutrition, + surgeCatalogueHealthEruPsychosocialSupport, + surgeCatalogueInformationManagement, + surgeCatalogueInformationManagementSatelliteImagery, + surgeCatalogueInformationManagementRolesResponsibility, + // eslint-disable-next-line max-len + surgeCatalogueInformationManagementSupport: surgeCatalogueInformationManagementRegionalOfficeSupport, + // eslint-disable-next-line max-len + surgeCatalogueInformationManagementOperationSupport: surgeCatalogueInformationManagementGenevaSupport, + surgeCatalogueInformationManagementComposition, + surgeCatalogueInformationTechnology, + surgeCataloguePmer, + surgeCataloguePmerEmergencyPlanAction, + surgeCataloguePmerRealTimeEvaluation, + surgeCatalogueInformationTechnologyEruItTelecom, + surgeCatalogueLivelihood, + surgeCatalogueLivelihoodServices, + surgeCatalogueSecurity, + surgeCatalogueSecurityManagement, + surgeCatalogueLogistics, + surgeCatalogueLogisticsEru, + surgeCatalogueLogisticsLpscmNs, + surgeCatalogueOperationsManagement, + surgeCatalogueOperationManagementHeops, + surgeCataloguePgi, + surgeCatalogueRelief, + surgeCatalogueReliefEru, + surgeCataloguePgiServices, + surgeCatalogueShelter, + surgeCatalogueShelterTechnicalTeam, + surgeCatalogueShelterCoordinatorTeam, + surgeCatalogueWash, + surgeCatalogueWashKit2, + surgeCatalogueWashKit5, + surgeCatalogueWashKitM15Eru, + surgeCatalogueWashKitMsm20Eru, + surgeCatalogueWashKitM40Eru, + surgeCatalogueWashWaterSupplyRehabilitation, + surgeCatalogueWashHwts, + surgeCatalogueOther, + surgeCatalogueOtherCivilMilitaryRelations, + surgeCatalogueOtherDisasterRiskReduction, + surgeCatalogueOtherHumanResources, + surgeCatalogueOtherInternationalDisasterResponseLaw, + surgeCatalogueOtherMigration, + surgeCatalogueOtherNationalSocietyDevelopment, + surgeCatalogueOtherPartnershipResourceDevelopment, + surgeCatalogueOtherPreparednessEffectiveResponse, + surgeCatalogueOtherRecovery, + surgeCatalogueOtherGreenResponse, + + allDeployedPersonnel, + allDeployedEmergencyResponseUnits, + + // Redirect routes + deploymentCatalogueLayout, + deploymentCatalogueIndex, + deploymentCatalogueChildren, + deploymentOthers, +}; diff --git a/src/App/routes/common.tsx b/src/App/routes/common.tsx new file mode 100644 index 0000000000..cb57dcb281 --- /dev/null +++ b/src/App/routes/common.tsx @@ -0,0 +1,60 @@ +import { Component as RootLayout } from '#views/RootLayout'; + +import { + type MyInputIndexRouteObject, + type MyInputNonIndexRouteObject, + type MyOutputIndexRouteObject, + type MyOutputNonIndexRouteObject, + wrapRoute, +} from '#utils/routes'; + +import Auth from '../Auth'; +import PageError from '../PageError'; + +export interface Perms { + isDrefRegionalCoordinator: (regionId: number | undefined) => boolean, + isRegionAdmin: (regionId: number | undefined) => boolean, + isCountryAdmin: (countryId: number | undefined) => boolean, + isRegionPerAdmin: (regionId: number | undefined) => boolean, + isCountryPerAdmin: (countryId: number | undefined) => boolean, + isPerAdmin: boolean, + isIfrcAdmin: boolean, + isSuperUser: boolean, +} + +export type ExtendedProps = { + title: string, + visibility: 'is-authenticated' | 'is-not-authenticated' | 'anything', + permissions?: ( + permissions: Perms, + params: Record | undefined | null, + ) => boolean; +}; + +export interface CustomWrapRoute { + ( + myRouteOptions: MyInputIndexRouteObject + ): MyOutputIndexRouteObject + ( + myRouteOptions: MyInputNonIndexRouteObject + ): MyOutputNonIndexRouteObject +} + +export const customWrapRoute: CustomWrapRoute = wrapRoute; + +// NOTE: We should not use layout or index routes in links + +export const rootLayout = customWrapRoute({ + path: '/', + errorElement: , + component: { + eagerLoad: true, + render: RootLayout, + props: {}, + }, + wrapperComponent: Auth, + context: { + title: 'IFRC GO', + visibility: 'anything', + }, +}); diff --git a/src/App/routes/index.tsx b/src/App/routes/index.tsx index 921bd35678..2b7a04a6c1 100644 --- a/src/App/routes/index.tsx +++ b/src/App/routes/index.tsx @@ -1,1862 +1,304 @@ -import { - Navigate, - Outlet, - generatePath, - useParams, -} from 'react-router-dom'; -import { isDefined, isTruthyString } from '@togglecorp/fujs'; - -import { Component as RootLayout } from '#views/RootLayout'; -import { - wrapRoute, - unwrapRoute, -} from '#utils/routes'; -import type { - MyInputIndexRouteObject, - MyInputNonIndexRouteObject, - MyOutputIndexRouteObject, - MyOutputNonIndexRouteObject, -} from '#utils/routes'; -import { - COUNTRY_AFRICA_REGION, - COUNTRY_AMERICAS_REGION, - COUNTRY_ASIA_REGION, - COUNTRY_EUROPE_REGION, - COUNTRY_MENA_REGION, - REGION_AFRICA, - REGION_AMERICAS, - REGION_ASIA, - REGION_EUROPE, - REGION_MENA, -} from '#utils/constants'; - -import Auth from '../Auth'; -import PageError from '../PageError'; - -import SmartNavigate from './SmartNavigate'; - -interface Perms { - isDrefRegionalCoordinator: (regionId: number | undefined) => boolean, - isRegionAdmin: (regionId: number | undefined) => boolean, - isCountryAdmin: (countryId: number | undefined) => boolean, - isRegionPerAdmin: (regionId: number | undefined) => boolean, - isCountryPerAdmin: (countryId: number | undefined) => boolean, - isPerAdmin: boolean, - isIfrcAdmin: boolean, - isSuperUser: boolean, -} - -export type ExtendedProps = { - title: string, - visibility: 'is-authenticated' | 'is-not-authenticated' | 'anything', - permissions?: ( - permissions: Perms, - params: Record | undefined | null, - ) => boolean; -}; -interface CustomWrapRoute { - ( - myRouteOptions: MyInputIndexRouteObject - ): MyOutputIndexRouteObject - ( - myRouteOptions: MyInputNonIndexRouteObject - ): MyOutputNonIndexRouteObject -} -const customWrapRoute: CustomWrapRoute = wrapRoute; - -// NOTE: We should not use layout or index routes in links - -const rootLayout = customWrapRoute({ - path: '/', - errorElement: , - component: { - eagerLoad: true, - render: RootLayout, - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'IFRC GO', - visibility: 'anything', - }, -}); - -const fourHundredFour = customWrapRoute({ - parent: rootLayout, - path: '*', - component: { - render: () => import('#views/FourHundredFour'), - props: {}, - }, - context: { - title: '404', - visibility: 'anything', - }, -}); - -const login = customWrapRoute({ - parent: rootLayout, - path: 'login', - component: { - render: () => import('#views/Login'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Login', - visibility: 'is-not-authenticated', - }, -}); - -const register = customWrapRoute({ - parent: rootLayout, - path: 'register', - component: { - render: () => import('#views/Register'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Register', - visibility: 'is-not-authenticated', - }, -}); - -const recoverAccount = customWrapRoute({ - parent: rootLayout, - path: 'recover-account', - component: { - render: () => import('#views/RecoverAccount'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Recover Account', - visibility: 'is-not-authenticated', - }, -}); - -const recoverAccountConfirm = customWrapRoute({ - parent: rootLayout, - path: 'recover-account/:username/:token', - component: { - render: () => import('#views/RecoverAccountConfirm'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Recover Account Confirm', - visibility: 'is-not-authenticated', - }, -}); - -const resendValidationEmail = customWrapRoute({ - parent: rootLayout, - path: 'resend-validation-email', - component: { - render: () => import('#views/ResendValidationEmail'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Resend Validation Email', - visibility: 'is-not-authenticated', - }, -}); - -const home = customWrapRoute({ - parent: rootLayout, - index: true, - component: { - render: () => import('#views/Home'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Home', - visibility: 'anything', - }, -}); - -type DefaultRegionsChild = 'operations'; -const regionsLayout = customWrapRoute({ - parent: rootLayout, - path: 'regions/:regionId', - forwardPath: 'operations' satisfies DefaultRegionsChild, - component: { - render: () => import('#views/Region'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Region', - visibility: 'anything', - }, -}); - -const regionIndex = customWrapRoute({ - parent: regionsLayout, - index: true, - component: { - eagerLoad: true, - render: SmartNavigate, - props: { - to: 'operations' satisfies DefaultRegionsChild, - replace: true, - hashToRouteMap: { - '#operations': 'operations', - '#3w': 'three-w', - '#risk-watch': 'risk-watch', - '#regional-profile': 'profile', - '#preparedness': 'preparedness', - '#additional-info': 'additional-info', - }, - }, - }, - context: { - title: 'Region', - visibility: 'anything', - }, -}); - -const regionOperations = customWrapRoute({ - parent: regionsLayout, - path: 'operations' satisfies DefaultRegionsChild, - component: { - render: () => import('#views/RegionOperations'), - props: {}, - }, - context: { - title: 'Region Operations', - visibility: 'anything', - }, -}); - -const regionThreeW = customWrapRoute({ - parent: regionsLayout, - path: 'three-w', - component: { - render: () => import('#views/RegionThreeW'), - props: {}, - }, - context: { - title: 'Region 3W', - visibility: 'anything', - }, -}); - -type DefaultRegionRiskWatchChild = 'seasonal'; -const regionRiskWatchLayout = customWrapRoute({ - parent: regionsLayout, - path: 'risk-watch', - forwardPath: 'seasonal' satisfies DefaultRegionRiskWatchChild, - component: { - render: () => import('#views/RegionRiskWatch'), - props: {}, - }, - context: { - title: 'Region Risk Watch', - visibility: 'anything', - }, -}); - -const regionRiskIndex = customWrapRoute({ - parent: regionRiskWatchLayout, - index: true, - component: { - eagerLoad: true, - render: Navigate, - props: { - to: 'seasonal' satisfies DefaultRegionRiskWatchChild, - replace: true, - }, - }, - context: { - title: 'Region Risk Watch', - visibility: 'anything', - }, -}); - -const regionImminentRiskWatch = customWrapRoute({ - parent: regionRiskWatchLayout, - path: 'imminent', - component: { - render: () => import('#views/RegionRiskWatchImminent'), - props: {}, - }, - context: { - title: 'Region Imminent Risk Watch', - visibility: 'anything', - }, -}); - -const regionSeasonalRiskWatch = customWrapRoute({ - parent: regionRiskWatchLayout, - path: 'seasonal' satisfies DefaultRegionRiskWatchChild, - component: { - render: () => import('#views/RegionRiskWatchSeasonal'), - props: {}, - }, - context: { - title: 'Region Seasonal Risk Watch', - visibility: 'anything', - }, -}); - -const regionPreparedness = customWrapRoute({ - parent: regionsLayout, - path: 'preparedness', - component: { - render: () => import('#views/RegionPreparedness'), - props: {}, - }, - context: { - title: 'Region Preparedness', - visibility: 'anything', - }, -}); - -const regionProfile = customWrapRoute({ - parent: regionsLayout, - path: 'profile', - component: { - render: () => import('#views/RegionProfile'), - props: {}, - }, - context: { - title: 'Region Profile', - visibility: 'anything', - }, -}); - -const regionAdditionalInfo = customWrapRoute({ - parent: regionsLayout, - path: 'additional-info', - component: { - render: () => import('#views/RegionAdditionalInfo'), - props: {}, - }, - context: { - title: 'Region Additional Info', - visibility: 'anything', - }, -}); - -type DefaultCountriesChild = 'operations'; -const countriesLayout = customWrapRoute({ - parent: rootLayout, - path: 'countries/:countryId', - forwardPath: 'operations' satisfies DefaultCountriesChild, - component: { - render: () => import('#views/Country'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Country', - visibility: 'anything', - }, -}); - -// eslint-disable-next-line react-refresh/only-export-components -function CountryNavigate() { - const params = useParams<{ countryId: string }>(); - const countryIdToRegionIdMap: Record = { - [COUNTRY_AFRICA_REGION]: REGION_AFRICA, - [COUNTRY_AMERICAS_REGION]: REGION_AMERICAS, - [COUNTRY_ASIA_REGION]: REGION_ASIA, - [COUNTRY_EUROPE_REGION]: REGION_EUROPE, - [COUNTRY_MENA_REGION]: REGION_MENA, - }; - - const countryId = isTruthyString(params.countryId) ? parseInt(params.countryId, 10) : undefined; - const regionId = isDefined(countryId) ? countryIdToRegionIdMap[countryId] : undefined; - - if (isDefined(regionId)) { - const regionPath = generatePath( - regionIndex.absoluteForwardPath, - { regionId }, - ); - return ( - - ); - } - - return ( - - ); -} - -const countryIndex = customWrapRoute({ - parent: countriesLayout, - index: true, - component: { - eagerLoad: true, - render: CountryNavigate, - props: {}, - }, - context: { - title: 'Country', - visibility: 'anything', - }, -}); - -const countryOperations = customWrapRoute({ - parent: countriesLayout, - path: 'operations' satisfies DefaultCountriesChild, - component: { - render: () => import('#views/CountryOperations'), - props: {}, - }, - context: { - title: 'Country Operations', - visibility: 'anything', - }, -}); - -type DefaultCountryThreeWChild = 'projects'; -const countriesThreeWLayout = customWrapRoute({ - parent: countriesLayout, - path: 'three-w', - forwardPath: 'projects' satisfies DefaultCountryThreeWChild, - component: { - render: () => import('#views/CountryThreeW'), - props: {}, - }, - context: { - title: 'Country 3W', - visibility: 'anything', - }, -}); - -const countryThreeWIndex = customWrapRoute({ - parent: countriesThreeWLayout, - index: true, - component: { - eagerLoad: true, - render: Navigate, - props: { - to: 'projects' satisfies DefaultCountryThreeWChild, - replace: true, - }, - }, - context: { - title: 'Country 3W', - visibility: 'anything', - }, -}); - -const countryThreeWProjects = customWrapRoute({ - parent: countriesThreeWLayout, - path: 'projects' satisfies DefaultCountryThreeWChild, - component: { - render: () => import('#views/CountryThreeWProjects'), - props: {}, - }, - context: { - title: 'Country 3W Projects', - visibility: 'anything', - }, -}); - -const countryThreeWNationalSocietyProjects = customWrapRoute({ - parent: countriesThreeWLayout, - path: 'ns-projects', - component: { - render: () => import('#views/CountryThreeWNationalSocietyProjects'), - props: {}, - }, - context: { - title: 'Country 3W National Society Projects', - visibility: 'anything', - }, -}); - -const countryRiskWatch = customWrapRoute({ - parent: countriesLayout, - path: 'risk-watch', - component: { - render: () => import('#views/CountryRiskWatch'), - props: {}, - }, - context: { - title: 'Country Risk Watch', - visibility: 'anything', - }, -}); - -const countryPreparedness = customWrapRoute({ - parent: countriesLayout, - path: 'preparedness', - component: { - render: () => import('#views/CountryPreparedness'), - props: {}, - }, - context: { - title: 'Country Preparedness', - visibility: 'anything', - }, -}); - -const countryPlan = customWrapRoute({ - parent: countriesLayout, - path: 'plan', - component: { - render: () => import('#views/CountryPlan'), - props: {}, - }, - context: { - title: 'Country Plan', - visibility: 'anything', - }, -}); - -const countryAdditionalInfo = customWrapRoute({ - parent: countriesLayout, - path: 'additional-info', - component: { - render: () => import('#views/CountryAdditionalInfo'), - props: {}, - }, - context: { - title: 'Country Additional Info', - visibility: 'anything', - }, -}); - -const emergencies = customWrapRoute({ - parent: rootLayout, - path: 'emergencies', - component: { - render: () => import('#views/Emergencies'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergencies', - visibility: 'anything', - }, -}); - -type DefaultEmergenciesChild = 'details'; -const emergenciesLayout = customWrapRoute({ - parent: rootLayout, - path: 'emergencies/:emergencyId', - forwardPath: 'details' satisfies DefaultEmergenciesChild, - component: { - render: () => import('#views/Emergency'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency', - visibility: 'anything', - }, -}); - -const emergencySlug = customWrapRoute({ - parent: rootLayout, - path: 'emergencies/slug/:slug', - component: { - render: () => import('#views/EmergencySlug'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency', - visibility: 'anything', - }, -}); - -const emergencyFollow = customWrapRoute({ - parent: rootLayout, - path: 'emergencies/:emergencyId/follow', - component: { - render: () => import('#views/EmergencyFollow'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Follow Emergency', - visibility: 'is-authenticated', - }, -}); - -const emergencyIndex = customWrapRoute({ - parent: emergenciesLayout, - index: true, - component: { - eagerLoad: true, - render: SmartNavigate, - props: { - to: 'details' satisfies DefaultEmergenciesChild, - replace: true, - hashToRouteMap: { - '#details': 'details', - '#reports': 'reports', - '#activities': 'activities', - '#surge': 'surge', - }, - // TODO: make this typesafe - forwardUnmatchedHashTo: 'additional-info', - }, - }, - context: { - title: 'Emergency', - visibility: 'anything', - }, -}); - -const emergencyDetails = customWrapRoute({ - parent: emergenciesLayout, - path: 'details' satisfies DefaultEmergenciesChild, - component: { - render: () => import('#views/EmergencyDetails'), - props: {}, - }, - context: { - title: 'Emergency Details', - visibility: 'anything', - }, -}); - -const emergencyReportsAndDocuments = customWrapRoute({ - parent: emergenciesLayout, - path: 'reports', - component: { - render: () => import('#views/EmergencyReportAndDocument'), - props: {}, - }, - context: { - title: 'Emergency Reports and Documents', - visibility: 'anything', - }, -}); - -const emergencyActivities = customWrapRoute({ - parent: emergenciesLayout, - path: 'activities', - component: { - render: () => import('#views/EmergencyActivities'), - props: {}, - }, - context: { - title: 'Emergency Activities', - visibility: 'anything', - }, -}); -const emergencySurge = customWrapRoute({ - parent: emergenciesLayout, - path: 'surge', - component: { - render: () => import('#views/EmergencySurge'), - props: {}, - }, - context: { - title: 'Emergency Surge', - visibility: 'anything', - }, -}); - -// TODO: remove this route -const emergencyAdditionalInfoOne = customWrapRoute({ - parent: emergenciesLayout, - path: 'additional-info-1', - component: { - render: () => import('#views/EmergencyAdditionalTab'), - props: { - infoPageId: 1, - }, - }, - context: { - title: 'Emergency Additional Tab 1', - visibility: 'anything', - }, -}); -// TODO: remove this route -const emergencyAdditionalInfoTwo = customWrapRoute({ - parent: emergenciesLayout, - path: 'additional-info-2', - component: { - render: () => import('#views/EmergencyAdditionalTab'), - props: { - infoPageId: 2, - }, - }, - context: { - title: 'Emergency Additional Tab 2', - visibility: 'anything', - }, -}); -// TODO: remove this route -const emergencyAdditionalInfoThree = customWrapRoute({ - parent: emergenciesLayout, - path: 'additional-info-3', - component: { - render: () => import('#views/EmergencyAdditionalTab'), - props: { - infoPageId: 3, - }, - }, - context: { - title: 'Emergency Additional Tab 3', - visibility: 'anything', - }, -}); - -const emergencyAdditionalInfo = customWrapRoute({ - parent: emergenciesLayout, - path: 'additional-info/:tabId?', - component: { - render: () => import('#views/EmergencyAdditionalTab'), - props: {}, - }, - context: { - title: 'Emergency Additional Info Tab', - visibility: 'anything', - }, -}); - -type DefaultSurgeChild = 'overview'; -const surgeLayout = customWrapRoute({ - parent: rootLayout, - path: 'surge', - forwardPath: 'overview' satisfies DefaultSurgeChild, - component: { - render: () => import('#views/Surge'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Surge', - visibility: 'anything', - }, -}); - -const surgeIndex = customWrapRoute({ - parent: surgeLayout, - index: true, - component: { - eagerLoad: true, - render: Navigate, - props: { - to: 'overview' satisfies DefaultSurgeChild, - replace: true, - }, - }, - context: { - title: 'Surge', - visibility: 'anything', - }, -}); - -const surgeOverview = customWrapRoute({ - parent: surgeLayout, - path: 'overview' satisfies DefaultSurgeChild, - component: { - render: () => import('#views/SurgeOverview'), - props: {}, - }, - context: { - title: 'Surge Overview', - visibility: 'anything', - }, -}); - -const surgeOperationalToolbox = customWrapRoute({ - parent: surgeLayout, - path: 'operational-toolbox', - component: { - render: () => import('#views/SurgeOperationalToolbox'), - props: {}, - }, - context: { - title: 'Surge Operational Toolbox', - visibility: 'anything', - }, -}); - -type DefaultSurgeCatalogueChild = 'overview'; -const surgeCatalogueLayout = customWrapRoute({ - parent: surgeLayout, - path: 'catalogue', - forwardPath: 'overview' satisfies DefaultSurgeCatalogueChild, - component: { - render: () => import('#views/SurgeCatalogue'), - props: {}, - }, - context: { - title: 'Surge Catalogue', - visibility: 'anything', - }, -}); - -const catalogueIndex = customWrapRoute({ - parent: surgeCatalogueLayout, - index: true, - component: { - eagerLoad: true, - render: Navigate, - props: { - to: 'overview' satisfies DefaultSurgeCatalogueChild, - replace: true, - }, - }, - context: { - title: 'Surge Catalogue', - visibility: 'anything', - }, -}); - -const surgeCatalogueOverview = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'overview' satisfies DefaultSurgeCatalogueChild, - component: { - render: () => import('#views/SurgeCatalogueOverview'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Surge Catalogue Overview', - visibility: 'anything', - }, -}); - -const surgeCatalogueEmergencyNeedsAssessment = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'emergency-needs-assessment', - component: { - render: () => import('#views/SurgeCatalogueEmergencyNeedsAssessment'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency Needs Assessment', - visibility: 'anything', - }, -}); - -const surgeCatalogueEmergencyNeedsAssessmentCell = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'emergency-needs-assessment/cell', - component: { - render: () => import('#views/SurgeCatalogueEmergencyNeedsAssessmentCell'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Assessment Cell', - visibility: 'anything', - }, -}); - -const surgeCatalogueBasecamp = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'basecamp', - component: { - render: () => import('#views/SurgeCatalogueBasecamp'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Basecamp Catalogue', - visibility: 'anything', - }, -}); - -const surgeCatalogueBasecampEruSmall = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'basecamp/eru-small', - component: { - render: () => import('#views/SurgeCatalogueBasecampEruSmall'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Basecamp ERU Small', - visibility: 'anything', - }, -}); - -const surgeCatalogueBasecampEruMedium = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'basecamp/eru-medium', - component: { - render: () => import('#views/SurgeCatalogueBasecampEruMedium'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Basecamp ERU Medium', - visibility: 'anything', - }, -}); - -const surgeCatalogueBasecampEruLarge = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'basecamp/eru-large', - component: { - render: () => import('#views/SurgeCatalogueBasecampEruLarge'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Basecamp ERU Large', - visibility: 'anything', - }, -}); - -const surgeCatalogueBasecampFacilityManagement = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'basecamp/facility-management', - component: { - render: () => import('#views/SurgeCatalogueBasecampFacilityManagement'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Basecamp Facility Management', - visibility: 'anything', - }, -}); - -const surgeCatalogueCash = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'cash', - component: { - render: () => import('#views/SurgeCatalogueCash'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Cash and Vouchers Assistance', - visibility: 'anything', - }, -}); - -const surgeCatalogueCashRapidResponse = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'cash/rapid-response', - component: { - render: () => import('#views/SurgeCatalogueCashRapidResponse'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Cash and Vouchers Assistance - Rapid Response', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunityEngagement = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'community-engagement', - component: { - render: () => import('#views/SurgeCatalogueCommunityEngagement'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Community Engagement and Accountability (CEA)', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunityEngagementRapidResponse = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'community/rapid-response', - component: { - render: () => import('#views/SurgeCatalogueCommunityEngagementRapidResponse'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Community Engagement and Accountability (CEA) - Rapid Response', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunication = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'communication', - component: { - render: () => import('#views/SurgeCatalogueCommunication'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Communication', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunicationErtOne = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'communication/cert-1', - component: { - render: () => import('#views/SurgeCatalogueCommunicationErtOne'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Communication Emergency Response Tool 1', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunicationErtTwo = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'communication/cert-2', - component: { - render: () => import('#views/SurgeCatalogueCommunicationErtTwo'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Communication Emergency Response Tool 2', - visibility: 'anything', - }, -}); - -const surgeCatalogueCommunicationErtThree = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'communication/cert-3', - component: { - render: () => import('#views/SurgeCatalogueCommunicationErtThree'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Communication Emergency Response Tool 3', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealth = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health', - component: { - render: () => import('#views/SurgeCatalogueHealth'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Health', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEruClinic = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/eru-clinic', - component: { - render: () => import('#views/SurgeCatalogueHealthEruClinic'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'ERU Red Cross Red Crescent Emergency Clinic', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEruHospital = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/eru-hospital', - component: { - render: () => import('#views/SurgeCatalogueHealthEruHospital'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'ERU Red Cross Red Crescent Emergency Hospital', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEruSurgical = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/eru-surgical', - component: { - render: () => import('#views/SurgeCatalogueHealthEruSurgical'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Health Surgical', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthMaternalNewbornClinic = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/maternal-newborn-clinic', - component: { - render: () => import('#views/SurgeCatalogueHealthMaternalNewbornClinic'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Maternal NewBorn Health Clinic', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEmergencyClinic = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/emergency-clinic', - component: { - render: () => import('#views/SurgeCatalogueHealthEmergencyClinic'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency Mobile Clinic', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEruChloreaTreatment = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/eru-chlorea-treatment', - component: { - render: () => import('#views/SurgeCatalogueHealthEruChloreaTreatment'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency Response Unit Chlorea Treatment Center', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthCommunityCaseManagementChlorea = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/community-case-management-chlorea', - component: { - render: () => import('#views/SurgeCatalogueHealthCommunityCaseManagementChlorea'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Community Case Management of Chlorea', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthCommunityBasedSurveillance = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/community-based-surveillance', - component: { - render: () => import('#views/SurgeCatalogueHealthCommunityBasedSurveillance'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Community Based Surveillance', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthSafeDignifiedBurials = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/safe-dignified-burials', - component: { - render: () => import('#views/SurgeCatalogueHealthSafeDignifiedBurials'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Safe and Dignified Burials', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthCommunityManagementMalnutrition = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/community-management-malnutrition', - component: { - render: () => import('#views/SurgeCatalogueHealthCommunityManagementMalnutrition'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Community Case Management of Malnutrition', - visibility: 'anything', - }, -}); - -const surgeCatalogueHealthEruPsychosocialSupport = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'health/eru-psychosocial-support', - component: { - render: () => import('#views/SurgeCatalogueHealthEruPsychosocialSupport'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency Response Unit Psychosocial Support', - visibility: 'anything', - }, -}); - -const surgeCatalogueInformationManagement = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management', - component: { - render: () => import('#views/SurgeCatalogueInformationManagement'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Information Management', - visibility: 'anything', - }, - -}); - -const surgeCatalogueInformationManagementSatelliteImagery = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management/satellite-imagery', - component: { - render: () => import('#views/SurgeCatalogueInformationManagementSatelliteImagery'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Satellite Imagery', - visibility: 'anything', - }, -}); - -const surgeCatalogueInformationManagementRolesResponsibility = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management/roles-responsibility', - component: { - render: () => import('#views/SurgeCatalogueInformationManagementRolesResponsibility'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Roles and Responsibilities', - visibility: 'anything', - }, -}); - -// TODO: update view name -const surgeCatalogueInformationManagementRegionalOfficeSupport = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management/regional-office-support', - component: { - render: () => import('#views/SurgeCatalogueInformationManagementSupport'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Information Management Support - Regional Office', - visibility: 'anything', - }, -}); - -// TODO: update view name -const surgeCatalogueInformationManagementGenevaSupport = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management/geneva-support', - component: { - render: () => import('#views/SurgeCatalogueInformationManagementOperationSupport'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Information Management Support - Geneva', - visibility: 'anything', - }, -}); - -const surgeCatalogueInformationManagementComposition = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-management/composition', - component: { - render: () => import('#views/SurgeCatalogueInformationManagementComposition'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Composition of IM Resources', - visibility: 'anything', - }, -}); - -const surgeCatalogueInformationTechnology = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-technology', - component: { - render: () => import('#views/SurgeCatalogueInformationTechnology'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Information Technology', - visibility: 'anything', - }, -}); - -const surgeCatalogueInformationTechnologyEruItTelecom = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'information-technology/eru-it-telecom', - component: { - render: () => import('#views/SurgeCatalogueInformationTechnologyEruItTelecom'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Information Technology Service', - visibility: 'anything', - }, -}); - -const surgeCatalogueLivelihood = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'livelihood', - component: { - render: () => import('#views/SurgeCatalogueLivelihood'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Livelihoods and Basic Needs', - visibility: 'anything', - }, -}); - -const surgeCatalogueLivelihoodServices = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'livelihood/services', - component: { - render: () => import('#views/SurgeCatalogueLivelihoodServices'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Livelihood Service', - visibility: 'anything', - }, -}); - -const surgeCatalogueLogistics = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'logistics', - component: { - render: () => import('#views/SurgeCatalogueLogistics'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Logistics', - visibility: 'anything', - }, -}); - -const surgeCatalogueLogisticsEru = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'logistics/eru', - component: { - render: () => import('#views/SurgeCatalogueLogisticsEru'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency Response Unit', - visibility: 'anything', - }, -}); - -const surgeCatalogueLogisticsLpscmNs = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'logistics/lpscm-ns', - component: { - render: () => import('#views/SurgeCatalogueLogisticsLpscmNs'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'LPSCM for National Societies', - visibility: 'anything', - }, -}); - -const surgeCatalogueOperationsManagement = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'operations-management', - component: { - render: () => import('#views/SurgeCatalogueOperationsManagement'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Operations Management', - visibility: 'anything', - }, -}); - -const surgeCatalogueOperationManagementHeops = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'operations-management/heops', - component: { - render: () => import('#views/SurgeCatalogueOperationsManagementHeops'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Head of Emergency Operations (HEOPS)', - visibility: 'anything', - }, -}); - -const surgeCataloguePgi = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'pgi', - component: { - render: () => import('#views/SurgeCataloguePgi'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Protection, Gender and inclusion (PGI)', - visibility: 'anything', - }, -}); - -const surgeCataloguePgiServices = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'pgi/services', - component: { - render: () => import('#views/SurgeCataloguePgiServices'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Protection Gender and Inclusion - Services', - visibility: 'anything', - }, -}); - -const surgeCataloguePmer = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'pmer', - component: { - render: () => import('#views/SurgeCataloguePmer'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Planning, Monitoring, Evaluation And Reporting (PMER)', - visibility: 'anything', - }, -}); - -const surgeCataloguePmerEmergencyPlanAction = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'pmer/emergency-plan-action', - component: { - render: () => import('#views/SurgeCataloguePmerEmergencyPlanAction'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Emergency plan of action EPOA monitoring evaluation plan', - visibility: 'anything', - }, -}); - -const surgeCataloguePmerRealTimeEvaluation = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'pmer/real-time-evaluation', - component: { - render: () => import('#views/SurgeCataloguePmerRealTimeEvaluation'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Real time evaluation RTE and guidance', - visibility: 'anything', - }, -}); - -const surgeCatalogueShelter = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'shelter', - component: { - render: () => import('#views/SurgeCatalogueShelter'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Shelter', - visibility: 'anything', - }, -}); - -const surgeCatalogueShelterCoordinatorTeam = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'shelter/coordinator-team', - component: { - render: () => import('#views/SurgeCatalogueShelterCoordinatorTeam'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Shelter Surge Coordinator', - visibility: 'anything', - }, -}); - -const surgeCatalogueShelterTechnicalTeam = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'shelter/technical-team', - component: { - render: () => import('#views/SurgeCatalogueShelterTechnicalTeam'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Shelter Technical Team', - visibility: 'anything', - }, -}); - -const surgeCatalogueWash = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash', - component: { - render: () => import('#views/SurgeCatalogueWash'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Water, Sanitation and Hygiene (WASH)', - visibility: 'anything', - }, -}); - -const surgeCatalogueWashKit2 = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/kit-2', - component: { - render: () => import('#views/SurgeCatalogueWashKit2'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'WASH Kit-2', - visibility: 'anything', - }, -}); +import { Navigate } from 'react-router-dom'; -const surgeCatalogueWashKit5 = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/kit-5', - component: { - render: () => import('#views/SurgeCatalogueWashKit5'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'WASH Kit-5', - visibility: 'anything', - }, -}); +import { unwrapRoute } from '#utils/routes'; -const surgeCatalogueWashKitM15Eru = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/m15-eru', +import Auth from '../Auth'; +import SmartNavigate from './SmartNavigate'; +import { + customWrapRoute, + rootLayout, +} from './common'; + +import surgeRoutes from './SurgeRoutes'; +import countryRoutes from './CountryRoutes'; +import regionRoutes from './RegionRoutes'; + +const fourHundredFour = customWrapRoute({ + parent: rootLayout, + path: '*', component: { - render: () => import('#views/SurgeCatalogueWashKitM15Eru'), + render: () => import('#views/FourHundredFour'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'WASH Kit-M15 ERU', + title: '404', visibility: 'anything', }, }); -const surgeCatalogueWashKitMsm20Eru = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/msm20-eru', +const login = customWrapRoute({ + parent: rootLayout, + path: 'login', component: { - render: () => import('#views/SurgeCatalogueWashKitMsm20Eru'), + render: () => import('#views/Login'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Wash Kit-MSM20 ERU', - visibility: 'anything', + title: 'Login', + visibility: 'is-not-authenticated', }, }); -const surgeCatalogueWashKitM40Eru = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/m40-eru', +const register = customWrapRoute({ + parent: rootLayout, + path: 'register', component: { - render: () => import('#views/SurgeCatalogueWashKitM40Eru'), + render: () => import('#views/Register'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Wash Kit-M40 ERU', - visibility: 'anything', + title: 'Register', + visibility: 'is-not-authenticated', }, }); -const surgeCatalogueWashWaterSupplyRehabilitation = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/water-supply-rehabilitation', +const recoverAccount = customWrapRoute({ + parent: rootLayout, + path: 'recover-account', component: { - render: () => import('#views/SurgeCatalogueWashWaterSupplyRehabilitation'), + render: () => import('#views/RecoverAccount'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Water Supply Rehabilitation', - visibility: 'anything', + title: 'Recover Account', + visibility: 'is-not-authenticated', }, }); -const surgeCatalogueWashHwts = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'wash/hwts', +const recoverAccountConfirm = customWrapRoute({ + parent: rootLayout, + path: 'recover-account/:username/:token', component: { - render: () => import('#views/SurgeCatalogueWashHwts'), + render: () => import('#views/RecoverAccountConfirm'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Household Water Treatment and Safe Storage (HWTS)', - visibility: 'anything', + title: 'Recover Account Confirm', + visibility: 'is-not-authenticated', }, }); -const surgeCatalogueRelief = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'relief', +const resendValidationEmail = customWrapRoute({ + parent: rootLayout, + path: 'resend-validation-email', component: { - render: () => import('#views/SurgeCatalogueRelief'), + render: () => import('#views/ResendValidationEmail'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Relief', - visibility: 'anything', + title: 'Resend Validation Email', + visibility: 'is-not-authenticated', }, }); -const surgeCatalogueReliefEru = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'relief/eru', +const home = customWrapRoute({ + parent: rootLayout, + index: true, component: { - render: () => import('#views/SurgeCatalogueReliefEru'), + render: () => import('#views/Home'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Relief ERU', + title: 'Home', visibility: 'anything', }, }); -const surgeCatalogueSecurity = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'security', +const emergencies = customWrapRoute({ + parent: rootLayout, + path: 'emergencies', component: { - render: () => import('#views/SurgeCatalogueSecurity'), + render: () => import('#views/Emergencies'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Security', + title: 'Emergencies', visibility: 'anything', }, }); -const surgeCatalogueSecurityManagement = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'security/management', +type DefaultEmergenciesChild = 'details'; +const emergenciesLayout = customWrapRoute({ + parent: rootLayout, + path: 'emergencies/:emergencyId', + forwardPath: 'details' satisfies DefaultEmergenciesChild, component: { - render: () => import('#views/SurgeCatalogueSecurityManagement'), + render: () => import('#views/Emergency'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Security Management', + title: 'Emergency', visibility: 'anything', }, }); -const surgeCatalogueOther = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other', +const emergencySlug = customWrapRoute({ + parent: rootLayout, + path: 'emergencies/slug/:slug', component: { - render: () => import('#views/SurgeCatalogueOther'), + render: () => import('#views/EmergencySlug'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Other', + title: 'Emergency', visibility: 'anything', }, }); -const surgeCatalogueOtherCivilMilitaryRelations = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/civil-military-relations', +const emergencyFollow = customWrapRoute({ + parent: rootLayout, + path: 'emergencies/:emergencyId/follow', component: { - render: () => import('#views/SurgeCatalogueOtherCivilMilitaryRelations'), + render: () => import('#views/EmergencyFollow'), props: {}, }, wrapperComponent: Auth, context: { - title: 'Civil Military Relations', - visibility: 'anything', + title: 'Follow Emergency', + visibility: 'is-authenticated', }, }); -const surgeCatalogueOtherDisasterRiskReduction = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/disaster-risk-reduction', +const emergencyIndex = customWrapRoute({ + parent: emergenciesLayout, + index: true, component: { - render: () => import('#views/SurgeCatalogueOtherDisasterRiskReduction'), - props: {}, + eagerLoad: true, + render: SmartNavigate, + props: { + to: 'details' satisfies DefaultEmergenciesChild, + replace: true, + hashToRouteMap: { + '#details': 'details', + '#reports': 'reports', + '#activities': 'activities', + '#surge': 'surge', + }, + // TODO: make this typesafe + forwardUnmatchedHashTo: 'additional-info', + }, }, - wrapperComponent: Auth, context: { - title: 'Disaster Risk Reduction', + title: 'Emergency', visibility: 'anything', }, }); -const surgeCatalogueOtherHumanResources = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/human-resources', +const emergencyDetails = customWrapRoute({ + parent: emergenciesLayout, + path: 'details' satisfies DefaultEmergenciesChild, component: { - render: () => import('#views/SurgeCatalogueOtherHumanResources'), + render: () => import('#views/EmergencyDetails'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'Human Resources', + title: 'Emergency Details', visibility: 'anything', }, }); -const surgeCatalogueOtherInternationalDisasterResponseLaw = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/international-disaster-response-law', +const emergencyReportsAndDocuments = customWrapRoute({ + parent: emergenciesLayout, + path: 'reports', component: { - render: () => import('#views/SurgeCatalogueOtherInternationalDisasterResponseLaw'), + render: () => import('#views/EmergencyReportAndDocument'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'International Diaster Response Law', + title: 'Emergency Reports and Documents', visibility: 'anything', }, }); -const surgeCatalogueOtherMigration = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/migration', +const emergencyActivities = customWrapRoute({ + parent: emergenciesLayout, + path: 'activities', component: { - render: () => import('#views/SurgeCatalogueOtherMigration'), + render: () => import('#views/EmergencyActivities'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'Migration', + title: 'Emergency Activities', visibility: 'anything', }, }); - -const surgeCatalogueOtherNationalSocietyDevelopment = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/national-society-development', +const emergencySurge = customWrapRoute({ + parent: emergenciesLayout, + path: 'surge', component: { - render: () => import('#views/SurgeCatalogueOtherNationalSocietyDevelopment'), + render: () => import('#views/EmergencySurge'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'National Society Development', + title: 'Emergency Surge', visibility: 'anything', }, }); -const surgeCatalogueOtherPartnershipResourceDevelopment = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/partnership-resource-development', +// TODO: remove this route +const emergencyAdditionalInfoOne = customWrapRoute({ + parent: emergenciesLayout, + path: 'additional-info-1', component: { - render: () => import('#views/SurgeCatalogueOtherPartnershipResourceDevelopment'), - props: {}, + render: () => import('#views/EmergencyAdditionalTab'), + props: { + infoPageId: 1, + }, }, - wrapperComponent: Auth, context: { - title: 'Partnership Resource Development', + title: 'Emergency Additional Tab 1', visibility: 'anything', }, }); - -const surgeCatalogueOtherPreparednessEffectiveResponse = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/preparedness-effective-response', +// TODO: remove this route +const emergencyAdditionalInfoTwo = customWrapRoute({ + parent: emergenciesLayout, + path: 'additional-info-2', component: { - render: () => import('#views/SurgeCatalogueOtherPreparednessEffectiveResponse'), - props: {}, + render: () => import('#views/EmergencyAdditionalTab'), + props: { + infoPageId: 2, + }, }, - wrapperComponent: Auth, context: { - title: 'Preparedness Effective Response', + title: 'Emergency Additional Tab 2', visibility: 'anything', }, }); - -const surgeCatalogueOtherRecovery = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/recovery', +// TODO: remove this route +const emergencyAdditionalInfoThree = customWrapRoute({ + parent: emergenciesLayout, + path: 'additional-info-3', component: { - render: () => import('#views/SurgeCatalogueOtherRecovery'), - props: {}, + render: () => import('#views/EmergencyAdditionalTab'), + props: { + infoPageId: 3, + }, }, - wrapperComponent: Auth, context: { - title: 'Recovery', + title: 'Emergency Additional Tab 3', visibility: 'anything', }, }); -const surgeCatalogueOtherGreenResponse = customWrapRoute({ - parent: surgeCatalogueLayout, - path: 'other/green-response', +const emergencyAdditionalInfo = customWrapRoute({ + parent: emergenciesLayout, + path: 'additional-info/:tabId?', component: { - render: () => import('#views/SurgeCatalogueOtherGreenResponse'), + render: () => import('#views/EmergencyAdditionalTab'), props: {}, }, - wrapperComponent: Auth, context: { - title: 'Green Response', + title: 'Emergency Additional Info Tab', visibility: 'anything', }, }); @@ -2436,34 +878,6 @@ const allSurgeAlerts = customWrapRoute({ }, }); -const allDeployedPersonnel = customWrapRoute({ - parent: rootLayout, - path: 'deployed-personnels/all', - component: { - render: () => import('#views/AllDeployedPersonnel'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'All Deployed Personnel', - visibility: 'anything', - }, -}); - -const allDeployedEmergencyResponseUnits = customWrapRoute({ - parent: rootLayout, - path: 'deployed-erus/all', - component: { - render: () => import('#views/AllDeployedEmergencyResponseUnits'), - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'All Deployed Emergency Response Units', - visibility: 'anything', - }, -}); - const newDrefApplicationForm = customWrapRoute({ parent: rootLayout, path: 'dref-applications/new', @@ -2712,244 +1126,6 @@ const perWorkPlanForm = customWrapRoute({ // Redirect Routes -// eslint-disable-next-line react-refresh/only-export-components -function DeploymentNavigate() { - const params = useParams<{ surgeId: string }>(); - - const deploymentRouteMap: Record> = { - overview: surgeOverview, - 'operational-toolbox': surgeOperationalToolbox, - personnel: allDeployedPersonnel, - erus: allDeployedEmergencyResponseUnits, - }; - - const newRoute = isDefined(params.surgeId) - ? deploymentRouteMap[params.surgeId] - : undefined; - - const path = isDefined(newRoute) - ? newRoute.absoluteForwardPath - : surgeOverview.absoluteForwardPath; - - return ( - - ); -} - -const deploymentOthers = customWrapRoute({ - parent: rootLayout, - path: 'deployments/:surgeId/*', - component: { - eagerLoad: true, - render: DeploymentNavigate, - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Catalogue of surge services', - visibility: 'anything', - }, -}); - -const deploymentCatalogueLayout = customWrapRoute({ - parent: rootLayout, - path: 'deployments/catalogue', - component: { - eagerLoad: true, - render: () => , - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Catalogue of surge services', - visibility: 'anything', - }, -}); - -// eslint-disable-next-line react-refresh/only-export-components -function DeploymentCatalogueNavigate() { - const params = useParams<{ - catalogueId: string, - subCatalogueId: string, - }>(); - - type WrappedRoute = MyOutputNonIndexRouteObject; - - const catalogueRouteMap: Record = { - overview: surgeCatalogueOverview, - emergency: surgeCatalogueEmergencyNeedsAssessment, - basecamp: surgeCatalogueBasecamp, - cash: surgeCatalogueCash, - community: surgeCatalogueCommunityEngagement, - communications: surgeCatalogueCommunication, - health: surgeCatalogueHealth, - infoMgt: surgeCatalogueInformationManagement, - informationTech: surgeCatalogueInformationTechnology, - livelihoods: surgeCatalogueLivelihood, - logistics: surgeCatalogueLogistics, - operations: surgeCatalogueOperationsManagement, - protection: surgeCataloguePgi, - planning: surgeCataloguePmer, - relief: surgeCatalogueRelief, - security: surgeCatalogueSecurity, - shelter: surgeCatalogueShelter, - water: surgeCatalogueWash, - other: surgeCatalogueOther, - }; - - const subCatalogueRouteMap: Record> = { - emergency: { - 'assessment-cell': surgeCatalogueEmergencyNeedsAssessmentCell, - }, - basecamp: { - 'eru-base-camp-small': surgeCatalogueBasecampEruSmall, - 'eru-base-camp-medium': surgeCatalogueBasecampEruMedium, - 'eru-base-camp-large': surgeCatalogueBasecampEruLarge, - 'facility-management': surgeCatalogueBasecampFacilityManagement, - }, - cash: { - cva: surgeCatalogueCashRapidResponse, - }, - community: { - 'community-engagement-and-accountability': surgeCatalogueCommunityEngagementRapidResponse, - }, - communications: { - 'communications-emergency-response-tool-cert-3': surgeCatalogueCommunicationErtThree, - 'communications-emergency-response-tool-cert-2': surgeCatalogueCommunicationErtTwo, - 'communications-emergency-response-tool-cert-1': surgeCatalogueCommunicationErtOne, - }, - health: { - 'eru-pss-module': surgeCatalogueHealthEruPsychosocialSupport, - 'community-case-management-of-malnutrition-ccmm': surgeCatalogueHealthCommunityManagementMalnutrition, - 'safe-and-dignified-burials': surgeCatalogueHealthSafeDignifiedBurials, - 'community-based-surveillance-cbs': surgeCatalogueHealthCommunityBasedSurveillance, - 'community-case-management-of-cholera-ccmc': surgeCatalogueHealthCommunityCaseManagementChlorea, - 'eru-cholera-treatment-center': surgeCatalogueHealthEruChloreaTreatment, - 'emergency-mobile-clinic': surgeCatalogueHealthEmergencyClinic, - 'maternal-newborn-health-clinic': surgeCatalogueHealthMaternalNewbornClinic, - 'surgical-surge': surgeCatalogueHealthEruSurgical, - 'eru-red-cross-red-crescent-emergency-hospital': surgeCatalogueHealthEruHospital, - 'eru-red-cross-red-crescent-emergency-clinic': surgeCatalogueHealthEruClinic, - }, - infoMgt: { - // NOTE: sims was probably replace with link to its site - // 'surge-information-management-support-sims': , - 'roles-and-resps': surgeCatalogueInformationManagementRolesResponsibility, - 'im-support-for-op': surgeCatalogueInformationManagementRegionalOfficeSupport, - 'ifrc-geneva-im': surgeCatalogueInformationManagementGenevaSupport, - 'composition-of-im-res': surgeCatalogueInformationManagementComposition, - 'Satellite-imagery': surgeCatalogueInformationManagementSatelliteImagery, - }, - informationTech: { - 'eru-it-telecom': surgeCatalogueInformationTechnologyEruItTelecom, - }, - livelihoods: { - 'livelihoods-and-basic-needs': surgeCatalogueLivelihoodServices, - }, - logistics: { - 'lpscm-for-national-societies': surgeCatalogueLogisticsLpscmNs, - 'logistics-eru': surgeCatalogueLogisticsEru, - }, - operations: { - 'head-of-emergency-operations-heops': surgeCatalogueOperationManagementHeops, - }, - protection: { - 'protection-gender-and-inclusion': surgeCataloguePgiServices, - }, - planning: { - 'real-time-evaluation-rte-and-guidance': surgeCataloguePmerRealTimeEvaluation, - 'emergency-plan-of-action-epoa-monitoring-evaluation-plan': surgeCataloguePmerEmergencyPlanAction, - }, - relief: { - 'eru-relief': surgeCatalogueReliefEru, - }, - security: { - 'security-management': surgeCatalogueSecurityManagement, - }, - shelter: { - 'stt-shelter-technical-team': surgeCatalogueShelterTechnicalTeam, - 'sct-shelter-coordination-team': surgeCatalogueShelterCoordinatorTeam, - }, - water: { - 'household-water-treatment-and-safe-storage-hwts': surgeCatalogueWashHwts, - 'water-supply-rehabilitation-wsr': surgeCatalogueWashWaterSupplyRehabilitation, - 'm40-eru': surgeCatalogueWashKitM40Eru, - 'msm20-eru': surgeCatalogueWashKitMsm20Eru, - 'm15-eru': surgeCatalogueWashKitM15Eru, - 'kit-5': surgeCatalogueWashKit5, - 'kit-2': surgeCatalogueWashKit2, - }, - other: { - 'civil-military-relations': surgeCatalogueOtherCivilMilitaryRelations, - 'disaster-risk-reduction-drr': surgeCatalogueOtherDisasterRiskReduction, - 'human-resources': surgeCatalogueOtherHumanResources, - 'international-disaster-response-law': surgeCatalogueOtherInternationalDisasterResponseLaw, - migration: surgeCatalogueOtherMigration, - 'national-society-development': surgeCatalogueOtherNationalSocietyDevelopment, - 'partnership-and-resource-development': surgeCatalogueOtherPartnershipResourceDevelopment, - 'preparedness-for-effective-response-per': surgeCatalogueOtherPreparednessEffectiveResponse, - recovery: surgeCatalogueOtherRecovery, - greenresponse: surgeCatalogueOtherGreenResponse, - }, - }; - - const newCatalogueRoute = isTruthyString(params.catalogueId) - ? catalogueRouteMap[params.catalogueId] - : undefined; - - const newSubCatalogueRoute = isTruthyString(params.catalogueId) - && isTruthyString(params.subCatalogueId) - ? subCatalogueRouteMap[params.catalogueId]?.[params.subCatalogueId] - : undefined; - - const path = newSubCatalogueRoute?.absoluteForwardPath - ?? newCatalogueRoute?.absoluteForwardPath - ?? surgeCatalogueOverview.absoluteForwardPath; - - return ( - - ); -} - -const deploymentCatalogueIndex = customWrapRoute({ - parent: deploymentCatalogueLayout, - index: true, - component: { - eagerLoad: true, - render: Navigate, - props: { - to: '/surge/catalogue', - replace: true, - }, - }, - wrapperComponent: Auth, - context: { - title: 'Catalogue of surge services', - visibility: 'anything', - }, -}); - -const deploymentCatalogueChildren = customWrapRoute({ - parent: deploymentCatalogueLayout, - path: ':catalogueId/:subCatalogueId?', - component: { - eagerLoad: true, - render: DeploymentCatalogueNavigate, - props: {}, - }, - wrapperComponent: Auth, - context: { - title: 'Catalogue of surge services', - visibility: 'anything', - }, -}); - const wrappedRoutes = { fourHundredFour, rootLayout, @@ -2959,28 +1135,6 @@ const wrappedRoutes = { recoverAccountConfirm, resendValidationEmail, home, - regionsLayout, - regionIndex, - regionOperations, - regionThreeW, - regionRiskWatchLayout, - regionRiskIndex, - regionImminentRiskWatch, - regionSeasonalRiskWatch, - regionPreparedness, - regionProfile, - regionAdditionalInfo, - countriesLayout, - countryIndex, - countryOperations, - countriesThreeWLayout, - countryThreeWProjects, - countryThreeWNationalSocietyProjects, - countryThreeWIndex, - countryRiskWatch, - countryPreparedness, - countryPlan, - countryAdditionalInfo, emergencies, emergencySlug, emergencyFollow, @@ -2994,11 +1148,6 @@ const wrappedRoutes = { emergencyAdditionalInfoTwo, emergencyAdditionalInfoThree, emergencyAdditionalInfo, - surgeLayout, - surgeOverview, - surgeOperationalToolbox, - surgeCatalogueLayout, - surgeIndex, preparednessLayout, preparednessGlobalSummary, preparednessGlobalPerformance, @@ -3031,8 +1180,6 @@ const wrappedRoutes = { allFieldReports, allSurgeAlerts, allFlashUpdates, - allDeployedPersonnel, - allDeployedEmergencyResponseUnits, newDrefApplicationForm, drefApplicationForm, drefApplicationExport, @@ -3057,89 +1204,11 @@ const wrappedRoutes = { perPrioritizationForm, perWorkPlanForm, threeWProjectDetail, - catalogueIndex, - surgeCatalogueOverview, - surgeCatalogueEmergencyNeedsAssessment, - surgeCatalogueEmergencyNeedsAssessmentCell, - surgeCatalogueBasecamp, - surgeCatalogueBasecampEruSmall, - surgeCatalogueBasecampEruMedium, - surgeCatalogueBasecampEruLarge, - surgeCatalogueBasecampFacilityManagement, - surgeCatalogueCash, - surgeCatalogueCashRapidResponse, - surgeCatalogueCommunityEngagement, - surgeCatalogueCommunityEngagementRapidResponse, - surgeCatalogueCommunication, - surgeCatalogueCommunicationErtOne, - surgeCatalogueCommunicationErtTwo, - surgeCatalogueCommunicationErtThree, - surgeCatalogueHealth, - surgeCatalogueHealthEruClinic, - surgeCatalogueHealthEruHospital, - surgeCatalogueHealthEruSurgical, - surgeCatalogueHealthMaternalNewbornClinic, - surgeCatalogueHealthEmergencyClinic, - surgeCatalogueHealthEruChloreaTreatment, - surgeCatalogueHealthCommunityCaseManagementChlorea, - surgeCatalogueHealthCommunityBasedSurveillance, - surgeCatalogueHealthSafeDignifiedBurials, - surgeCatalogueHealthCommunityManagementMalnutrition, - surgeCatalogueHealthEruPsychosocialSupport, - surgeCatalogueInformationManagement, - surgeCatalogueInformationManagementSatelliteImagery, - surgeCatalogueInformationManagementRolesResponsibility, - // eslint-disable-next-line max-len - surgeCatalogueInformationManagementSupport: surgeCatalogueInformationManagementRegionalOfficeSupport, - // eslint-disable-next-line max-len - surgeCatalogueInformationManagementOperationSupport: surgeCatalogueInformationManagementGenevaSupport, - surgeCatalogueInformationManagementComposition, - surgeCatalogueInformationTechnology, - surgeCataloguePmer, - surgeCataloguePmerEmergencyPlanAction, - surgeCataloguePmerRealTimeEvaluation, - surgeCatalogueInformationTechnologyEruItTelecom, - surgeCatalogueLivelihood, - surgeCatalogueLivelihoodServices, - surgeCatalogueSecurity, - surgeCatalogueSecurityManagement, - surgeCatalogueLogistics, - surgeCatalogueLogisticsEru, - surgeCatalogueLogisticsLpscmNs, - surgeCatalogueOperationsManagement, - surgeCatalogueOperationManagementHeops, - surgeCataloguePgi, - surgeCatalogueRelief, - surgeCatalogueReliefEru, - surgeCataloguePgiServices, - surgeCatalogueShelter, - surgeCatalogueShelterTechnicalTeam, - surgeCatalogueShelterCoordinatorTeam, - surgeCatalogueWash, - surgeCatalogueWashKit2, - surgeCatalogueWashKit5, - surgeCatalogueWashKitM15Eru, - surgeCatalogueWashKitMsm20Eru, - surgeCatalogueWashKitM40Eru, - surgeCatalogueWashWaterSupplyRehabilitation, - surgeCatalogueWashHwts, - surgeCatalogueOther, - surgeCatalogueOtherCivilMilitaryRelations, - surgeCatalogueOtherDisasterRiskReduction, - surgeCatalogueOtherHumanResources, - surgeCatalogueOtherInternationalDisasterResponseLaw, - surgeCatalogueOtherMigration, - surgeCatalogueOtherNationalSocietyDevelopment, - surgeCatalogueOtherPartnershipResourceDevelopment, - surgeCatalogueOtherPreparednessEffectiveResponse, - surgeCatalogueOtherRecovery, - surgeCatalogueOtherGreenResponse, - - // Redirect routes - deploymentCatalogueLayout, - deploymentCatalogueIndex, - deploymentCatalogueChildren, - deploymentOthers, + + ...regionRoutes, + ...countryRoutes, + ...surgeRoutes, + }; export const unwrappedRoutes = unwrapRoute(Object.values(wrappedRoutes)); diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx index 5edd0e46f8..a7136bc098 100644 --- a/src/components/Link/index.tsx +++ b/src/components/Link/index.tsx @@ -84,12 +84,12 @@ export function useLink(props: { return { disabled: true, to: undefined }; } + const disabled = (route.visibility === 'is-authenticated' && !isAuthenticated) + || (route.visibility === 'is-not-authenticated' && isAuthenticated) + || (route.permissions && !route.permissions(perms, props.urlParams)); + return { - disabled: ( - (route.visibility === 'is-authenticated' && !isAuthenticated) - || (route.visibility === 'is-not-authenticated' && isAuthenticated) - || (route.permissions && !route.permissions(perms, props.urlParams)) - ), + disabled, to: resolvedPath, }; } diff --git a/src/components/domain/CountryPageEmptyMessage/i18n.json b/src/components/domain/CountryPageEmptyMessage/i18n.json new file mode 100644 index 0000000000..52285369f4 --- /dev/null +++ b/src/components/domain/CountryPageEmptyMessage/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "common", + "strings": { + "countryPageWipMessage": "This page is currently under construction!" + } +} diff --git a/src/components/domain/CountryPageEmptyMessage/index.tsx b/src/components/domain/CountryPageEmptyMessage/index.tsx new file mode 100644 index 0000000000..17052f9dda --- /dev/null +++ b/src/components/domain/CountryPageEmptyMessage/index.tsx @@ -0,0 +1,30 @@ +import { PaintBrushLineIcon } from '@ifrc-go/icons'; + +import Message from '#components/Message'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; +import styles from './styles.module.css'; + +interface Props { + title?: string; +} + +function CountryPageEmptyMessage(props: Props) { + const { + title, + } = props; + + const strings = useTranslation(i18n); + + return ( + } + description={strings.countryPageWipMessage} + /> + ); +} + +export default CountryPageEmptyMessage; diff --git a/src/components/domain/CountryPageEmptyMessage/styles.module.css b/src/components/domain/CountryPageEmptyMessage/styles.module.css new file mode 100644 index 0000000000..60091ad392 --- /dev/null +++ b/src/components/domain/CountryPageEmptyMessage/styles.module.css @@ -0,0 +1,3 @@ +.country-page-empty-message { + min-height: 24rem; +} diff --git a/src/utils/outletContext.ts b/src/utils/outletContext.ts index 8500220408..8b577214db 100644 --- a/src/utils/outletContext.ts +++ b/src/utils/outletContext.ts @@ -22,6 +22,7 @@ export interface EmergencyOutletContext { export type CountryResponse = GoApiResponse<'/api/v2/country/{id}/'> export interface CountryOutletContext { + countryId: string | undefined; countryResponse: CountryResponse | undefined; countryResponsePending: boolean; } diff --git a/src/views/Country/i18n.json b/src/views/Country/i18n.json index 5c5370ca5d..c5fcb37a13 100644 --- a/src/views/Country/i18n.json +++ b/src/views/Country/i18n.json @@ -9,12 +9,18 @@ "countryKeyFiguresAppealsFunding":"Funding Coverage", "countryKeyFiguresTargetPop":"Targeted Population", "countryKeyFiguresCountryPlan":"Active Country Plan", + + "ongoingActivitiesTabTitle": "Ongoing Activities", + "nsOverviewTabTitle": "National Society Overview", + "countryProfileTabTitle": "Country Profile", + "countryAdditionalInfoTab":"Additional Info", + "countryOperationsTab":"Operations", "country3WTab":"3W", "countryPreparednessTab":"Preparedness", - "countryAdditionalInfoTab":"Additional Info", "countryCountryPlanTab":"Country Plan", "countryRiskTab": "Risk Watch", + "countryKeyFiguresDrefTitle": "DREF", "countryKeyFiguresDrefDescription": "These are small to medium scale emergency operations funded through the Disaster Relief Emergency Fund (DREF).The DREF provides immediate financial support to National Red Cross and Red Crescent Societies, enabling them to carry out their unique role as first responders after a disaster.", "countryKeyFiguresActiveAppealsTitle": "Emergency Appeal", diff --git a/src/views/Country/index.tsx b/src/views/Country/index.tsx index a4360ae58b..50850495c8 100644 --- a/src/views/Country/index.tsx +++ b/src/views/Country/index.tsx @@ -72,10 +72,11 @@ export function Component() { const outletContext = useMemo( () => ({ + countryId, countryResponse, countryResponsePending, }), - [countryResponse, countryResponsePending], + [countryResponse, countryId, countryResponsePending], ); const pending = countryResponsePending || aggregatedAppealPending; @@ -250,35 +251,25 @@ export function Component() { > - {strings.countryOperationsTab} - - - {strings.country3WTab} - - - {strings.countryRiskTab} + {strings.ongoingActivitiesTabTitle} - {strings.countryPreparednessTab} + {strings.nsOverviewTabTitle} - {strings.countryCountryPlanTab} + {strings.countryProfileTabTitle} {hasAdditionalInfoData && ( (); + const strings = useTranslation(i18n); + + return ( +
+ + + {strings.nsActivitiesTabTitle} + + + {strings.contextAndStructureTabTitle} + + + {strings.strategicPrioritiesTabTitle} + + + {strings.capacityTabTitle} + + + +
+ ); +} + +Component.displayName = 'CountryNsOverview'; diff --git a/src/views/CountryNsOverview/styles.module.css b/src/views/CountryNsOverview/styles.module.css new file mode 100644 index 0000000000..429aa9ab83 --- /dev/null +++ b/src/views/CountryNsOverview/styles.module.css @@ -0,0 +1,3 @@ +.country-ns-overview { + padding: var(--go-ui-spacing-2xl) 0; +} diff --git a/src/views/CountryNsOverviewActivities/i18n.json b/src/views/CountryNsOverviewActivities/i18n.json new file mode 100644 index 0000000000..9d9600ef39 --- /dev/null +++ b/src/views/CountryNsOverviewActivities/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryNsOverviewActivities", + "strings": { + "pageTitle": "Country NS Activities" + } +} diff --git a/src/views/CountryNsOverviewActivities/index.tsx b/src/views/CountryNsOverviewActivities/index.tsx new file mode 100644 index 0000000000..909235e773 --- /dev/null +++ b/src/views/CountryNsOverviewActivities/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryNsOverviewActivities'; diff --git a/src/views/CountryNsOverviewActivities/styles.module.css b/src/views/CountryNsOverviewActivities/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryNsOverviewCapacity/i18n.json b/src/views/CountryNsOverviewCapacity/i18n.json new file mode 100644 index 0000000000..1174b2ff1b --- /dev/null +++ b/src/views/CountryNsOverviewCapacity/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryNsOverviewCapacity", + "strings": { + "pageTitle": "Country NS Capacity" + } +} diff --git a/src/views/CountryNsOverviewCapacity/index.tsx b/src/views/CountryNsOverviewCapacity/index.tsx new file mode 100644 index 0000000000..1e8ac05327 --- /dev/null +++ b/src/views/CountryNsOverviewCapacity/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryNsOverviewCapacity'; diff --git a/src/views/CountryNsOverviewCapacity/styles.module.css b/src/views/CountryNsOverviewCapacity/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryNsOverviewContextAndStructure/i18n.json b/src/views/CountryNsOverviewContextAndStructure/i18n.json new file mode 100644 index 0000000000..7046420333 --- /dev/null +++ b/src/views/CountryNsOverviewContextAndStructure/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryNsOverviewContextAndStructure", + "strings": { + "pageTitle": "Country NS Context and Structure" + } +} diff --git a/src/views/CountryNsOverviewContextAndStructure/index.tsx b/src/views/CountryNsOverviewContextAndStructure/index.tsx new file mode 100644 index 0000000000..7f3357adb5 --- /dev/null +++ b/src/views/CountryNsOverviewContextAndStructure/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryNsOverviewContextAndStructure'; diff --git a/src/views/CountryNsOverviewContextAndStructure/styles.module.css b/src/views/CountryNsOverviewContextAndStructure/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryNsOverviewStrategicPriorities/i18n.json b/src/views/CountryNsOverviewStrategicPriorities/i18n.json new file mode 100644 index 0000000000..cdb2f202d2 --- /dev/null +++ b/src/views/CountryNsOverviewStrategicPriorities/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryNsOverviewStrategicPriorities", + "strings": { + "pageTitle": "Country NS Strategic Priorities" + } +} diff --git a/src/views/CountryNsOverviewStrategicPriorities/index.tsx b/src/views/CountryNsOverviewStrategicPriorities/index.tsx new file mode 100644 index 0000000000..9950809627 --- /dev/null +++ b/src/views/CountryNsOverviewStrategicPriorities/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryNsOverviewStrategicPriorities'; diff --git a/src/views/CountryNsOverviewStrategicPriorities/styles.module.css b/src/views/CountryNsOverviewStrategicPriorities/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryOngoingActivities/i18n.json b/src/views/CountryOngoingActivities/i18n.json new file mode 100644 index 0000000000..44ce9eed6b --- /dev/null +++ b/src/views/CountryOngoingActivities/i18n.json @@ -0,0 +1,8 @@ +{ + "namespace": "countryOngoingActivities", + "strings": { + "ongoingEmergenciesTabTitle": "Ongoing Emergencies", + "threeWActivitiesTabTitle": "3W Activities", + "threeWProjectsTabTitle": "3W Projects" + } +} diff --git a/src/views/CountryOngoingActivities/index.tsx b/src/views/CountryOngoingActivities/index.tsx new file mode 100644 index 0000000000..1fa803a816 --- /dev/null +++ b/src/views/CountryOngoingActivities/index.tsx @@ -0,0 +1,43 @@ +import { Outlet, useOutletContext } from 'react-router-dom'; + +import NavigationTab from '#components/NavigationTab'; +import NavigationTabList from '#components/NavigationTabList'; +import useTranslation from '#hooks/useTranslation'; +import { CountryOutletContext } from '#utils/outletContext'; + +import i18n from './i18n.json'; +import styles from './styles.module.css'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const { countryId } = useOutletContext(); + const strings = useTranslation(i18n); + + return ( +
+ + + {strings.ongoingEmergenciesTabTitle} + + + {strings.threeWActivitiesTabTitle} + + + {strings.threeWProjectsTabTitle} + + + +
+ ); +} + +Component.displayName = 'CountryOngoingActivities'; diff --git a/src/views/CountryOngoingActivities/styles.module.css b/src/views/CountryOngoingActivities/styles.module.css new file mode 100644 index 0000000000..6cf063c384 --- /dev/null +++ b/src/views/CountryOngoingActivities/styles.module.css @@ -0,0 +1,3 @@ +.country-ongoing-activities { + padding: var(--go-ui-spacing-2xl) 0; +} diff --git a/src/views/CountryOngoingActivitiesEmergencies/i18n.json b/src/views/CountryOngoingActivitiesEmergencies/i18n.json new file mode 100644 index 0000000000..6e7665f501 --- /dev/null +++ b/src/views/CountryOngoingActivitiesEmergencies/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryOngoingActivitiesEmergencies", + "strings": { + "pageTitle": "Country Ongoing Emergencies" + } +} diff --git a/src/views/CountryOngoingActivitiesEmergencies/index.tsx b/src/views/CountryOngoingActivitiesEmergencies/index.tsx new file mode 100644 index 0000000000..965d403c63 --- /dev/null +++ b/src/views/CountryOngoingActivitiesEmergencies/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryOngoingActivitiesEmergencies'; diff --git a/src/views/CountryOngoingActivitiesEmergencies/styles.module.css b/src/views/CountryOngoingActivitiesEmergencies/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryOngoingActivitiesThreeWActivities/i18n.json b/src/views/CountryOngoingActivitiesThreeWActivities/i18n.json new file mode 100644 index 0000000000..4f16147fbf --- /dev/null +++ b/src/views/CountryOngoingActivitiesThreeWActivities/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryOngoingActivitiesThreeWActivities", + "strings": { + "pageTitle": "Country Ongoing 3W Activities" + } +} diff --git a/src/views/CountryOngoingActivitiesThreeWActivities/index.tsx b/src/views/CountryOngoingActivitiesThreeWActivities/index.tsx new file mode 100644 index 0000000000..40c58e14bf --- /dev/null +++ b/src/views/CountryOngoingActivitiesThreeWActivities/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryOngoingActivitiesThreeWActivities'; diff --git a/src/views/CountryOngoingActivitiesThreeWActivities/styles.module.css b/src/views/CountryOngoingActivitiesThreeWActivities/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryOngoingActivitiesThreeWProjects/i18n.json b/src/views/CountryOngoingActivitiesThreeWProjects/i18n.json new file mode 100644 index 0000000000..dbf1c27d19 --- /dev/null +++ b/src/views/CountryOngoingActivitiesThreeWProjects/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryOngoingActivitiesThreeWProjects", + "strings": { + "pageTitle": "Country 3W Projects" + } +} diff --git a/src/views/CountryOngoingActivitiesThreeWProjects/index.tsx b/src/views/CountryOngoingActivitiesThreeWProjects/index.tsx new file mode 100644 index 0000000000..34b1e48232 --- /dev/null +++ b/src/views/CountryOngoingActivitiesThreeWProjects/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryOngoingActivitiesThreeWProjects'; diff --git a/src/views/CountryOngoingActivitiesThreeWProjects/styles.module.css b/src/views/CountryOngoingActivitiesThreeWProjects/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryPreviousEvents/i18n.json b/src/views/CountryPreviousEvents/i18n.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryPreviousEvents/index.tsx b/src/views/CountryPreviousEvents/index.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryPreviousEvents/styles.module.css b/src/views/CountryPreviousEvents/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryProfile/i18n.json b/src/views/CountryProfile/i18n.json new file mode 100644 index 0000000000..5f33bba59e --- /dev/null +++ b/src/views/CountryProfile/i18n.json @@ -0,0 +1,9 @@ +{ + "namespace": "countryProfile", + "strings": { + "overviewTabTitle": "Overview", + "supportingPartnersTabTitle": "Supporting Partners", + "previousEventsTabTitle": "Previous Events", + "seasonalRisksTabTitle": "Seasonal Risks" + } +} diff --git a/src/views/CountryProfile/index.tsx b/src/views/CountryProfile/index.tsx new file mode 100644 index 0000000000..78db736fbe --- /dev/null +++ b/src/views/CountryProfile/index.tsx @@ -0,0 +1,49 @@ +import { Outlet, useOutletContext } from 'react-router-dom'; + +import NavigationTab from '#components/NavigationTab'; +import NavigationTabList from '#components/NavigationTabList'; +import useTranslation from '#hooks/useTranslation'; +import { CountryOutletContext } from '#utils/outletContext'; + +import i18n from './i18n.json'; +import styles from './styles.module.css'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const { countryId } = useOutletContext(); + const strings = useTranslation(i18n); + + return ( +
+ + + {strings.overviewTabTitle} + + + {strings.supportingPartnersTabTitle} + + + {strings.previousEventsTabTitle} + + + {strings.seasonalRisksTabTitle} + + + +
+ ); +} + +Component.displayName = 'CountryProfile'; diff --git a/src/views/CountryProfile/styles.module.css b/src/views/CountryProfile/styles.module.css new file mode 100644 index 0000000000..5419ea8825 --- /dev/null +++ b/src/views/CountryProfile/styles.module.css @@ -0,0 +1,3 @@ +.country-profile { + padding: var(--go-ui-spacing-2xl) 0; +} diff --git a/src/views/CountryProfileOverview/i18n.json b/src/views/CountryProfileOverview/i18n.json new file mode 100644 index 0000000000..93a09acebb --- /dev/null +++ b/src/views/CountryProfileOverview/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryProfileOverview", + "strings": { + "pageTitle": "Country Profile Overview" + } +} diff --git a/src/views/CountryProfileOverview/index.tsx b/src/views/CountryProfileOverview/index.tsx new file mode 100644 index 0000000000..a9d5f20127 --- /dev/null +++ b/src/views/CountryProfileOverview/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryProfileOverview'; diff --git a/src/views/CountryProfileOverview/styles.module.css b/src/views/CountryProfileOverview/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryProfilePreviousEvents/i18n.json b/src/views/CountryProfilePreviousEvents/i18n.json new file mode 100644 index 0000000000..8373b3b896 --- /dev/null +++ b/src/views/CountryProfilePreviousEvents/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryProfilePreviousEvents", + "strings": { + "pageTitle": "Country Profile Previous Events" + } +} diff --git a/src/views/CountryProfilePreviousEvents/index.tsx b/src/views/CountryProfilePreviousEvents/index.tsx new file mode 100644 index 0000000000..0170a731f7 --- /dev/null +++ b/src/views/CountryProfilePreviousEvents/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryProfilePreviousEvents'; diff --git a/src/views/CountryProfilePreviousEvents/styles.module.css b/src/views/CountryProfilePreviousEvents/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryProfileSeasonalRisks/i18n.json b/src/views/CountryProfileSeasonalRisks/i18n.json new file mode 100644 index 0000000000..2d83ea3f97 --- /dev/null +++ b/src/views/CountryProfileSeasonalRisks/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryProfileSeasonalRisks", + "strings": { + "pageTitle": "Country Profile Seasonal Risks" + } +} diff --git a/src/views/CountryProfileSeasonalRisks/index.tsx b/src/views/CountryProfileSeasonalRisks/index.tsx new file mode 100644 index 0000000000..27171e9dd0 --- /dev/null +++ b/src/views/CountryProfileSeasonalRisks/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryProfileSeasonalRisks'; diff --git a/src/views/CountryProfileSeasonalRisks/styles.module.css b/src/views/CountryProfileSeasonalRisks/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryProfileSupportingPartners/i18n.json b/src/views/CountryProfileSupportingPartners/i18n.json new file mode 100644 index 0000000000..58d2e259b2 --- /dev/null +++ b/src/views/CountryProfileSupportingPartners/i18n.json @@ -0,0 +1,6 @@ +{ + "namespace": "countryProfileSupportingPartners", + "strings": { + "pageTitle": "Country Profile Supporting Partners" + } +} diff --git a/src/views/CountryProfileSupportingPartners/index.tsx b/src/views/CountryProfileSupportingPartners/index.tsx new file mode 100644 index 0000000000..e5003af86a --- /dev/null +++ b/src/views/CountryProfileSupportingPartners/index.tsx @@ -0,0 +1,17 @@ +import CountryPageEmptyMessage from '#components/domain/CountryPageEmptyMessage'; +import useTranslation from '#hooks/useTranslation'; + +import i18n from './i18n.json'; + +// eslint-disable-next-line import/prefer-default-export +export function Component() { + const strings = useTranslation(i18n); + + return ( + + ); +} + +Component.displayName = 'CountryProfileSupportingPartners'; diff --git a/src/views/CountryProfileSupportingPartners/styles.module.css b/src/views/CountryProfileSupportingPartners/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySeasonalRisks/i18n.json b/src/views/CountrySeasonalRisks/i18n.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySeasonalRisks/index.tsx b/src/views/CountrySeasonalRisks/index.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySeasonalRisks/styles.module.css b/src/views/CountrySeasonalRisks/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySupportingPartners/i18n.json b/src/views/CountrySupportingPartners/i18n.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySupportingPartners/index.tsx b/src/views/CountrySupportingPartners/index.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountrySupportingPartners/styles.module.css b/src/views/CountrySupportingPartners/styles.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryThreeWProjects/CountryOngoingActivities/i18n.json b/src/views/CountryThreeWProjects/CountryOngoingActivities/i18n.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryThreeWProjects/CountryOngoingActivities/index.tsx b/src/views/CountryThreeWProjects/CountryOngoingActivities/index.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/views/CountryThreeWProjects/CountryOngoingActivities/styles.module.css b/src/views/CountryThreeWProjects/CountryOngoingActivities/styles.module.css new file mode 100644 index 0000000000..e69de29bb2