import 'leaflet/dist/leaflet.css';
import {useEffect} from 'react';
import {Routes, Route, Navigate, Outlet} from 'react-router-dom';
import {useRecipe, Grid, GridItem, useDialog, Flex, Heading} from "@chakra-ui/react";
// --- NEW AUTH IMPORTS ---
import useAuthStore from './store/authStore';
import ProtectedRoute from './components/layout/ProtectedRoute.jsx';
// Pages & Components
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";
import Settings from "./pages/auth/Settings.jsx";
import WebAdmin from "./pages/auth/WebAdmin.jsx";
import DataExplorer from "@/pages/data_explorer/DataExplorer.jsx";
export default function App() {
// 1. Pull the initialization function from Zustand
const checkAuth = useAuthStore((state) => state.checkAuth);
// 2. Ping Django to verify the HttpOnly cookie the moment the app boots
useEffect(() => {
checkAuth();
}, [checkAuth]);
return (
{/* --- Public Routes --- */}
}/>
{/* --- Secure Routes --- */}
}>
{/* --- Non-Public Routes (Now completely locked down) --- */}
}>
}>
}/>
}/>
}/>
}/>
}/>
}/>
}/>
}/>
}/>
}/>
{/* --- Redirect Routes --- */}
}/>
);
}
// The fundamental layout of the webpage
function AppFoundation() {
const recipe = useRecipe({key: "dashboard"});
const styles = recipe();
const dialog = useDialog();
return (
<>
>
)
}
// A dummy page that acts as a placeholder for pages that aren't developed yet but are navigatable to
const Placeholder = ({name}) => (
{name} Dashboard - Coming Soon
);