2026-09-09 11:54:24 -07:00
import { HStack , Flex , Box , useRecipe , useSlotRecipe } from "@chakra-ui/react" ;
2026-07-29 13:48:38 -07:00
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-09-09 11:54:24 -07:00
const glassTabsRecipe = useRecipe ({ key : "glassTab" });
const homeRecipe = useSlotRecipe ({ key : "home" });
const glassTabsStyle = glassTabsRecipe ();
const homeStyle = homeRecipe ();
2026-07-29 13:48:38 -07:00
2026-09-09 11:54:24 -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-09-09 11:54:24 -07:00
< Flex css = { homeStyle . root }>
< Flex as = "header" >
2026-07-29 13:48:38 -07:00
{ /* TABS CONTAINER */ }
2026-09-09 11:54:24 -07:00
< Flex >
2026-07-29 13:48:38 -07:00
{ HOME_TABS . map (( tab ) => {
const Icon = tab . icon ;
return (
2026-09-09 11:54:24 -07:00
< Box key = { tab . name } as = { NavLink } to = { tab . url } end = { tab . exact } css = { glassTabsStyle }> { /* CRITICAL: 'end' prop forces exact match so "/home" deactivates on sub-routes*/ }
2026-07-29 13:48:38 -07:00
{ /* 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 >
2025-07-24 08:52:20 -07:00
</ Flex >
2026-07-29 13:48:38 -07:00
2026-09-03 14:07:39 -07:00
{ /* TABS CONTENT */ }
2026-09-09 11:54:24 -07:00
< Flex >
2026-07-29 13:48:38 -07:00
< Outlet />
</ Flex >
</ Flex >
2025-07-24 08:52:20 -07:00
);
}