Skip to content

Commit 2affa5e

Browse files
committed
Add source information in dref export
1 parent 793e0e7 commit 2affa5e

File tree

9 files changed

+119
-14
lines changed

9 files changed

+119
-14
lines changed

src/views/DrefApplicationExport/i18n.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"drefApplicationExportMitigation": "Mitigation action",
9898
"drefApplicationSupportingDocumentation": "Supporting Documentation",
9999
"drefAssessmentReportLink": "Assessment Report",
100-
"SourceInformationSectionHeading": "Source Information",
100+
"sourceInformationSectionHeading": "Source Information",
101101
"sourceInformationSourceNameTitle": "Source Name",
102102
"sourceInformationSourceLinkTitle": "Source Link",
103103
"crisisCategorySupportingDocumentLabel": "Crisis Category Supporting Document",

src/views/DrefApplicationExport/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ export function Component() {
173173
const eventDescriptionDefined = isTruthyString(drefResponse?.event_description?.trim());
174174
const eventScopeDefined = drefResponse?.type_of_dref !== DREF_TYPE_ASSESSMENT
175175
&& isTruthyString(drefResponse?.event_scope?.trim());
176+
const sourceInformationDefined = isDefined(drefResponse)
177+
&& isDefined(drefResponse.source_information)
178+
&& drefResponse.source_information.length > 0;
176179
const imagesFileDefined = isDefined(drefResponse)
177180
&& isDefined(drefResponse.images_file)
178181
&& drefResponse.images_file.length > 0;
@@ -188,6 +191,7 @@ export function Component() {
188191
|| anticipatoryActionsDefined
189192
|| eventTextDefined
190193
|| eventDateDefined
194+
|| sourceInformationDefined
191195
|| isDefined(drefResponse?.event_map_file?.file);
192196

193197
const lessonsLearnedDefined = isTruthyString(drefResponse?.lessons_learned?.trim());
@@ -284,10 +288,6 @@ export function Component() {
284288
|| pmerDefined
285289
|| communicationDefined;
286290

287-
const sourceInformationDefined = isDefined(drefResponse)
288-
&& isDefined(drefResponse.source_information)
289-
&& drefResponse.source_information.length > 0;
290-
291291
const showBudgetOverview = isTruthyString(drefResponse?.budget_file_details?.file);
292292

293293
const nsContactText = [
@@ -559,7 +559,7 @@ export function Component() {
559559
)}
560560
{sourceInformationDefined && (
561561
<Container
562-
heading={strings.SourceInformationSectionHeading}
562+
heading={strings.sourceInformationSectionHeading}
563563
childrenContainerClassName={styles.sourceInformationList}
564564
headingLevel={3}
565565
>

src/views/DrefFinalReportExport/i18n.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
"appealManagerContactHeading": "IFRC Appeal Manager",
8787
"projectManagerContactHeading": "IFRC Project Manager",
8888
"focalPointContactHeading": "IFRC focal point for the emergency",
89-
"mediaContactHeading": "Media Contact"
89+
"mediaContactHeading": "Media Contact",
90+
"sourceInformationSectionHeading": "Source Information",
91+
"sourceInformationSourceNameTitle": "Source Name",
92+
"sourceInformationSourceLinkTitle": "Source Link"
9093
}
9194
}

src/views/DrefFinalReportExport/index.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,15 @@ export function Component() {
150150
&& isDefined(drefResponse?.event_date);
151151
const eventTextDefined = drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
152152
&& isTruthyString(drefResponse?.event_text?.trim());
153+
const sourceInformationDefined = isDefined(drefResponse)
154+
&& isDefined(drefResponse.source_information)
155+
&& drefResponse.source_information.length > 0;
153156
const showEventDescriptionSection = eventDescriptionDefined
154157
|| eventScopeDefined
155158
|| imagesFileDefined
156159
|| eventDateDefined
157160
|| eventTextDefined
161+
|| sourceInformationDefined
158162
|| isDefined(drefResponse?.event_map_file?.file);
159163

160164
const ifrcActionsDefined = isTruthyString(drefResponse?.ifrc?.trim());
@@ -312,7 +316,8 @@ export function Component() {
312316
&& isDefined(drefResponse.disaster_category)
313317
// FIXME: empty string in enum
314318
&& drefResponse.disaster_category !== ''
315-
&& colorMap[drefResponse.disaster_category],
319+
&& isDefined(drefResponse.disaster_category)
320+
&& colorMap[drefResponse.disaster_category],
316321
)}
317322
strongValue
318323
/>
@@ -453,6 +458,41 @@ export function Component() {
453458
</DescriptionText>
454459
</Container>
455460
)}
461+
{sourceInformationDefined && (
462+
<Container
463+
heading={strings.sourceInformationSectionHeading}
464+
childrenContainerClassName={styles.sourceInformationList}
465+
headingLevel={3}
466+
>
467+
<div className={styles.nameTitle}>
468+
{strings.sourceInformationSourceNameTitle}
469+
</div>
470+
<div className={styles.linkTitle}>
471+
{strings.sourceInformationSourceLinkTitle}
472+
</div>
473+
{drefResponse?.source_information?.map(
474+
(source, index) => (
475+
<Fragment key={source.id}>
476+
<DescriptionText className={styles.name}>
477+
<div className={styles.nameList}>
478+
{`${index + 1}. ${source.source_name}`}
479+
</div>
480+
</DescriptionText>
481+
<DescriptionText className={styles.link}>
482+
<Link
483+
href={source.source_link}
484+
external
485+
withUnderline
486+
>
487+
{source?.source_link}
488+
</Link>
489+
</DescriptionText>
490+
</Fragment>
491+
),
492+
)}
493+
494+
</Container>
495+
)}
456496
</>
457497
)}
458498
{showNsActionsSection && (

src/views/DrefFinalReportExport/styles.module.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,25 +143,36 @@
143143
}
144144
}
145145

