2026-07-29 13:48:38 -07:00
|
|
|
import {HStack, Flex, Box, useRecipe} from "@chakra-ui/react";
|
|
|
|
|
import {NavLink, Outlet, useLocation} from "react-router-dom";
|
|
|
|
|
import {SearchBar} from "../../components/dashboard/SearchBar.jsx";
|
|
|
|
|
import {SettingsButton} from "../../components/dashboard/SettingsButton.jsx";
|
|
|
|
|
|
|
|
|
|
// 1. Import your icons (Swap these for whichever you prefer!)
|
|
|
|
|
import {LayoutDashboard, CalendarDays, Cloud, Satellite, Activity} from "lucide-react";
|
|
|
|
|
|
|
|
|
|
// 2. Define the tabs array
|
|
|
|
|
const HOME_TABS = [
|
|
|
|
|
{name: "My Dashboard", url: "/home", icon: LayoutDashboard, exact: true},
|
|
|
|
|
{name: "Daily Activity", url: "/home/daily", icon: CalendarDays},
|
|
|
|
|
{name: "Gas", url: "/home/gas", icon: Cloud},
|
|
|
|
|
{name: "Remote Sensing", url: "/home/remote", icon: Satellite},
|
|
|
|
|
{name: "Seismic", url: "/home/seismic", icon: Activity},
|
|
|
|
|
];
|
2025-08-06 16:27:08 -07:00
|
|
|
|
2026-06-04 15:30:01 -07:00
|
|
|
export default function Home() {
|
2026-07-29 13:48:38 -07:00
|
|
|
const recipe = useRecipe({key: "glassTab"});
|
|
|
|
|
const tabStyles = recipe();
|
|
|
|
|
|
2026-06-08 15:57:40 -07:00
|
|
|
const location = useLocation();
|
|
|
|
|
const isPersonalDashboard = location.pathname === "/home" || location.pathname === "/home/";
|
2026-06-04 15:30:01 -07:00
|
|
|
|
2025-07-24 08:52:20 -07:00
|
|
|
return (
|
2026-07-29 13:48:38 -07:00
|
|
|
<Flex direction="column" height="100%" width="100%">
|
2026-06-08 15:57:40 -07:00
|
|
|
|
2026-07-29 13:48:38 -07:00
|
|
|
<Flex as="header" position="sticky" top="0" zIndex="dropdown" bg="transparent" p={5} align="center"
|
|
|
|
|
justify="space-between" width="100%">
|
2026-06-08 15:57:40 -07:00
|
|
|
|
2026-07-29 13:48:38 -07:00
|
|
|
{/* TABS CONTAINER */}
|
|
|
|
|
<Flex gap={2} alignItems="center">
|
|
|
|
|
{HOME_TABS.map((tab) => {
|
|
|
|
|
const Icon = tab.icon;
|
|
|
|
|
return (
|
|
|
|
|
<Box
|
|
|
|
|
key={tab.name}
|
|
|
|
|
as={NavLink}
|
|
|
|
|
to={tab.url}
|
|
|
|
|
end={tab.exact} // CRITICAL: Forces exact match so "/home" deactivates on sub-routes
|
|
|
|
|
css={tabStyles}
|
|
|
|
|
>
|
|
|
|
|
{/* flexShrink: 0 ensures the icon never squishes during the gooey animation */}
|
|
|
|
|
<Icon size={24} style={{flexShrink: 0}}/>
|
|
|
|
|
<Box as="span">{tab.name}</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2026-06-08 15:57:40 -07:00
|
|
|
|
2026-07-29 13:48:38 -07:00
|
|
|
{/* The Settings button is now inline with the tabs and only renders on the personal dashboard */}
|
|
|
|
|
{isPersonalDashboard && <SettingsButton/>}
|
2026-06-08 15:57:40 -07:00
|
|
|
|
|
|
|
|
</Flex>
|
|
|
|
|
|
2026-07-29 13:48:38 -07:00
|
|
|
{/* EDIT MODE BUTTONS & CONTROLS */}
|
|
|
|
|
{/* Leaving this HStack here in case you plan to put the SearchBar or other global tools back on the right side */}
|
|
|
|
|
<HStack width="258px" justifyContent="flex-end">
|
|
|
|
|
{/* Future global controls go here */}
|
|
|
|
|
</HStack>
|
2026-06-04 15:30:01 -07:00
|
|
|
|
2025-07-24 08:52:20 -07:00
|
|
|
</Flex>
|
2026-07-29 13:48:38 -07:00
|
|
|
|
|
|
|
|
<Flex flex="1" overflow="auto">
|
|
|
|
|
<Outlet/>
|
|
|
|
|
</Flex>
|
|
|
|
|
|
|
|
|
|
</Flex>
|
2025-07-24 08:52:20 -07:00
|
|
|
);
|
|
|
|
|
}
|