import { Toaster } from "@/components/ui/sonner"; import { TooltipProvider } from "@/components/ui/tooltip"; import NotFound from "@/pages/NotFound"; import { Route, Switch, Redirect } from "wouter"; import ErrorBoundary from "./components/ErrorBoundary"; import { ThemeProvider } from "./contexts/ThemeContext"; import { LocalAuthProvider, useLocalAuth } from "./contexts/LocalAuthContext"; import { AppLayout } from "./components/AppLayout"; import Login from "./pages/Login"; import VeilleDashboard from "./pages/VeilleDashboard"; import AAPDashboard from "./pages/AAPDashboard"; import Settings from "./pages/Settings"; import UsersAdmin from "./pages/UsersAdmin"; import ImportLogs from "./pages/ImportLogs"; import BoiteAIdees from "@/pages/BoiteAIdees"; import RssFeeds from "@/pages/RssFeeds"; import { Loader2 } from "lucide-react"; // ─── Guard d'authentification ───────────────────────────────────────────────── function AuthGuard({ children }: { children: React.ReactNode }) { const { user, loading } = useLocalAuth(); if (loading) { return (
); } if (!user) { return ; } return <>{children}; } // ─── Layout avec sidebar ────────────────────────────────────────────────────── function DashboardWrapper({ children }: { children: React.ReactNode }) { const { user, logout } = useLocalAuth(); return ( {children} ); } // ─── Pages protégées ────────────────────────────────────────────────────────── function VeillePage() { return ( ); } function AAPPage() { return ( ); } function SettingsPage() { return ( ); } function UsersPage() { return ( ); } function LogsPage() { return ( ); } function BoiteAIdeesPage() { return ( ); } function RssFeedsPage() { return ( ); } // ─── Routeur principal ──────────────────────────────────────────────────────── function Router() { return ( ); } function App() { return ( ); } export default App;