Skip to content

Commit 7a85a52

Browse files
puranbansamshara
authored andcommitted
Add dref sorted file for actions
1 parent 6263946 commit 7a85a52

File tree

4 files changed

+77
-149
lines changed

4 files changed

+77
-149
lines changed

src/utils/domain/dref.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { components } from '#generated/types';
2+
3+
type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention'];
4+
type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed'];
5+
type NsActions = components<'read'>['schemas']['NationalSocietyAction'];
6+
7+
const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, number> = {
8+
shelter_housing_and_settlements: 1,
9+
livelihoods_and_basic_needs: 2,
10+
multi_purpose_cash: 3,
11+
health: 4,
12+
water_sanitation_and_hygiene: 5,
13+
protection_gender_and_inclusion: 6,
14+
education: 7,
15+
migration_and_displacement: 8,
16+
risk_reduction_climate_adaptation_and_recovery: 9,
17+
community_engagement_and_accountability: 10,
18+
environmental_sustainability: 11,
19+
coordination_and_partnerships: 12,
20+
secretariat_services: 13,
21+
national_society_strengthening: 14,
22+
};
23+
24+
const identifiedNeedsAndGapsSortedList: Record<NonNullable<IdentifiedNeedsAndGaps['title']>, number> = {
25+
shelter_housing_and_settlements: 1,
26+
livelihoods_and_basic_needs: 2,
27+
multi_purpose_cash_grants: 3,
28+
health: 4,
29+
water_sanitation_and_hygiene: 5,
30+
protection_gender_and_inclusion: 6,
31+
education: 7,
32+
migration_and_displacement: 8,
33+
risk_reduction_climate_adaptation_and_recovery: 9,
34+
community_engagement_and_accountability: 10,
35+
environment_sustainability: 11,
36+
};
37+
38+
const nsActionsSortedList: Record<NsActions['title'], number> = {
39+
shelter_housing_and_settlements: 1,
40+
livelihoods_and_basic_needs: 2,
41+
multi_purpose_cash: 3,
42+
health: 4,
43+
water_sanitation_and_hygiene: 5,
44+
protection_gender_and_inclusion: 6,
45+
education: 7,
46+
migration_and_displacement: 8,
47+
risk_reduction_climate_adaptation_and_recovery: 9,
48+
community_engagement_and_accountability: 10,
49+
environment_sustainability: 11,
50+
coordination: 12,
51+
national_society_readiness: 13,
52+
assessment: 14,
53+
resource_mobilization: 15,
54+
activation_of_contingency_plans: 16,
55+
national_society_eoc: 17,
56+
other: 18,
57+
};
58+
59+
export {
60+
plannedInterventionSortedList,
61+
identifiedNeedsAndGapsSortedList,
62+
nsActionsSortedList,
63+
};

src/views/DrefApplicationExport/index.tsx

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ import {
2525
DREF_TYPE_IMMINENT,
2626
DisasterCategory,
2727
} from '#utils/constants';
28-
import { components } from '#generated/types';
28+
import {
29+
identifiedNeedsAndGapsSortedList,
30+
nsActionsSortedList,
31+
plannedInterventionSortedList,
32+
} from '#utils/domain/dref';
2933
import ifrcLogo from '#assets/icons/ifrc-square.png';
3034

3135
import i18n from './i18n.json';
3236
import styles from './styles.module.css';
3337

