import React from "react"; import { BrowserRouter as Router, Routes, Route, Navigate } from "react-router"; import { QueryClientProvider } from "@tanstack/react-query"; import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; import { Toaster } from "@/components/ui/sonner"; import { ThemeProvider } from "@/components/theme-provider"; import AppLayout from "@/components/layout/AppLayout"; import LoginPage from "@/pages/LoginPage"; import ChatPage from "@/pages/ChatPage"; import SettingsPage from "@/pages/SettingsPage"; import NotFoundPage from "@/pages/NotFoundPage"; import { queryClient } from "@/lib/api-client"; import { useAuthStore } from "@/stores/authStore"; import ErrorBoundary from "@/components/common/ErrorBoundary"; import { Home } from "lucide-react"; // Protected Route wrapper const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ children, }) => { const { isAuthenticated } = useAuthStore(); // Enable this when you want to enforce authentication if (!isAuthenticated) { return ; } return <>{children}; }; // Home page component - shows server selection const HomePage: React.FC = () => { return (

Welcome to Concord

Select a server from the sidebar to start chatting, or create a new server

); }; function App() { return (
{/* Auth routes */} } /> {/* Protected routes with layout */} } > {/* Default redirect to home */} } /> {/* Server and channel routes */} } /> } /> {/* Settings */} } /> } /> {/* 404 */} } />
{import.meta.env.DEV === true && } {/* Toast notifications */}
); } export default App;