Skip to content

Commit

Permalink
Add dref sorted file for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
puranban authored and samshara committed Dec 11, 2023
1 parent 478aa14 commit 752108f
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 149 deletions.
63 changes: 63 additions & 0 deletions src/utils/domain/dref.ts
Original file line number Diff line number Diff line change
@@ -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<NonNullable<PlannedIntervention['title']>, 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<NonNullable<IdentifiedNeedsAndGaps['title']>, 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<NsActions['title'], 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,
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,
};
62 changes: 5 additions & 57 deletions src/views/DrefApplicationExport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<TextOutput
Expand All @@ -52,58 +52,6 @@ const colorMap: Record<DisasterCategory, string> = {
[DISASTER_CATEGORY_RED]: styles.red,
};

const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, 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<NonNullable<IdentifiedNeedsAndGaps['title']>, 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<NsActions['title'], 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,
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 }>();
Expand Down
39 changes: 4 additions & 35 deletions src/views/DrefFinalReportExport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<TextOutput
Expand All @@ -53,37 +53,6 @@ const colorMap: Record<DisasterCategory, string> = {
[DISASTER_CATEGORY_RED]: styles.red,
};

const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, 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<NonNullable<IdentifiedNeedsAndGaps['title']>, 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 }>();
Expand Down
62 changes: 5 additions & 57 deletions src/views/DrefOperationalUpdateExport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<TextOutput
Expand All @@ -55,58 +55,6 @@ const colorMap: Record<DisasterCategory, string> = {
[DISASTER_CATEGORY_RED]: styles.red,
};

const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, 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<NonNullable<IdentifiedNeedsAndGaps['title']>, 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<NsActions['title'], 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,
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 }>();
Expand Down

0 comments on commit 752108f

Please sign in to comment.