Skip to content

Commit

Permalink
Merge pull request #107 from SquirrelCorporation/chore-use-custom-loa…
Browse files Browse the repository at this point in the history
…ding-template-main-graph

[CHORE] Update loading state in MainChartCard
  • Loading branch information
SquirrelDeveloper authored Jul 16, 2024
2 parents 3666488 + 19c68fd commit 16597ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions client/src/pages/Dashboard/Components/MainChartCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { LoadingOutlined } from '@ant-design/icons';
import {
Card,
Col,
DatePicker,
Flex,
Row,
Select,
Tabs,
Expand Down Expand Up @@ -83,9 +85,7 @@ const MainChartCard: React.FC<any> = ({}) => {
console.log('fetch data failed', error);
});
}
setTimeout(() => {
setLoading(false);
}, 5000);
setLoading(false);
};

useEffect(() => {
Expand All @@ -96,13 +96,21 @@ const MainChartCard: React.FC<any> = ({}) => {
const config = {
data: graphData,
// Waiting for https://github.com/ant-design/ant-design-charts/issues/2580
//loading: loading,
loading: loading,
animate: { enter: { type: 'waveIn' } },
theme: {
view: {
viewFill: '#151921',
},
},
loadingTemplate: (
<Flex
justify={'center'}
style={{ backgroundColor: '#151921', width: '100%', height: '100%' }}
>
<LoadingOutlined style={{ fontSize: '32px' }} />
</Flex>
),
xField: 'date',
yField: 'value',
colorField: 'name',
Expand Down

0 comments on commit 16597ae

Please sign in to comment.