feat: add admin frontend layout and dashboard

- Add role field to User interface in AuthContext
- Create AdminLayout with responsive sidebar navigation
- Create AdminDashboard with stats cards
- Add admin routes to App.tsx
- Admin panel accessible at /admin
- Shows stats: total users, active subscriptions, pending payments
- Access control: only users with role=admin can access
This commit is contained in:
dwindown
2025-10-11 18:22:42 +07:00
parent e84d4affc6
commit cd6b047d3f
4 changed files with 326 additions and 0 deletions

View File

@@ -6,6 +6,8 @@ import { Login } from './components/pages/Login'
import { Register } from './components/pages/Register'
import { OtpVerification } from './components/pages/OtpVerification'
import { AuthCallback } from './components/pages/AuthCallback'
import { AdminLayout } from './components/admin/AdminLayout'
import { AdminDashboard } from './components/admin/pages/AdminDashboard'
import { Loader2 } from 'lucide-react'
function ProtectedRoute({ children }: { children: React.ReactNode }) {
@@ -59,6 +61,11 @@ export default function App() {
<Route path="/auth/otp" element={<OtpVerification />} />
<Route path="/auth/callback" element={<AuthCallback />} />
{/* Admin Routes */}
<Route path="/admin" element={<ProtectedRoute><AdminLayout /></ProtectedRoute>}>
<Route index element={<AdminDashboard />} />
</Route>
{/* Protected Routes */}
<Route path="/*" element={<ProtectedRoute><Dashboard /></ProtectedRoute>} />
</Routes>