Skip to content

Commit

Permalink
Fix empty state in LocationManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Dec 29, 2023
1 parent 36fa6e3 commit b89b75e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/CAREUI/misc/PaginatedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ interface ItemsProps<TItem> {
const Items = <TItem extends object>(props: ItemsProps<TItem>) => {
const { loading, items } = useContextualized<TItem>();

if (loading) {
if (loading || items.length === 0) {
return null;
}

Expand Down
14 changes: 7 additions & 7 deletions src/Components/Facility/LocationManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ export default function LocationManagement({ facilityId }: Props) {
Add New Location
</ButtonV2>
</div>
<PaginatedList.WhenEmpty className="flex w-full justify-center border-b border-gray-200 bg-white p-5 text-center text-2xl font-bold text-gray-500">
<span>No locations available</span>
</PaginatedList.WhenEmpty>

<PaginatedList.WhenLoading>
<Loading />
</PaginatedList.WhenLoading>
<div className="w-full @container">
<PaginatedList.WhenEmpty className="flex w-full justify-center border-b border-gray-200 bg-white p-5 text-center text-2xl font-bold text-gray-500">
<span>No locations available</span>
</PaginatedList.WhenEmpty>

<PaginatedList.WhenLoading>
<Loading />
</PaginatedList.WhenLoading>
<PaginatedList.Items<LocationModel> className="my-8 grid gap-3 @4xl:grid-cols-2 @6xl:grid-cols-3 @[100rem]:grid-cols-4 lg:mx-8">
{(item) => <Location {...item} />}
</PaginatedList.Items>
Expand Down

0 comments on commit b89b75e

Please sign in to comment.