Update dashboard widgets (#12068)

- Display loading overlay
- Fix bottom of chart to zero
This commit is contained in:
Oliver 2026-06-02 14:55:27 +10:00 committed by GitHub
parent 1af301173d
commit d3be030486
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import { apiUrl } from '@lib/functions/Api';
import { StylishText } from '@lib/index';
import { t } from '@lingui/core/macro';
import { BarChart } from '@mantine/charts';
import { Stack } from '@mantine/core';
import { Box, LoadingOverlay, Stack } from '@mantine/core';
import { useDocumentVisibility } from '@mantine/hooks';
import { useQuery } from '@tanstack/react-query';
import dayjs from 'dayjs';
@ -84,13 +84,17 @@ function OrderHistoryComponent({
return (
<Stack gap='xs'>
<StylishText size='md'>{title}</StylishText>
<BarChart
h={200}
data={chartData}
dataKey='month'
series={[{ name: 'count', label: t`Completed`, color: 'blue.6' }]}
withYAxis={false}
/>
<Box>
<LoadingOverlay visible={query.isLoading || query.isFetching} />
<BarChart
h={200}
data={chartData}
dataKey='month'
series={[{ name: 'count', label: t`Completed`, color: 'blue.6' }]}
withYAxis={false}
yAxisProps={{ domain: [0, 'auto'] }}
/>
</Box>
</Stack>
);
}