146-
.risk-list {
146+
.risk-list,
147+
.source-information-list {
147148
display: grid;
148149
grid-template-columns: 1fr 1fr;
149150
grid-gap: var(--go-ui-width-separator-md);
150151

151152
.risk,
153+
.name,
154+
.link,
152155
.mitigation {
153156
background-color: var(--pdf-element-bg);
154157
padding: var(--go-ui-spacing-xs);
155158
}
156159

160+
.name-list {
161+
display: flex;
162+
gap: var(--go-ui-spacing-sm);
163+
}
164+
157165
.risk-title,
166+
.name-title,
167+
.link-title,
158168
.mitigation-title {
159169
background-color: var(--pdf-element-bg);
160170
padding: var(--go-ui-spacing-xs);
161171
font-weight: var(--go-ui-font-weight-bold);
162172
}
163173
}
164174

175+
165176
.planned-intervention-heading {
166177
display: flex;
167178
align-items: center;

src/views/DrefOperationalUpdateExport/i18n.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
"drefOperationalImageAlt": "IFRC",
104104
"drefOperationalOtherImageAlt": "Image",
105105
"drefOperationalRisk": "Risk",
106-
"drefOperationalMitigation": "Mitigation action"
106+
"drefOperationalMitigation": "Mitigation action",
107+
"sourceInformationSectionHeading": "Source Information",
108+
"sourceInformationSourceNameTitle": "Source Name",
109+
"sourceInformationSourceLinkTitle": "Source Link"
107110
}
108111
}

src/views/DrefOperationalUpdateExport/index.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@ export function Component() {
170170
&& isDefined(drefResponse?.event_text?.trim());
171171
const anticipatoryActionsDefined = drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
172172
&& isTruthyString(drefResponse?.anticipatory_actions?.trim());
173+
const sourceInformationDefined = isDefined(drefResponse)
174+
&& isDefined(drefResponse?.source_information)
175+
&& drefResponse.source_information.length > 0;
173176
const showEventDescriptionSection = eventDescriptionDefined
174177
|| eventScopeDefined
175178
|| imagesFileDefined
176179
|| anticipatoryActionsDefined
177180
|| eventDateDefined
178181
|| eventTextDefined
182+
|| sourceInformationDefined
179183
|| isDefined(drefResponse?.event_map_file?.file);
180184

181185
const ifrcActionsDefined = isTruthyString(drefResponse?.ifrc?.trim());
@@ -525,6 +529,40 @@ export function Component() {
525529
</DescriptionText>
526530
</Container>
527531
)}
532+
{sourceInformationDefined && (
533+
<Container
534+
heading={strings.sourceInformationSectionHeading}
535+
childrenContainerClassName={styles.sourceInformationList}
536+
headingLevel={3}
537+
>
538+
<div className={styles.nameTitle}>
539+
{strings.sourceInformationSourceNameTitle}
540+
</div>
541+
<div className={styles.linkTitle}>
542+
{strings.sourceInformationSourceLinkTitle}
543+
</div>
544+
{drefResponse?.source_information?.map(
545+
(source, index) => (
546+
<Fragment key={source.id}>
547+
<DescriptionText className={styles.name}>
548+
<div className={styles.nameList}>
549+
{`${index + 1}. ${source.source_name}`}
550+
</div>
551+
</DescriptionText>
552+
<DescriptionText className={styles.link}>
553+
<Link
554+
href={source.source_link}
555+
external
556+
withUnderline
557+
>
558+
{source?.source_link}
559+
</Link>
560+
</DescriptionText>
561+
</Fragment>
562+
),
563+
)}
564+
</Container>
565+
)}
528566
</>
529567
)}
530568
{showSummaryOfChangesSection && (

src/views/DrefOperationalUpdateExport/styles.module.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,28 @@
163163
}
164164
}
165165

166-
.risk-list {
166+
.risk-list,
167+
.source-information-list {
167168
display: grid;
168169
grid-template-columns: 1fr 1fr;
169170
grid-gap: var(--go-ui-width-separator-md);
170171

171172
.risk,
173+
.name,
174+
.link,
172175
.mitigation {
173176
background-color: var(--pdf-element-bg);
174177
padding: var(--go-ui-spacing-xs);
175178
}
176179

180+
.name-list {
181+
display: flex;
182+
gap: var(--go-ui-spacing-sm);
183+
}
184+
177185
.risk-title,
186+
.name-title,
187+
.link-title,
178188
.mitigation-title {
179189
background-color: var(--pdf-element-bg);
180190
padding: var(--go-ui-spacing-xs);

src/views/DrefOperationalUpdateForm/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
useParams,
1010
} from 'react-router-dom';
1111
import {
12-
ErrorWarningFillIcon,
13-
DownloadTwoLineIcon,
14-
ShareLineIcon,
12+
errorWarningFillIcon,
13+
downloadTwoLineIcon,
14+
shareLineIcon,
1515
} from '@ifrc-go/icons';
1616
import {
1717
useForm,

0 commit comments

Comments
 (0)