Skip to content

Commit d9214b4

Browse files
committed
have fallback for sdg numbner not showing when selected in dropfdown
1 parent 701cd52 commit d9214b4

File tree

2 files changed

+14
-4
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]

2 files changed

+14
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const UpdateCollaborativeMetadata: any = graphql(`
132132
id
133133
code
134134
name
135+
number
135136
}
136137
geographies {
137138
id
@@ -216,7 +217,9 @@ const Metadata = () => {
216217

217218
defaultVal['sdgs'] =
218219
data?.sdgs?.map((sdg: any) => {
219-
const num = String(sdg.number || 0).padStart(2, '0');
220+
const num = sdg.number
221+
? String(sdg.number).padStart(2, '0')
222+
: sdg.code.replace('SDG', '').padStart(2, '0');
220223
return {
221224
label: `${num}. ${sdg.name}`,
222225
value: sdg.id,
@@ -437,7 +440,9 @@ const Metadata = () => {
437440
name="sdgs"
438441
list={
439442
getSDGsList?.data?.sdgs?.map((item: any) => {
440-
const num = String(item.number || 0).padStart(2, '0');
443+
const num = item.number
444+
? String(item.number).padStart(2, '0')
445+
: item.code.replace('SDG', '').padStart(2, '0');
441446
return {
442447
label: `${num}. ${item.name}`,
443448
value: item.id,

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const UpdateUseCaseMetadataMutation: any = graphql(`
8585
id
8686
code
8787
name
88+
number
8889
}
8990
}
9091
}
@@ -240,7 +241,9 @@ const Metadata = () => {
240241

241242
defaultVal['sdgs'] =
242243
data?.sdgs?.map((sdg: any) => {
243-
const num = String(sdg.number || 0).padStart(2, '0');
244+
const num = sdg.number
245+
? String(sdg.number).padStart(2, '0')
246+
: sdg.code.replace('SDG', '').padStart(2, '0');
244247
return {
245248
label: `${num}. ${sdg.name}`,
246249
value: sdg.id,
@@ -465,7 +468,9 @@ const Metadata = () => {
465468
name="sdgs"
466469
list={
467470
getSDGsList?.data?.sdgs?.map((item: any) => {
468-
const num = String(item.number || 0).padStart(2, '0');
471+
const num = item.number
472+
? String(item.number).padStart(2, '0')
473+
: item.code.replace('SDG', '').padStart(2, '0');
469474
return {
470475
label: `${num}. ${item.name}`,
471476
value: item.id,

0 commit comments

Comments
 (0)