From 8382f7a40ed9ebd0ef4cc6ddfd5220632229993e Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 7 Jan 2024 12:30:34 +0800 Subject: [PATCH] Improve technician widgets loading --- .../Technician/TechnicianWidgets.tsx | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx index 65726b0..b412176 100644 --- a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx +++ b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx @@ -6,7 +6,6 @@ import { UserAPI, TransactionsAPI, } from "../../API/API"; -import CircularProgress from "@mui/material/CircularProgress"; import moment from "moment"; export default function TechnicianWidgets() { @@ -34,24 +33,6 @@ export default function TechnicianWidgets() { }, ], }); - const isLoading = queries.some((result) => result.isLoading); - if (isLoading) { - return ( - <> - -

- Loading widgets... -

- - ); - } return (
{queries[1].data?.filter( (equipment) => equipment.status == "Pending" - ).length || 0} + ).length || "Loading..."}

- {queries[1].data?.length || 0} + {queries[1].data?.length || "Loading..."}

@@ -169,7 +150,7 @@ export default function TechnicianWidgets() { > {queries[1].data?.filter( (equipment) => equipment.status == "Available" - ).length || 0} + ).length || "Loading..."}

{queries[1].data?.filter( (equipment) => equipment.status == "Broken" - ).length || 0} + ).length || "Loading..."}

@@ -249,7 +230,7 @@ export default function TechnicianWidgets() { todayStartOfDay, todayEndOfDay ) - ).length || 0} + ).length || "Loading..."}