import { Routes, Route, Navigate } from 'react-router-dom' import { useAuthStore } from './store/auth' import Layout from './components/layout/Layout' import PageLoader from './components/common/PageLoader' import Login from './pages/Login' import TelegramCallback from './pages/TelegramCallback' import TelegramRedirect from './pages/TelegramRedirect' import DeepLinkRedirect from './pages/DeepLinkRedirect' import Dashboard from './pages/Dashboard' import Subscription from './pages/Subscription' import Balance from './pages/Balance' import Referral from './pages/Referral' import Support from './pages/Support' import Profile from './pages/Profile' import AdminTickets from './pages/AdminTickets' import AdminSettings from './pages/AdminSettings' import AdminApps from './pages/AdminApps' import VerifyEmail from './pages/VerifyEmail' import Contests from './pages/Contests' import Polls from './pages/Polls' import Info from './pages/Info' import Wheel from './pages/Wheel' import AdminWheel from './pages/AdminWheel' import AdminTariffs from './pages/AdminTariffs' import AdminServers from './pages/AdminServers' import AdminPanel from './pages/AdminPanel' import AdminDashboard from './pages/AdminDashboard' function ProtectedRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated, isLoading } = useAuthStore() if (isLoading) { return } if (!isAuthenticated) { return } return {children} } function AdminRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated, isLoading, isAdmin } = useAuthStore() if (isLoading) { return } if (!isAuthenticated) { return } if (!isAdmin) { return } return {children} } function App() { return ( {/* Public routes */} } /> } /> } /> } /> } /> } /> } /> {/* Protected routes */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Admin routes */} } /> } /> } /> } /> } /> } /> } /> } /> {/* Catch all */} } /> ) } export default App