Skip to content

Commit a1a623a

Browse files
committed
eap(lisitng): Add eap listing page
1 parent fbac009 commit a1a623a

File tree

8 files changed

+99
-37
lines changed

8 files changed

+99
-37
lines changed

app/src/App/routes/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ const eapRegistrationFormIndex = customWrapRoute({
12141214
},
12151215
});
12161216

1217-
const eapDevelopmentRegistration = customWrapRoute({
1217+
const newEapDevelopmentRegistration = customWrapRoute({
12181218
parent: eapRegistrationLayout,
12191219
path: 'new' satisfies DefaultEapRegistrationChild,
12201220
component: {
@@ -1503,7 +1503,7 @@ const wrappedRoutes = {
15031503
termsAndConditions,
15041504
operationalLearning,
15051505
montandonLandingPage,
1506-
eapDevelopmentRegistration,
1506+
newEapDevelopmentRegistration,
15071507
eapFullForm,
15081508
simplifiedEapForm,
15091509
...regionRoutes,

app/src/utils/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,6 @@ export const multiMonthSelectDefaultValue = listToMap(
195195
export const ERU_READINESS_READY = 1;
196196
export const ERU_READINESS_CAN_CONTRIBUTE = 2;
197197
export const ERU_READINESS_NO_CAPACITY = 3;
198+
199+
export const EAP_TYPE_SIMPLIFIED = 20;
200+
export const EAP_TYPE_FULL = 10;

app/src/views/EapApplications/i18n.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"namespace": "eapApplication",
33
"strings": {
44
"eapRegistrationLink": "Register Your EAP",
5-
"eapApplicationsHeading": "EAP Application"
5+
"eapApplicationsHeading": "EAP Application",
6+
"eapLastUpdated": "Last Updated",
7+
"eapName": "Name/Phase",
8+
"eapType": "EAP Type",
9+
"eapStatus": "Status",
10+
"eapRegistration": "EAP Registration"
611
}
712
}

app/src/views/EapApplications/index.tsx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import {
2222

2323
import Link from '#components/Link';
2424
import useFilterState from '#hooks/useFilterState';
25+
import {
26+
EAP_TYPE_FULL,
27+
EAP_TYPE_SIMPLIFIED,
28+
} from '#utils/constants';
2529
import {
2630
type GoApiResponse,
2731
useRequest,
@@ -82,19 +86,18 @@ export function Component() {
8286
() => ([
8387
createDateColumn<EapListItem, number>(
8488
'created_at',
85-
'Last Updated',
89+
strings.eapLastUpdated,
8690
(item) => item.created_at,
87-
{ columnClassName: styles.date },
8891
),
8992
createStringColumn<EapListItem, number>(
9093
'name',
91-
'Name/Phase',
94+
strings.eapName,
9295
(item) => {
9396
const baseYear = new Date(item.created_at).getFullYear();
9497
let addedYear = baseYear;
95-
if (item.eap_type === 10) {
96-
addedYear = baseYear + 4;
97-
} else if (item.eap_type === 20) {
98+
if (item.eap_type === EAP_TYPE_FULL) {
99+
addedYear = baseYear + 5;
100+
} else if (item.eap_type === EAP_TYPE_SIMPLIFIED) {
98101
addedYear = baseYear + 2;
99102
}
100103
return `${item.country_details?.name}:
@@ -105,24 +108,15 @@ export function Component() {
105108
),
106109
createStringColumn<EapListItem, number>(
107110
'eap_type_display',
108-
'EAP Type',
111+
strings.eapType,
109112
(item) => item.eap_type_display,
110-
{ columnClassName: styles.type },
111113
),
112114
createStringColumn<EapListItem, number>(
113115
'status_display',
114-
'Status',
116+
strings.eapStatus,
115117
(item) => item.status_display,
116118
{ columnClassName: styles.status },
117119
),
118-
]),
119-
[],
120-
);
121-
122-
const aggregatedColumns = useMemo(
123-
() => ([
124-
createExpansionIndicatorColumn<EapListItem, Key>(false),
125-
...baseColumns,
126120
createExpandColumn<EapListItem, Key>(
127121
'expandRow',
128122
'',
@@ -132,7 +126,14 @@ export function Component() {
132126
}),
133127
),
134128
]),
135-
[baseColumns, handleExpandClick, expandedRow],
129+
[
130+
strings.eapLastUpdated,
131+
strings.eapName,
132+
strings.eapType,
133+
strings.eapStatus,
134+
expandedRow,
135+
handleExpandClick,
136+
],
136137
);
137138

138139
const detailColumns = useMemo(
@@ -141,22 +142,21 @@ export function Component() {
141142
createStringColumn<EapListItem, number>(
142143
'title',
143144
'',
144-
() => 'EAP Registration',
145+
() => strings.eapRegistration,
145146
{ columnClassName: styles.detailTitle },
146147
),
148+
createEmptyColumn(),
147149
createElementColumn<EapListItem, number, EapTableActionProps>(
148150
'actions',
149-
'EAP Registration',
151+
'',
150152
EapTableActions,
151153
(eapId) => ({
152154
eapId,
153155
}),
154156
),
155157
createEmptyColumn(),
156-
createEmptyColumn(),
157-
createEmptyColumn(),
158158
]),
159-
[],
159+
[strings.eapRegistration],
160160
);
161161

162162
const rowModifier = useCallback(
@@ -201,7 +201,7 @@ export function Component() {
201201
)}
202202
actions={(
203203
<Link
204-
to="home"
204+
to="newEapDevelopmentRegistration"
205205
variant="secondary"
206206
>
207207
{strings.eapRegistrationLink}
@@ -211,7 +211,7 @@ export function Component() {
211211
<Table
212212
className={styles.table}
213213
data={eapResponse?.results}
214-
columns={aggregatedColumns}
214+
columns={baseColumns}
215215
rowModifier={rowModifier}
216216
keySelector={numericIdSelector}
217217
pending={eapPending}

app/src/views/EapApplications/styles.module.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
.eap-form-links {
22
.table {
3-
.type,
4-
.status,
5-
.date {
3+
.status {
64
width: 0%;
7-
min-width: 7rem;
5+
min-width: 19rem;
86
}
9-
107
.sub-cell {
118
border-bottom: unset;
129
background-color: var(--go-ui-color-gray-20);

app/src/views/EapRegistration/i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"eapRegistrationSuccess": "Successfully created a new EAP!",
4343
"eapNotSure": "Not Sure",
4444
"eapDevelopmentRegistrationHeading": "EAP Development Registration",
45-
"eapDevelopmentRegistrationDescription": "Thank you for notifying us about the start of your EAP process. We look forward to your completed application."
45+
"eapDevelopmentRegistrationDescription": "Thank you for notifying us about the start of your EAP process. We look forward to your completed application.",
46+
"eapFailedToLoad": "Failed to Load"
4647
}
4748
}

0 commit comments

Comments
 (0)