Skip to content

Commit dae4d49

Browse files
committed
Handle more empty fields
1 parent a969db3 commit dae4d49

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

components/project-overview.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { COLORS, LABELS } from './constants'
66
import TooltipWrapper from './tooltip-wrapper'
77
import { getProjectCategory } from './utils'
88

9-
const Empty = ({ label = 'N/A' }) => {
9+
const Empty = ({ label = 'Unknown' }) => {
1010
return <Box>{label}</Box>
1111
}
1212

@@ -60,7 +60,7 @@ const ProjectOverview = ({ project, columns = 4 }) => {
6060
>
6161
<Box sx={sx.label}>Country</Box>
6262
</TooltipWrapper>
63-
<Box sx={sx.value}>{country}</Box>
63+
<Box sx={sx.value}>{country ?? <Empty />}</Box>
6464
</Column>
6565

6666
<Column start={[4, 3, 3, 3]} width={[3, 2, 2, 2]}>
@@ -72,7 +72,9 @@ const ProjectOverview = ({ project, columns = 4 }) => {
7272
>
7373
<Box sx={sx.label}>Status</Box>
7474
</TooltipWrapper>
75-
<Box sx={{ ...sx.value, textTransform: 'capitalize' }}>{status}</Box>
75+
<Box sx={{ ...sx.value, textTransform: 'capitalize' }}>
76+
{status ?? <Empty />}
77+
</Box>
7678
</Column>
7779

7880
<Column
@@ -90,7 +92,7 @@ const ProjectOverview = ({ project, columns = 4 }) => {
9092
<Box sx={sx.value}>
9193
{(Array.isArray(category) ? category : [category]).map((c) => (
9294
<Box key={c} sx={{ width: 'fit-content' }}>
93-
{LABELS.category[c] ?? <Empty label='Unknown' />}
95+
{LABELS.category[c] ?? <Empty />}
9496
</Box>
9597
))}
9698
</Box>
@@ -111,7 +113,7 @@ const ProjectOverview = ({ project, columns = 4 }) => {
111113
>
112114
<Box sx={sx.label}>Project type</Box>
113115
</TooltipWrapper>
114-
<Box sx={sx.value}>{project_type ?? <Empty />}</Box>
116+
<Box sx={sx.value}>{project_type ?? <Empty label='N/A' />}</Box>
115117
</Column>
116118

117119
<Column
@@ -149,7 +151,7 @@ const ProjectOverview = ({ project, columns = 4 }) => {
149151
'& svg': { stroke: 'primary' },
150152
}}
151153
>
152-
<Empty label='Unknown' />
154+
<Empty />
153155
</TooltipWrapper>
154156
)}
155157
</Box>
@@ -168,7 +170,7 @@ const ProjectOverview = ({ project, columns = 4 }) => {
168170
<Box sx={sx.label}>Proponent</Box>
169171
</TooltipWrapper>
170172
<Box sx={{ ...sx.value, mr: columns === 4 ? [0, 0, 2, 2] : 0 }}>
171-
{proponent ?? <Empty />}
173+
{proponent ?? <Empty label='N/A' />}
172174
</Box>
173175
</Column>
174176

0 commit comments

Comments
 (0)