From aaed83d3a025b2f097497c7f2dc98f97d1dbf26a Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Tue, 17 Oct 2023 07:13:41 +0000 Subject: [PATCH] Fix: dashboard card loading states --- src/components/dashboard/card.jsx | 4 ++-- src/pages/dashboard.jsx | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/dashboard/card.jsx b/src/components/dashboard/card.jsx index 0706c09..b2433de 100644 --- a/src/components/dashboard/card.jsx +++ b/src/components/dashboard/card.jsx @@ -2,8 +2,8 @@ import { twMerge } from "tailwind-merge"; import { Skeleton } from "@sliit-foss/bashaway-ui/components"; import { Footnote } from "@sliit-foss/bashaway-ui/typography"; -const DashboardCard = ({ icon: Icon, title, value, className }) => { - if (value === undefined) +const DashboardCard = ({ icon: Icon, title, value, className, loading = false }) => { + if (value === undefined || loading) return ( { const { ghostLegion, toggleGhostLegion } = useGhostLegion(); - const { data: { data: registrationInfo } = {} } = useGetRegistrationInfoQuery({ round, ghostLegion }); - const { data: { data: questionSubmissionInfo } = {} } = useGetQuestionSubmissionsQuery({ round, ghostLegion }); - const { data: { data: teamSubmissionInfo } = {} } = useGetTeamSubmissionsQuery({ round, ghostLegion }); + const { data: { data: registrationInfo } = {}, isFetching: isRegistrationInfoFetching } = useGetRegistrationInfoQuery({ round, ghostLegion }); + const { data: { data: questionSubmissionInfo } = {}, isFetching: isQuestionSubmissionsFetching } = useGetQuestionSubmissionsQuery({ round, ghostLegion }); + const { data: { data: teamSubmissionInfo } = {}, isFetching: isTeamSubmissionsFetching } = useGetTeamSubmissionsQuery({ round, ghostLegion }); useTitle("Dashboard | Bashaway"); @@ -30,15 +30,16 @@ const Dashboard = () => {
- - - - + + + +
Statistics