From b89b75e160d3d7c8577c7c476333c9a5d6455c85 Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 29 Dec 2023 10:41:08 +0530 Subject: [PATCH 1/2] Fix empty state in LocationManagement --- src/CAREUI/misc/PaginatedList.tsx | 2 +- src/Components/Facility/LocationManagement.tsx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/CAREUI/misc/PaginatedList.tsx b/src/CAREUI/misc/PaginatedList.tsx index 61c67f97ae2..1487d69e4fa 100644 --- a/src/CAREUI/misc/PaginatedList.tsx +++ b/src/CAREUI/misc/PaginatedList.tsx @@ -130,7 +130,7 @@ interface ItemsProps { const Items = (props: ItemsProps) => { const { loading, items } = useContextualized(); - if (loading) { + if (loading || items.length === 0) { return null; } diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index b7a758c5055..93a08794c82 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -46,14 +46,14 @@ export default function LocationManagement({ facilityId }: Props) { Add New Location - - No locations available - - - - -
+ + No locations available + + + + + className="my-8 grid gap-3 @4xl:grid-cols-2 @6xl:grid-cols-3 @[100rem]:grid-cols-4 lg:mx-8"> {(item) => } From a84e897a326a479b37881ddba9a59cb1e5f65a8b Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:45:10 +0530 Subject: [PATCH 2/2] Refactor BedManagement component --- src/Components/Facility/BedManagement.tsx | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/Components/Facility/BedManagement.tsx b/src/Components/Facility/BedManagement.tsx index 68e9fade43d..d8799f1fbc5 100644 --- a/src/Components/Facility/BedManagement.tsx +++ b/src/Components/Facility/BedManagement.tsx @@ -182,24 +182,22 @@ export const BedManagement = (props: BedManagementProps) => { )); } else if (data?.results.length === 0) { BedList = ( -

+

No beds available in this location

); } - if (data?.results.length) { - bed = ( - <> -
{BedList}
- {data.count && ( -
- -
- )} - - ); - } + bed = ( + <> +
{BedList}
+ {Boolean(data?.count && data.count > 0) && ( +
+ +
+ )} + + ); if (loading) { return ;