import { Routes, Route } from 'react-router-dom'; import { ReactElement, useEffect } from 'react'; import Navigation from './Navigation'; import Conversation from './conversation/Conversation'; import About from './About'; import PageNotFound from './PageNotFound'; import { inject } from '@vercel/analytics'; import { useMediaQuery } from './hooks'; import { useState } from 'react'; import Setting from './settings'; import './locale/i18n'; import SharedConversation from './conversation/SharedConversation'; import { useDarkTheme } from './hooks'; inject(); function MainLayout({ children }: { children: ReactElement }) { const { isMobile } = useMediaQuery(); const [navOpen, setNavOpen] = useState(!isMobile); return ( <>
{children}
); } function Layout({ children }: { children: ReactElement }) { return
{children}
; } export default function App() { const [isDarkTheme] = useDarkTheme(); useEffect(() => { localStorage.setItem('selectedTheme', isDarkTheme ? 'Dark' : 'Light'); if (isDarkTheme) { document .getElementById('root') ?.classList.add('dark', 'dark:bg-raisin-black'); } else { document.getElementById('root')?.classList.remove('dark'); } }, [isDarkTheme]); return ( <> } /> } /> } /> } /> {/* default page */} } /> ); }