Skip to content

Commit

Permalink
Remove Locations tab
Browse files Browse the repository at this point in the history
  • Loading branch information
amjithtitus09 committed Mar 4, 2025
1 parent 763db34 commit df5be5e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 41 deletions.
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@
"no_linked_facilities": "No Linked Facilities",
"no_location": "No location assigned",
"no_location_description": "This device is not currently assigned to any location",
"no_locations": "No locations",
"no_locations_available": "No locations available",
"no_locations_found": "No locations found",
"no_log_update_delta": "No changes since previous log update",
Expand Down
5 changes: 0 additions & 5 deletions src/components/ui/sidebar/facility-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ function generateFacilityLinks(
url: `${baseUrl}/patients`,
icon: "d-patient",
},
{
name: t("locations"),
url: `${baseUrl}/locations`,
icon: "d-patient",
},
{
name: t("encounters"),
url: `${baseUrl}/encounters`,
Expand Down
82 changes: 46 additions & 36 deletions src/pages/Facility/locations/LocationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -610,34 +610,36 @@ export default function LocationList({ facilityId }: { facilityId: string }) {
}, [allLocations?.results]);

return (
<div className="flex px-4 space-x-4">
<div className="flex px-4 space-x-4 h-[calc(100vh-4rem)]">
{/* Left sidebar - Location tree */}
<div className="w-64 shadow-lg bg-white rounded-lg hidden md:block">
<div className="p-4">
<h2 className="text-lg font-semibold">{t("locations")}</h2>
</div>
<ScrollArea>
<div className="p-2">
{isLoadingLocations ? (
<div className="p-4">
<CardGridSkeleton count={3} />
</div>
) : (
topLevelLocations.map((location) => (
<LocationTreeNode
key={location.id}
location={location}
selectedLocationId={selectedLocationId}
onSelect={handleLocationSelect}
expandedLocations={expandedLocations}
onToggleExpand={handleToggleExpand}
facilityId={facilityId}
/>
))
)}
{topLevelLocations.length > 0 && (
<div className="w-64 shadow-lg bg-white rounded-lg hidden md:block">
<div className="p-4">
<h2 className="text-lg font-semibold">{t("locations")}</h2>
</div>
</ScrollArea>
</div>
<ScrollArea>
<div className="p-2">
{isLoadingLocations ? (
<div className="p-4">
<CardGridSkeleton count={3} />
</div>
) : (
topLevelLocations.map((location) => (
<LocationTreeNode
key={location.id}
location={location}
selectedLocationId={selectedLocationId}
onSelect={handleLocationSelect}
expandedLocations={expandedLocations}
onToggleExpand={handleToggleExpand}
facilityId={facilityId}
/>
))
)}
</div>
</ScrollArea>
</div>
)}

{/* Main content area */}
<div className="flex-1 p-6 space-y-4 rounded-lg bg-white shadow-lg">
Expand Down Expand Up @@ -690,16 +692,24 @@ export default function LocationList({ facilityId }: { facilityId: string }) {
</div>
) : (
<>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{topLevelLocations.map((location) => (
<ChildLocationCard
key={location.id}
location={location}
onClick={() => handleLocationSelect(location)}
facilityId={facilityId}
/>
))}
</div>
{topLevelLocations.length === 0 ? (
<Card className="col-span-full">
<CardContent className="p-6 text-center text-gray-500">
{t("no_locations")}
</CardContent>
</Card>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{topLevelLocations.map((location) => (
<ChildLocationCard
key={location.id}
location={location}
onClick={() => handleLocationSelect(location)}
facilityId={facilityId}
/>
))}
</div>
)}
</>
)}
</div>
Expand Down

0 comments on commit df5be5e

Please sign in to comment.