import { useEffect } from "react"; import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom"; import { useAuthStore } from "@/store/authStore"; import { useUiStore } from "@/store/uiStore"; import AppShell from "@/components/layout/AppShell"; import LoginPage from "@/pages/auth/Login"; import TwoFactorSetupPage from "@/pages/auth/TwoFactorSetup"; import Dashboard from "@/pages/dashboard/Dashboard"; import AccountList from "@/pages/accounts/AccountList"; import AccountDetail from "@/pages/accounts/AccountDetail"; import TransactionList from "@/pages/transactions/TransactionList"; import TransactionImport from "@/pages/transactions/TransactionImport"; import BudgetPage from "@/pages/budgets/BudgetPage"; import ReportsPage from "@/pages/reports/ReportsPage"; import PortfolioPage from "@/pages/investments/PortfolioPage"; import AssetDetail from "@/pages/investments/AssetDetail"; import PredictionsPage from "@/pages/predictions/PredictionsPage"; import SettingsPage from "@/pages/settings/SettingsPage"; function PrivateRoute({ children }: { children: React.ReactNode }) { const token = useAuthStore((s) => s.token); return token ? <>{children} : ; } export default function App() { const theme = useUiStore((s) => s.theme); // Apply theme class to so CSS variables cascade to body and all children useEffect(() => { const html = document.documentElement; html.classList.forEach(c => { if (c.startsWith("theme-")) html.classList.remove(c); }); html.classList.add(`theme-${theme}`); }, [theme]); return (
} /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } />
); }