2025-07-31 14:39:35 -07:00
|
|
|
import 'leaflet/dist/leaflet.css';
|
2026-06-05 12:51:18 -07:00
|
|
|
import { Routes, Route, Navigate, Outlet } from 'react-router-dom';
|
2026-06-08 15:57:40 -07:00
|
|
|
import { useRecipe, Grid, GridItem, useDialog, Flex, Heading } from "@chakra-ui/react";
|
2026-06-04 15:30:01 -07:00
|
|
|
import { createContext } from "react";
|
2026-06-10 14:00:37 -07:00
|
|
|
import Login from "@/pages/auth/Login.jsx";
|
|
|
|
|
import Sidebar from "./components/layout/Sidebar.jsx";
|
|
|
|
|
import DialogPopup from "@/components/dashboard/DialogPopup.jsx";
|
|
|
|
|
import Header from "@/components/layout/Header.jsx";
|
|
|
|
|
import Home from "./pages/home/Home.jsx";
|
|
|
|
|
import RegionalMap from "./pages/maps/RegionalMap.jsx";
|
|
|
|
|
import Volcano from "@/pages/volcano/Volcano.jsx";
|
|
|
|
|
import GlobalMap from "./pages/maps/GlobalMap.jsx";
|
|
|
|
|
import Admin from "./pages/admin/Admin.jsx";
|
|
|
|
|
import MyDashboard from "./pages/home/tabs/MyDashboard.jsx";
|
2025-07-31 14:39:35 -07:00
|
|
|
|
2026-06-05 12:51:18 -07:00
|
|
|
function AppFoundation() {
|
2026-06-04 15:30:01 -07:00
|
|
|
const recipe = useRecipe({ key: "dashboard" });
|
|
|
|
|
const styles = recipe();
|
|
|
|
|
const dialog = useDialog();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<DialogPopup dialog={dialog} />
|
|
|
|
|
<Grid css={styles}
|
|
|
|
|
templateRows="1fr 11fr"
|
|
|
|
|
templateColumns="auto 1fr"
|
|
|
|
|
height="100vh"
|
|
|
|
|
width="100vw"
|
|
|
|
|
>
|
|
|
|
|
<GridItem rowSpan={1} colSpan={2}>
|
|
|
|
|
<Header />
|
|
|
|
|
</GridItem>
|
|
|
|
|
<GridItem colSpan={1}>
|
|
|
|
|
<Sidebar />
|
|
|
|
|
</GridItem>
|
|
|
|
|
<GridItem colSpan={1} width="100%" overflow="auto">
|
2026-06-05 12:51:18 -07:00
|
|
|
<Outlet />
|
2026-06-04 15:30:01 -07:00
|
|
|
</GridItem>
|
|
|
|
|
</Grid>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// function ProtectedRoute({ user, children }) {
|
|
|
|
|
// if (user) return children;
|
|
|
|
|
// else return <Navigate to="/login" replace />;
|
|
|
|
|
// }
|
2026-06-08 15:57:40 -07:00
|
|
|
const Placeholder = ({ name }) => (
|
|
|
|
|
<Flex width="100%" height="100%" align="center" justify="center" bg="gray.50"_dark={{ bg: "gray.900" }}>
|
|
|
|
|
<Heading color="gray.400" _dark={{ bg: "gray.600" }} size="md">{name} Dashboard - Coming Soon</Heading>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
2025-07-08 11:16:51 -07:00
|
|
|
function App() {
|
2026-06-05 11:04:17 -07:00
|
|
|
return (
|
|
|
|
|
<Routes>
|
|
|
|
|
{/*Public Routes*/}
|
|
|
|
|
<Route path="/login" element={<Login />} />
|
|
|
|
|
|
|
|
|
|
{/*Non-Public Routes*/}
|
|
|
|
|
<Route element={<AppFoundation />}>
|
2026-06-08 15:57:40 -07:00
|
|
|
|
|
|
|
|
<Route path="/home" element={<Home />}>
|
|
|
|
|
{/* We use our "pass" component to fill the Outlet until the real pages are built */}
|
2026-06-09 14:06:01 -07:00
|
|
|
<Route index element={<MyDashboard />} />
|
|
|
|
|
<Route path="gas" element={<MyDashboard />} />
|
2026-06-08 15:57:40 -07:00
|
|
|
<Route path="seismic" element={<Placeholder name="Seismic" />} />
|
|
|
|
|
<Route path="remote" element={<Placeholder name="Remote Sensing" />} />
|
|
|
|
|
<Route path="daily" element={<Placeholder name="Daily Activity" />} />
|
|
|
|
|
</Route>
|
|
|
|
|
|
2026-06-05 11:04:17 -07:00
|
|
|
<Route path="/global-map" element={<GlobalMap />} />
|
|
|
|
|
<Route path="/regional-map" element={<RegionalMap />} />
|
|
|
|
|
<Route path="/volcano" element={<Volcano />} />
|
|
|
|
|
<Route path="/admin" element={<Admin />} />
|
|
|
|
|
</Route>
|
|
|
|
|
|
|
|
|
|
{/*Redirect Routes*/}
|
|
|
|
|
<Route path="/" element={<Navigate to="/home" replace />} />
|
2026-06-04 15:30:01 -07:00
|
|
|
</Routes>
|
2025-07-08 11:16:51 -07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-23 14:41:52 -07:00
|
|
|
export default App
|