From 9401a8c29dc6c2c35a457c4134a0576df8cd8789 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 23 Nov 2024 21:29:49 +0530 Subject: [PATCH] Corrected the skeleton loading logic --- src/CAREUI/display/Count.tsx | 4 ++-- src/components/Assets/AssetsList.tsx | 8 ++++---- src/components/Facility/DischargedPatientsList.tsx | 6 +++--- src/components/Facility/FacilityList.tsx | 4 ++-- src/components/Facility/FacilityUsers.tsx | 4 ++-- src/components/Patient/ManagePatients.tsx | 4 ++-- src/components/Patient/SampleViewAdmin.tsx | 4 ++-- src/components/Users/ManageUsers.tsx | 6 ++++-- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/CAREUI/display/Count.tsx b/src/CAREUI/display/Count.tsx index 31dde23c711..1f43325d010 100644 --- a/src/CAREUI/display/Count.tsx +++ b/src/CAREUI/display/Count.tsx @@ -3,7 +3,7 @@ import CareIcon, { IconName } from "@/CAREUI/icons/CareIcon"; import { classNames } from "@/Utils/utils"; interface Props { - count: number | null; + count: number; text: string; loading: boolean; icon: IconName; @@ -21,7 +21,7 @@ export default function CountBlock(props: Props) {
{props.text}
- {props.loading || props.count == null ? ( + {props.loading ? (
) : (
diff --git a/src/components/Assets/AssetsList.tsx b/src/components/Assets/AssetsList.tsx index 495fbfc577a..65c41e934f0 100644 --- a/src/components/Assets/AssetsList.tsx +++ b/src/components/Assets/AssetsList.tsx @@ -45,7 +45,7 @@ const AssetsList = () => { const [assets, setAssets] = useState([{} as AssetData]); const [isLoading, setIsLoading] = useState(false); const [isScannerActive, setIsScannerActive] = useState(false); - const [totalCount, setTotalCount] = useState(null); + const [totalCount, setTotalCount] = useState(0); const [facility, setFacility] = useState(); const [status, setStatus] = useState(); const [asset_class, setAssetClass] = useState(); @@ -75,7 +75,7 @@ const AssetsList = () => { onResponse: ({ res, data }) => { if (res?.status === 200 && data) { setAssets(data.results); - setTotalCount(data?.count); + setTotalCount(data.count); } }, }); @@ -370,8 +370,8 @@ const AssetsList = () => {
diff --git a/src/components/Facility/DischargedPatientsList.tsx b/src/components/Facility/DischargedPatientsList.tsx index e082935b12b..8b00f788a97 100644 --- a/src/components/Facility/DischargedPatientsList.tsx +++ b/src/components/Facility/DischargedPatientsList.tsx @@ -214,7 +214,7 @@ const DischargedPatientsList = ({ const [emergency_phone_number, setEmergencyPhoneNumber] = useState(""); const [emergencyPhoneNumberError, setEmergencyPhoneNumberError] = useState(""); - const [count, setCount] = useState(null); + const [count, setCount] = useState(0); const setPhoneNum = (phone_number: string) => { setPhoneNumber(phone_number); @@ -286,8 +286,8 @@ const DischargedPatientsList = ({
diff --git a/src/components/Facility/FacilityList.tsx b/src/components/Facility/FacilityList.tsx index b15136fcc31..eb617a254a3 100644 --- a/src/components/Facility/FacilityList.tsx +++ b/src/components/Facility/FacilityList.tsx @@ -182,8 +182,8 @@ export const FacilityList = () => {
diff --git a/src/components/Facility/FacilityUsers.tsx b/src/components/Facility/FacilityUsers.tsx index c861426ed79..3cb56a59628 100644 --- a/src/components/Facility/FacilityUsers.tsx +++ b/src/components/Facility/FacilityUsers.tsx @@ -276,8 +276,8 @@ export default function FacilityUsers(props: any) { {facilityUserData && ( diff --git a/src/components/Patient/ManagePatients.tsx b/src/components/Patient/ManagePatients.tsx index f114ceeb338..74d50fa8249 100644 --- a/src/components/Patient/ManagePatients.tsx +++ b/src/components/Patient/ManagePatients.tsx @@ -978,8 +978,8 @@ export const PatientManager = () => {
diff --git a/src/components/Patient/SampleViewAdmin.tsx b/src/components/Patient/SampleViewAdmin.tsx index 908cb00fd85..660f38d64fc 100644 --- a/src/components/Patient/SampleViewAdmin.tsx +++ b/src/components/Patient/SampleViewAdmin.tsx @@ -344,8 +344,8 @@ export default function SampleViewAdmin() {
diff --git a/src/components/Users/ManageUsers.tsx b/src/components/Users/ManageUsers.tsx index 2bbfa76a8b0..db539bb21e8 100644 --- a/src/components/Users/ManageUsers.tsx +++ b/src/components/Users/ManageUsers.tsx @@ -552,8 +552,10 @@ export default function ManageUsers() {