Skip to content

Commit 9036b1d

Browse files
committed
feat(eap): add ExplanatoryNote components in both EAP form replacing tooltip
- add IconButton in InfoModal - hide export button for staging and production
1 parent 537c393 commit 9036b1d

26 files changed

Lines changed: 1345 additions & 766 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { InformationLineIcon } from '@ifrc-go/icons';
2+
3+
import InfoModal from '#components/domain/InfoModal';
4+
5+
import styles from './styles.module.css';
6+
7+
interface Props {
8+
content: React.ReactNode;
9+
heading: string;
10+
ariaLabel: string;
11+
title: string;
12+
}
13+
14+
function ExplanatoryNote(props: Props) {
15+
const {
16+
content,
17+
heading,
18+
ariaLabel,
19+
title,
20+
} = props;
21+
22+
return (
23+
<InfoModal
24+
name={undefined}
25+
heading={heading}
26+
modalContent={content}
27+
icon={(<InformationLineIcon className={styles.icon} />)}
28+
ariaLabel={ariaLabel}
29+
title={title}
30+
/>
31+
);
32+
}
33+
34+
export default ExplanatoryNote;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.icon {
2+
/* FIXME: use variables */
3+
font-size: 1rem;
4+
}

app/src/components/domain/EapOperationActivityListInput/index.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AddLineIcon } from '@ifrc-go/icons';
66
import {
77
Button,
88
Container,
9-
InfoPopup,
9+
Description,
1010
ListView,
1111
} from '@ifrc-go/ui';
1212
import { useTranslation } from '@ifrc-go/ui/hooks';
@@ -24,6 +24,7 @@ import {
2424

2525
import EapOperationActivityInput from '#components/domain/EapOperationActivityInput';
2626
import { type OperationActivityFormFields } from '#components/domain/EapOperationActivityInput/schema';
27+
import ExplanatoryNote from '#components/ExplanatoryNote';
2728
import Link from '#components/Link';
2829
import NonFieldError from '#components/NonFieldError';
2930

@@ -123,9 +124,16 @@ function EapOperationActivityListInput<const NAME extends FormName>(props: Props
123124
heading={(
124125
<ListView spacing="sm">
125126
{title}
126-
{description && (
127-
<InfoPopup
128-
description={description}
127+
{(title && description) && (
128+
<ExplanatoryNote
129+
heading={title}
130+
ariaLabel={title}
131+
title={title}
132+
content={(
133+
<Description>
134+
{description}
135+
</Description>
136+
)}
129137
/>
130138
)}
131139
</ListView>

app/src/components/domain/InfoModal/index.tsx

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
11
import {
22
Button,
33
type ButtonProps,
4+
IconButton,
45
Modal,
56
} from '@ifrc-go/ui';
67
import { useBooleanState } from '@ifrc-go/ui/hooks';
78

9+
type IconButtonProps = {
10+
icon: React.ReactNode;
11+
ariaLabel: string;
12+
label?: never;
13+
title: string;
14+
}
15+
16+
type LabelButtonProps = {
17+
icon?: never;
18+
ariaLabel?: string;
19+
label?: string;
20+
}
21+
22+
type ButtonTypeProps = IconButtonProps | LabelButtonProps;
23+
824
// FIXME: make the props consistent with other similar components
925
// e.g. DropdownMenu
10-
interface Props extends ButtonProps<undefined> {
26+
interface BaseProps extends ButtonProps<undefined> {
1127
heading?: string;
1228
modalContent: React.ReactNode;
13-
label?: string;
1429
}
1530

31+
type Props = BaseProps & ButtonTypeProps;
32+
1633
// FIXME: this component should be in `/components`
1734
function InfoModal(props: Props) {
1835
const {
1936
heading,
2037
label,
2138
modalContent,
39+
ariaLabel,
40+
title,
41+
icon,
2242
...otherButtonProps
2343
} = props;
2444

@@ -32,14 +52,25 @@ function InfoModal(props: Props) {
3252

3353
return (
3454
<>
35-
<Button
36-
// eslint-disable-next-line react/jsx-props-no-spreading
37-
{...otherButtonProps}
38-
name={undefined}
39-
onClick={setShowInfoModalTrue}
40-
>
41-
{label}
42-
</Button>
55+
{icon ? (
56+
<IconButton
57+
name={undefined}
58+
onClick={setShowInfoModalTrue}
59+
ariaLabel={ariaLabel}
60+
title={title}
61+
>
62+
{icon}
63+
</IconButton>
64+
) : (
65+
<Button
66+
// eslint-disable-next-line react/jsx-props-no-spreading
67+
{...otherButtonProps}
68+
name={undefined}
69+
onClick={setShowInfoModalTrue}
70+
>
71+
{label}
72+
</Button>
73+
)}
4374
{showInfoModal && (
4475
<Modal
4576
onClose={setShowInfoModalFalse}

app/src/views/AccountMyFormsEap/EapTableActions/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919

2020
import EapExportModal from '#components/domain/EapExportModal';
2121
import Link from '#components/Link';
22+
import { environment } from '#config';
2223
import {
2324
EAP_STATUS_NS_ADDRESSING_COMMENTS,
2425
EAP_STATUS_PENDING_PFA,
@@ -151,7 +152,7 @@ function EapTableActions(props: Props) {
151152
)}
152153
{type === 'development' && (
153154
<>
154-
{eap.eap_type === EAP_TYPE_SIMPLIFIED && isCreated && (
155+
{environment === 'testing' && eap.eap_type === EAP_TYPE_SIMPLIFIED && isCreated && (
155156
<Link
156157
to="eapSimplifiedExport"
157158
urlParams={{ eapId: eap.id }}
@@ -164,7 +165,7 @@ function EapTableActions(props: Props) {
164165
{strings.previewExportLinkLabel}
165166
</Link>
166167
)}
167-
{eap.eap_type === EAP_TYPE_FULL && isCreated && (
168+
{environment === 'testing' && eap.eap_type === EAP_TYPE_FULL && isCreated && (
168169
<Link
169170
to="eapFullExport"
170171
urlParams={{ eapId: eap.id }}

app/src/views/EapFullForm/EapActivationProcess/i18n.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"activationProcessExplanatoryLabel": "Explanatory Note",
1111
"activationProcessRequiredPointsLabel": "Required Points",
1212
"activationImplementationExplanatoryNote": "As a crucial component of the EAP, once the trigger has been reached, everyone involved should be knowledgeable about what will be done, where, when and by whom. The described implementation process shows that each step of the activation has been thought through and considered and that implementation in the lead time available is possible. The set of tasks described in this section should cover all activities from the moment the trigger is reached (Day 1) to the completion of post-impact surveys (Day X).",
13-
"activationImplementationRequiredPoint1": "Include a matrix/flowchart for a quick overview of the early action implementation process.",
14-
"activationImplementationRequiredPoint2": "Describe the step-by-step process from Day 1 to Day X for the implementation of the selected early actions. Indicate the day when the Stop Mechanism would occur. Include all critical and support tasks that are necessary for each of the steps. Each task should indicate the position of the person responsible (including when cash-based actions are planned liaison with the financial service provider).",
15-
"activationImplementationRequiredPoint3": "For each action, include at which level it will take place (HQ, branch, community).",
16-
"activationImplementationRequiredPoint4": "Each NS should have a detailed version of this process, including communication flows, for each task and the name of the person responsible with their contact information. This document should be regularly updated.",
13+
"activationRequiredPoint1": "Include a matrix/flowchart for a quick overview of the early action implementation process.",
14+
"activationRequiredPoint2": "Describe the step-by-step process from Day 1 to Day X for the implementation of the selected early actions. Indicate the day when the Stop Mechanism would occur. Include all critical and support tasks that are necessary for each of the steps. Each task should indicate the position of the person responsible (including when cash-based actions are planned liaison with the financial service provider).",
15+
"activationRequiredPoint3": "For each action, include at which level it will take place (HQ, branch, community).",
16+
"activationRequiredPoint4": "Each NS should have a detailed version of this process, including communication flows, for each task and the name of the person responsible with their contact information. This document should be regularly updated.",
1717
"activationProcessUploadLabel": "Upload",
1818
"activationTriggerTitle": "Trigger activation system",
1919
"activationTriggerDescription1": "Describe the automatic system used to monitor the forecasts, generate the intervention map and send the alert message when the trigger is reached.",
@@ -31,9 +31,9 @@
3131
"activationSelectionDescription3": "If the EAP is intending to use Social Protection systems or other government beneficiary databases, indicate how the potential number of targeted households be selected",
3232
"activationSelectionExplanatoryNote": "FbF aims to protect the most vulnerable from the impact of extreme weather events. Based on the analysis on vulnerability and exposure (in section 3) and on the described mechanism for identifying intervention areas/communities (in section 4- Intervention area), it needs to be clear, how vulnerability criteria and impact forecasts will be applied to determine who will be targeted.",
3333
"activationStopMechanismTitle": "Stop Mechanism",
34-
"activationStopMechanismDescription1": "Indicate on which day of activation the stop mechanism is foreseen, and who is responsible to give the signal to stop.",
35-
"activationStopMechanismDescription2": "Describe when the stop mechanism begins and whether in-kind/cash distribution would be stopped or not. For cash actions cancelled, how would this be coordinated with the financial service provider? For in-kind distribution, what would happen with the perishable items?",
36-
"activationStopMechanismDescription3": "Explain how it would be communicated to communities and stakeholders that the activities are being stopped.",
34+
"activationStopDescription1": "Indicate on which day of activation the stop mechanism is foreseen, and who is responsible to give the signal to stop.",
35+
"activationStopDescription2": "Describe when the stop mechanism begins and whether in-kind/cash distribution would be stopped or not. For cash actions cancelled, how would this be coordinated with the financial service provider? For in-kind distribution, what would happen with the perishable items?",
36+
"activationStopDescription3": "Explain how it would be communicated to communities and stakeholders that the activities are being stopped.",
3737
"activationStopMechanismExplanatoryNote": "For forecast triggers with a lead time of more than three days, the EAP should include the description of a stop mechanism. This means that if a later forecast – prior to the start of activities (related to the early action(s)) shows that the event is no longer likely to occur, the activation of the EAP will be stopped to avoid generating further use of resources. For example, if the 6-day forecast on Day 1 indicates high risk of heavy rainfall and thereby triggers the activation and the new 6-day-forecast released on Day 3 shows that the risk has significantly lowered, the trigger level is no longer reached. If the start of distributions was planned for Day 4, activation should be stopped. Items that have been purchased based on the trigger being reached and are not distributed due to the stop mechanism should be stored in the warehouse for a future activation. For forecast triggers with a lead time of less than 3 days, the EAP should include the description of what the National Society would do if the forecast changes in strength or location within the last three days before the event.",
3838
"activationAttachFilesTitle": "Attach Relevant Files",
3939
"activationAttachFilesDescription": "Attach any additional maps, documentation, files, images, etc.",

0 commit comments

Comments
 (0)