Skip to content

Commit 030f19d

Browse files
committed
feat(dref-translation): add ops update confirmation modal
1 parent 954c806 commit 030f19d

File tree

7 files changed

+185
-143
lines changed

7 files changed

+185
-143
lines changed

app/src/components/Navbar/LanguageDropdown/index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,10 @@ import {
1616
} from '@togglecorp/fujs';
1717

1818
import DropdownMenuItem from '#components/DropdownMenuItem';
19+
import { languageNameMap } from '#utils/common';
1920

2021
import styles from './styles.module.css';
2122

22-
// NOTE: these doesn't need to be translated
23-
const languageNameMap: Record<Language, string> = {
24-
en: 'English',
25-
fr: 'Français',
26-
es: 'Español',
27-
ar: 'عربي',
28-
};
29-
3023
const languageList = mapToList(
3124
languageNameMap,
3225
(value, key) => ({ key: key as Language, value }),

app/src/utils/common.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { type Language } from '@ifrc-go/ui/contexts';
12
import { DEFAULT_INVALID_TEXT } from '@ifrc-go/ui/utils';
23
import { isTruthyString } from '@togglecorp/fujs';
34

@@ -37,6 +38,14 @@ export function downloadFile(
3738
URL.revokeObjectURL(url);
3839
}
3940

41+
// NOTE: these doesn't need to be translated
42+
export const languageNameMap: Record<Language, string> = {
43+
en: 'English',
44+
fr: 'Français',
45+
es: 'Español',
46+
ar: 'عربي',
47+
};
48+
4049
export function getFirstTruthyString(
4150
primaryStr: string | null | undefined,
4251
secondaryStr: string | null | undefined,

app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TableBodyContent,
1111
} from '@ifrc-go/ui';
1212
import { type RowOptions } from '@ifrc-go/ui';
13+
import { type Language } from '@ifrc-go/ui/contexts';
1314
import { useTranslation } from '@ifrc-go/ui/hooks';
1415
import {
1516
createDateColumn,
@@ -236,6 +237,7 @@ function ActiveDrefTable(props: Props) {
236237
has_final_report,
237238
country_details,
238239
is_dref_imminent_v2,
240+
original_language,
239241
} = originalDref;
240242

241243
const is_published = status === DREF_STATUS_APPROVED;
@@ -270,6 +272,7 @@ function ActiveDrefTable(props: Props) {
270272
canCreateFinalReport,
271273
hasPermissionToApprove: isRegionCoordinator || userMe?.is_superuser,
272274
onPublishSuccess: refetchActiveDref,
275+
originalLanguage: original_language as Language,
273276
};
274277
},
275278
{ columnClassName: styles.actions },

app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
"drefApprovalInProgressTitle": "Approval in progress...",
1717
"drefAccountCouldNotCreate": "Could not create new operational update",
1818
"drefAccountCouldNotCreateFinalReport": "Could not create final report",
19-
"drefAccountConfirmMessage": "You're about to Approve this DREF. Once approved, it can no longer be edited. Are you sure you want to Approve?",
20-
"drefAccountFinalizeConfirmMessage": "You're about to Finalize this DREF. Once finalize, it can no longer be edited. Are you sure you want to Finalize?",
19+
"drefAccountConfirmMessage": "You're about to approve this DREF. Once approved, it can no longer be edited. Are you sure you want to approve?",
20+
"drefAccountFinalizeConfirmMessage": "You are about to finalize this DREF. Once finalized, the original language will change to English, and it will no longer be editable in the {selectedLanguage} language. Are you sure you want to proceed?",
21+
"drefOpsUpdateOriginalLanguageLabel": "Original Language",
22+
"dropdownActionNewOpsUpdateLanguageConfirmationMessage": "Please select the language to create the DREF Operation Updates.",
2123
"dropdownActionImminentNewOpsUpdateConfirmationHeading": "Confirm addition of Operational Update",
2224
"dropdownActionImminentNewOpsUpdateConfirmationMessage": "The DREF type will be changed to Response (from Imminent) for the Operational Update. Once created, you'll be able to change it to other types except Imminent. Are you sure you want to add an Operational Update?"
2325
}

0 commit comments

Comments
 (0)