Skip to content

Commit

Permalink
handle error state
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane98c committed Jan 4, 2024
1 parent b416de7 commit 3143338
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions components/charts/detail-charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {
}
}
const chartColumn = (isRetired) => {
const categoryKeys = isLoading
? previousCategories
: Object.keys(LABELS.category).filter((l) => Boolean(issued.mapping[l]))
const categoryKeys =
isLoading || error
? previousCategories
: Object.keys(LABELS.category).filter((l) => Boolean(issued.mapping[l]))

return (
<Column
Expand All @@ -61,7 +62,7 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {
mb: 1,
}}
>
{isLoading ? (
{isLoading || error ? (
<Flex sx={{ gap: 2, alignItems: 'center' }}>
<Box
sx={{
Expand All @@ -87,13 +88,14 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {

<Badge
sx={{
color: isLoading ? 'primary' : COLORS[l],
backgroundColor: isLoading ? 'muted' : alpha(COLORS[l], 0.3),
color: isLoading || error ? 'primary' : COLORS[l],
backgroundColor:
isLoading || error ? 'muted' : alpha(COLORS[l], 0.3),
fontSize: 2,
mb: '3px',
}}
>
{isLoading
{isLoading || error
? '-'
: formatValue(
isRetired ? retired.mapping[l] : issued.mapping[l]
Expand Down

0 comments on commit 3143338

Please sign in to comment.