From 752108f8431e262e00b6cf292e4bb6e752ee830e Mon Sep 17 00:00:00 2001 From: puranban Date: Mon, 11 Dec 2023 16:51:47 +0545 Subject: [PATCH] Add dref sorted file for actions --- src/utils/domain/dref.ts | 63 +++++++++++++++++++ src/views/DrefApplicationExport/index.tsx | 62 ++---------------- src/views/DrefFinalReportExport/index.tsx | 39 ++---------- .../DrefOperationalUpdateExport/index.tsx | 62 ++---------------- 4 files changed, 77 insertions(+), 149 deletions(-) create mode 100644 src/utils/domain/dref.ts diff --git a/src/utils/domain/dref.ts b/src/utils/domain/dref.ts new file mode 100644 index 0000000000..1d379b4e1a --- /dev/null +++ b/src/utils/domain/dref.ts @@ -0,0 +1,63 @@ +import { components } from '#generated/types'; + +type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention']; +type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed']; +type NsActions = components<'read'>['schemas']['NationalSocietyAction']; + +const plannedInterventionSortedList: Record, number> = { + shelter_housing_and_settlements: 1, + livelihoods_and_basic_needs: 2, + multi_purpose_cash: 3, + health: 4, + water_sanitation_and_hygiene: 5, + protection_gender_and_inclusion: 6, + education: 7, + migration_and_displacement: 8, + risk_reduction_climate_adaptation_and_recovery: 9, + community_engagement_and_accountability: 10, + environmental_sustainability: 11, + coordination_and_partnerships: 12, + secretariat_services: 13, + national_society_strengthening: 14, +}; + +const identifiedNeedsAndGapsSortedList: Record, number> = { + shelter_housing_and_settlements: 1, + livelihoods_and_basic_needs: 2, + multi_purpose_cash_grants: 3, + health: 4, + water_sanitation_and_hygiene: 5, + protection_gender_and_inclusion: 6, + education: 7, + migration_and_displacement: 8, + risk_reduction_climate_adaptation_and_recovery: 9, + community_engagement_and_accountability: 10, + environment_sustainability: 11, +}; + +const nsActionsSortedList: Record = { + shelter_housing_and_settlements: 1, + livelihoods_and_basic_needs: 2, + multi_purpose_cash: 3, + health: 4, + water_sanitation_and_hygiene: 5, + protection_gender_and_inclusion: 6, + education: 7, + migration_and_displacement: 8, + risk_reduction_climate_adaptation_and_recovery: 9, + community_engagement_and_accountability: 10, + environment_sustainability: 11, + coordination: 12, + national_society_readiness: 13, + assessment: 14, + resource_mobilization: 15, + activation_of_contingency_plans: 16, + national_society_eoc: 17, + other: 18, +}; + +export { + plannedInterventionSortedList, + identifiedNeedsAndGapsSortedList, + nsActionsSortedList, +}; diff --git a/src/views/DrefApplicationExport/index.tsx b/src/views/DrefApplicationExport/index.tsx index 50254b40be..7a25adaa4b 100644 --- a/src/views/DrefApplicationExport/index.tsx +++ b/src/views/DrefApplicationExport/index.tsx @@ -25,16 +25,16 @@ import { DREF_TYPE_IMMINENT, DisasterCategory, } from '#utils/constants'; -import { components } from '#generated/types'; +import { + identifiedNeedsAndGapsSortedList, + nsActionsSortedList, + plannedInterventionSortedList, +} from '#utils/domain/dref'; import ifrcLogo from '#assets/icons/ifrc-square.png'; import i18n from './i18n.json'; import styles from './styles.module.css'; -type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention']; -type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed']; -type NsActions = components<'read'>['schemas']['NationalSocietyAction']; - function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) { return ( = { [DISASTER_CATEGORY_RED]: styles.red, }; -const plannedInterventionSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environmental_sustainability: 11, - coordination_and_partnerships: 12, - secretariat_services: 13, - national_society_strengthening: 14, -}; - -const identifiedNeedsAndGapsSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash_grants: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environment_sustainability: 11, -}; - -const nsActionsSortedList: Record = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environment_sustainability: 11, - coordination: 12, - national_society_readiness: 13, - assessment: 14, - resource_mobilization: 15, - activation_of_contingency_plans: 16, - national_society_eoc: 17, - other: 18, -}; - // eslint-disable-next-line import/prefer-default-export export function Component() { const { drefId } = useParams<{ drefId: string }>(); diff --git a/src/views/DrefFinalReportExport/index.tsx b/src/views/DrefFinalReportExport/index.tsx index f398168145..52c4b98f6e 100644 --- a/src/views/DrefFinalReportExport/index.tsx +++ b/src/views/DrefFinalReportExport/index.tsx @@ -26,16 +26,16 @@ import { DREF_TYPE_IMMINENT, DisasterCategory, } from '#utils/constants'; -import { components } from '#generated/types'; +import { + identifiedNeedsAndGapsSortedList, + plannedInterventionSortedList, +} from '#utils/domain/dref'; import ifrcLogo from '#assets/icons/ifrc-square.png'; import i18n from './i18n.json'; import styles from './styles.module.css'; -type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention']; -type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed']; - function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) { return ( = { [DISASTER_CATEGORY_RED]: styles.red, }; -const plannedInterventionSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environmental_sustainability: 11, - coordination_and_partnerships: 12, - secretariat_services: 13, - national_society_strengthening: 14, -}; - -const identifiedNeedsAndGapsSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash_grants: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environment_sustainability: 11, -}; - // eslint-disable-next-line import/prefer-default-export export function Component() { const { finalReportId } = useParams<{ finalReportId: string }>(); diff --git a/src/views/DrefOperationalUpdateExport/index.tsx b/src/views/DrefOperationalUpdateExport/index.tsx index 3001086f37..84da96f415 100644 --- a/src/views/DrefOperationalUpdateExport/index.tsx +++ b/src/views/DrefOperationalUpdateExport/index.tsx @@ -27,17 +27,17 @@ import { DREF_TYPE_IMMINENT, DisasterCategory, } from '#utils/constants'; -import { components } from '#generated/types'; +import { + identifiedNeedsAndGapsSortedList, + nsActionsSortedList, + plannedInterventionSortedList, +} from '#utils/domain/dref'; import ifrcLogo from '#assets/icons/ifrc-square.png'; import i18n from './i18n.json'; import styles from './styles.module.css'; -type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention']; -type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed']; -type NsActions = components<'read'>['schemas']['NationalSocietyAction']; - function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) { return ( = { [DISASTER_CATEGORY_RED]: styles.red, }; -const plannedInterventionSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environmental_sustainability: 11, - coordination_and_partnerships: 12, - secretariat_services: 13, - national_society_strengthening: 14, -}; - -const identifiedNeedsAndGapsSortedList: Record, number> = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash_grants: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environment_sustainability: 11, -}; - -const nsActionsSortedList: Record = { - shelter_housing_and_settlements: 1, - livelihoods_and_basic_needs: 2, - multi_purpose_cash: 3, - health: 4, - water_sanitation_and_hygiene: 5, - protection_gender_and_inclusion: 6, - education: 7, - migration_and_displacement: 8, - risk_reduction_climate_adaptation_and_recovery: 9, - community_engagement_and_accountability: 10, - environment_sustainability: 11, - coordination: 12, - national_society_readiness: 13, - assessment: 14, - resource_mobilization: 15, - activation_of_contingency_plans: 16, - national_society_eoc: 17, - other: 18, -}; - // eslint-disable-next-line import/prefer-default-export export function Component() { const { opsUpdateId } = useParams<{ opsUpdateId: string }>();