Skip to content

Commit f3811e2

Browse files
committed
order SDGs by number
1 parent f1ffe6c commit f3811e2

File tree

2 files changed

+22
-10
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]

2 files changed

+22
-10
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/collaboratives/edit/[id]/metadata/page.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const FetchCollaborativeMetadata: any = graphql(`
3535
id
3636
code
3737
name
38+
number
3839
}
3940
geographies {
4041
id
@@ -75,6 +76,7 @@ const sdgsListQueryDoc: any = graphql(`
7576
id
7677
code
7778
name
79+
number
7880
}
7981
}
8082
`);
@@ -214,8 +216,9 @@ const Metadata = () => {
214216

215217
defaultVal['sdgs'] =
216218
data?.sdgs?.map((sdg: any) => {
219+
const num = String(sdg.number || 0).padStart(2, '0');
217220
return {
218-
label: `${sdg.code} - ${sdg.name}`,
221+
label: `${num}. ${sdg.name}`,
219222
value: sdg.id,
220223
};
221224
}) || [];
@@ -433,10 +436,13 @@ const Metadata = () => {
433436
label="SDG Goals *"
434437
name="sdgs"
435438
list={
436-
getSDGsList?.data.sdgs?.map((item: any) => ({
437-
label: `${item.code} - ${item.name}`,
438-
value: item.id,
439-
})) || []
439+
getSDGsList?.data?.sdgs?.map((item: any) => {
440+
const num = String(item.number || 0).padStart(2, '0');
441+
return {
442+
label: `${num}. ${item.name}`,
443+
value: item.id,
444+
};
445+
}) || []
440446
}
441447
selectedValue={formData.sdgs}
442448
onChange={(value) => {

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/metadata/page.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const FetchUseCasedetails: any = graphql(`
4747
id
4848
code
4949
name
50+
number
5051
}
5152
}
5253
}
@@ -146,6 +147,7 @@ const sdgsListQueryDoc: any = graphql(`
146147
id
147148
code
148149
name
150+
number
149151
}
150152
}
151153
`);
@@ -238,8 +240,9 @@ const Metadata = () => {
238240

239241
defaultVal['sdgs'] =
240242
data?.sdgs?.map((sdg: any) => {
243+
const num = String(sdg.number || 0).padStart(2, '0');
241244
return {
242-
label: `${sdg.code} - ${sdg.name}`,
245+
label: `${num}. ${sdg.name}`,
243246
value: sdg.id,
244247
};
245248
}) || [];
@@ -461,10 +464,13 @@ const Metadata = () => {
461464
label="SDG Goals *"
462465
name="sdgs"
463466
list={
464-
getSDGsList?.data.sdgs?.map((item: any) => ({
465-
label: `${item.code} - ${item.name}`,
466-
value: item.id,
467-
})) || []
467+
getSDGsList?.data?.sdgs?.map((item: any) => {
468+
const num = String(item.number || 0).padStart(2, '0');
469+
return {
470+
label: `${num}. ${item.name}`,
471+
value: item.id,
472+
};
473+
}) || []
468474
}
469475
selectedValue={formData.sdgs}
470476
onChange={(value) => {

0 commit comments

Comments
 (0)