import './locale/i18n'; import { useState } from 'react'; import { Outlet, Route, Routes } from 'react-router-dom'; import Agents from './agents'; import SharedAgentGate from './agents/SharedAgentGate'; import ActionButtons from './components/ActionButtons'; import Spinner from './components/Spinner'; import UploadToast from './components/UploadToast'; import Conversation from './conversation/Conversation'; import { SharedConversation } from './conversation/SharedConversation'; import { useDarkTheme, useMediaQuery } from './hooks'; import useTokenAuth from './hooks/useTokenAuth'; import Navigation from './Navigation'; import PageNotFound from './PageNotFound'; import Setting from './settings'; import Notification from './components/Notification'; function AuthWrapper({ children }: { children: React.ReactNode }) { const { isAuthLoading } = useTokenAuth(); if (isAuthLoading) { return (
); } return <>{children}; } function MainLayout() { const { isMobile, isTablet } = useMediaQuery(); const [navOpen, setNavOpen] = useState(!(isMobile || isTablet)); return (
); } export default function App() { const [, , componentMounted] = useDarkTheme(); const [showNotification, setShowNotification] = useState(() => { const saved = localStorage.getItem('showNotification'); return saved ? JSON.parse(saved) : true; }); const notificationText = import.meta.env.VITE_NOTIFICATION_TEXT; const notificationLink = import.meta.env.VITE_NOTIFICATION_LINK; if (!componentMounted) { return
; } return (
{notificationLink && notificationText && showNotification && ( { setShowNotification(false); localStorage.setItem('showNotification', 'false'); }} /> )} } > } /> } /> } /> } /> } /> } />
); }