import { useEffect } from 'react'; import { NavLink, Navigate, Outlet, useNavigate } from 'react-router-dom'; import { LogOut } from 'lucide-react'; import { cn } from '../lib/cn'; import { useAuth } from '../auth/context'; import { onAuthErrorAll, orderBookingClient } from '../api/clients'; import { APP_ID } from '../api/config'; import { Button } from '../components/buttons'; import { SCREENS } from './tabs'; /** Auth-guarded shell: navy top bar + tab nav + routed . */ export function ConsoleLayout() { const { authed, logout } = useAuth(); const navigate = useNavigate(); const user = orderBookingClient.currentUser(); // A 401 from any workflow client bounces back to login. useEffect(() => { onAuthErrorAll(() => { logout(); navigate('/login', { replace: true }); }); }, [logout, navigate]); if (!authed) return ; return (
Krishna Sales Field Sales ยท Sandbox {APP_ID}
{user?.name && {user.name}}
); }