import { Icon, Stack, Text } from '@chakra-ui/react'; import { createRootRouteWithContext, Link, Outlet } from '@tanstack/react-router'; import React from 'react'; import { Button } from '../components/ui/button'; import { Tooltip } from '../components/ui/tooltip'; import { useAuth } from '../hooks/auth'; import { appName } from '../main'; const TanStackRouterDevtools = process.env.NODE_ENV === 'production' ? () => null // Render nothing in production : React.lazy(() => // Lazy load in development import('@tanstack/router-devtools').then(res => ({ default: res.TanStackRouterDevtools // For Embedded Mode // default: res.TanStackRouterDevtoolsPanel })) ); interface RouterContext { isAuthenticated: boolean; } export const Route = createRootRouteWithContext()({ component: () => { const { isAuthenticated, logout } = useAuth(); return ( [{appName}] {!isAuthenticated ? ( <> ) : ( logout()}> )}
); } });