import { useEffect } from 'react' import { BrowserRouter, Routes, Route, NavLink, useNavigate } from 'react-router-dom' import { LayoutDashboard, PlusSquare, TrendingUp, BarChart2, Settings } from 'lucide-react' import { ProfileProvider, useProfile } from './context/ProfileContext' import { AuthProvider, useAuth } from './context/AuthContext' import { setProfileId } from './utils/api' import { Avatar } from './pages/ProfileSelect' import SetupScreen from './pages/SetupScreen' import { ResetPassword } from './pages/PasswordRecovery' import LoginScreen from './pages/LoginScreen' import Dashboard from './pages/Dashboard' import CaptureHub from './pages/CaptureHub' import WeightScreen from './pages/WeightScreen' import CircumScreen from './pages/CircumScreen' import CaliperScreen from './pages/CaliperScreen' import MeasureWizard from './pages/MeasureWizard' import History from './pages/History' import NutritionPage from './pages/NutritionPage' import ActivityPage from './pages/ActivityPage' import Analysis from './pages/Analysis' import SettingsPage from './pages/SettingsPage' import GuidePage from './pages/GuidePage' import './app.css' function Nav() { const links = [ { to:'/', icon:, label:'Übersicht' }, { to:'/capture', icon:, label:'Erfassen' }, { to:'/history', icon:, label:'Verlauf' }, { to:'/analysis', icon:, label:'Analyse' }, { to:'/settings', icon:, label:'Einst.' }, ] return ( ) } function AppShell() { const { session, loading: authLoading, needsSetup } = useAuth() const { activeProfile, loading: profileLoading } = useProfile() const nav = useNavigate() useEffect(()=>{ if (session?.profile_id) { setProfileId(session.profile_id) localStorage.setItem('mitai-jinkendo_active_profile', session.profile_id) } }, [session?.profile_id]) // Handle password reset link const urlParams = new URLSearchParams(window.location.search) const resetToken = urlParams.get('reset-password') || (window.location.pathname === '/reset-password' ? urlParams.get('token') : null) if (resetToken) return (
Mitai Jinkendo
window.location.href='/'}/>
) // Auth loading if (authLoading) return (
) // First run if (needsSetup) return // Need to log in if (!session) return // Profile loading if (profileLoading) return (
) return (
Mitai Jinkendo {activeProfile ? :
}
}/> }/> }/> }/> }/> }/> }/> }/> }/> }/> }/> }/>
) } export default function App() { return ( ) }