34-
type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention'];
35-
type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed'];
36-
type NsActions = components<'read'>['schemas']['NationalSocietyAction'];
37-
3838
function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) {
3939
return (
4040
<TextOutput
@@ -52,58 +52,6 @@ const colorMap: Record<DisasterCategory, string> = {
5252
[DISASTER_CATEGORY_RED]: styles.red,
5353
};
5454

55-
const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, number> = {
56-
shelter_housing_and_settlements: 1,
57-
livelihoods_and_basic_needs: 2,
58-
multi_purpose_cash: 3,
59-
health: 4,
60-
water_sanitation_and_hygiene: 5,
61-
protection_gender_and_inclusion: 6,
62-
education: 7,
63-
migration_and_displacement: 8,
64-
risk_reduction_climate_adaptation_and_recovery: 9,
65-
community_engagement_and_accountability: 10,
66-
environmental_sustainability: 11,
67-
coordination_and_partnerships: 12,
68-
secretariat_services: 13,
69-
national_society_strengthening: 14,
70-
};
71-
72-
const identifiedNeedsAndGapsSortedList: Record<NonNullable<IdentifiedNeedsAndGaps['title']>, number> = {
73-
shelter_housing_and_settlements: 1,
74-
livelihoods_and_basic_needs: 2,
75-
multi_purpose_cash_grants: 3,
76-
health: 4,
77-
water_sanitation_and_hygiene: 5,
78-
protection_gender_and_inclusion: 6,
79-
education: 7,
80-
migration_and_displacement: 8,
81-
risk_reduction_climate_adaptation_and_recovery: 9,
82-
community_engagement_and_accountability: 10,
83-
environment_sustainability: 11,
84-
};
85-
86-
const nsActionsSortedList: Record<NsActions['title'], number> = {
87-
shelter_housing_and_settlements: 1,
88-
livelihoods_and_basic_needs: 2,
89-
multi_purpose_cash: 3,
90-
health: 4,
91-
water_sanitation_and_hygiene: 5,
92-
protection_gender_and_inclusion: 6,
93-
education: 7,
94-
migration_and_displacement: 8,
95-
risk_reduction_climate_adaptation_and_recovery: 9,
96-
community_engagement_and_accountability: 10,
97-
environment_sustainability: 11,
98-
coordination: 12,
99-
national_society_readiness: 13,
100-
assessment: 14,
101-
resource_mobilization: 15,
102-
activation_of_contingency_plans: 16,
103-
national_society_eoc: 17,
104-
other: 18,
105-
};
106-
10755
// eslint-disable-next-line import/prefer-default-export
10856
export function Component() {
10957
const { drefId } = useParams<{ drefId: string }>();

src/views/DrefFinalReportExport/index.tsx

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ import {
2626
DREF_TYPE_IMMINENT,
2727
DisasterCategory,
2828
} from '#utils/constants';
29-
import { components } from '#generated/types';
29+
import {
30+
identifiedNeedsAndGapsSortedList,
31+
plannedInterventionSortedList,
32+
} from '#utils/domain/dref';
3033

3134
import ifrcLogo from '#assets/icons/ifrc-square.png';
3235

3336
import i18n from './i18n.json';
3437
import styles from './styles.module.css';
3538

36-
type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention'];
37-
type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed'];
38-
3939
function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) {
4040
return (
4141
<TextOutput
@@ -53,37 +53,6 @@ const colorMap: Record<DisasterCategory, string> = {
5353
[DISASTER_CATEGORY_RED]: styles.red,
5454
};
5555

56-
const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, number> = {
57-
shelter_housing_and_settlements: 1,
58-
livelihoods_and_basic_needs: 2,
59-
multi_purpose_cash: 3,
60-
health: 4,
61-
water_sanitation_and_hygiene: 5,
62-
protection_gender_and_inclusion: 6,
63-
education: 7,
64-
migration_and_displacement: 8,
65-
risk_reduction_climate_adaptation_and_recovery: 9,
66-
community_engagement_and_accountability: 10,
67-
environmental_sustainability: 11,
68-
coordination_and_partnerships: 12,
69-
secretariat_services: 13,
70-
national_society_strengthening: 14,
71-
};
72-
73-
const identifiedNeedsAndGapsSortedList: Record<NonNullable<IdentifiedNeedsAndGaps['title']>, number> = {
74-
shelter_housing_and_settlements: 1,
75-
livelihoods_and_basic_needs: 2,
76-
multi_purpose_cash_grants: 3,
77-
health: 4,
78-
water_sanitation_and_hygiene: 5,
79-
protection_gender_and_inclusion: 6,
80-
education: 7,
81-
migration_and_displacement: 8,
82-
risk_reduction_climate_adaptation_and_recovery: 9,
83-
community_engagement_and_accountability: 10,
84-
environment_sustainability: 11,
85-
};
86-
8756
// eslint-disable-next-line import/prefer-default-export
8857
export function Component() {
8958
const { finalReportId } = useParams<{ finalReportId: string }>();

src/views/DrefOperationalUpdateExport/index.tsx

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ import {
2727
DREF_TYPE_IMMINENT,
2828
DisasterCategory,
2929
} from '#utils/constants';
30-
import { components } from '#generated/types';
30+
import {
31+
identifiedNeedsAndGapsSortedList,
32+
nsActionsSortedList,
33+
plannedInterventionSortedList,
34+
} from '#utils/domain/dref';
3135

3236
import ifrcLogo from '#assets/icons/ifrc-square.png';
3337

3438
import i18n from './i18n.json';
3539
import styles from './styles.module.css';
3640

37-
type PlannedIntervention = components<'read'>['schemas']['PlannedIntervention'];
38-
type IdentifiedNeedsAndGaps = components<'read'>['schemas']['IdentifiedNeed'];
39-
type NsActions = components<'read'>['schemas']['NationalSocietyAction'];
40-
4141
function BlockTextOutput(props: TextOutputProps & { variant?: never, withoutLabelColon?: never }) {
4242
return (
4343
<TextOutput
@@ -55,58 +55,6 @@ const colorMap: Record<DisasterCategory, string> = {
5555
[DISASTER_CATEGORY_RED]: styles.red,
5656
};
5757

58-
const plannedInterventionSortedList: Record<NonNullable<PlannedIntervention['title']>, number> = {
59-
shelter_housing_and_settlements: 1,
60-
livelihoods_and_basic_needs: 2,
61-
multi_purpose_cash: 3,
62-
health: 4,
63-
water_sanitation_and_hygiene: 5,
64-
protection_gender_and_inclusion: 6,
65-
education: 7,
66-
migration_and_displacement: 8,
67-
risk_reduction_climate_adaptation_and_recovery: 9,
68-
community_engagement_and_accountability: 10,
69-
environmental_sustainability: 11,
70-
coordination_and_partnerships: 12,
71-
secretariat_services: 13,
72-
national_society_strengthening: 14,
73-
};
74-
75-
const identifiedNeedsAndGapsSortedList: Record<NonNullable<IdentifiedNeedsAndGaps['title']>, number> = {
76-
shelter_housing_and_settlements: 1,
77-
livelihoods_and_basic_needs: 2,
78-
multi_purpose_cash_grants: 3,
79-
health: 4,
80-
water_sanitation_and_hygiene: 5,
81-
protection_gender_and_inclusion: 6,
82-
education: 7,
83-
migration_and_displacement: 8,
84-
risk_reduction_climate_adaptation_and_recovery: 9,
85-
community_engagement_and_accountability: 10,
86-
environment_sustainability: 11,
87-
};
88-
89-
const nsActionsSortedList: Record<NsActions['title'], number> = {
90-
shelter_housing_and_settlements: 1,
91-
livelihoods_and_basic_needs: 2,
92-
multi_purpose_cash: 3,
93-
health: 4,
94-
water_sanitation_and_hygiene: 5,
95-
protection_gender_and_inclusion: 6,
96-
education: 7,
97-
migration_and_displacement: 8,
98-
risk_reduction_climate_adaptation_and_recovery: 9,
99-
community_engagement_and_accountability: 10,
100-
environment_sustainability: 11,
101-
coordination: 12,
102-
national_society_readiness: 13,
103-
assessment: 14,
104-
resource_mobilization: 15,
105-
activation_of_contingency_plans: 16,
106-
national_society_eoc: 17,
107-
other: 18,
108-
};
109-
11058
// eslint-disable-next-line import/prefer-default-export
11159
export function Component() {
11260
const { opsUpdateId } = useParams<{ opsUpdateId: string }>();

0 commit comments

Comments
 (0)