"use client"; import { useState, useEffect } from "react"; import SideNav from "@/app/(admin)/_components/side-nav"; import { Users, UserCheck, Calendar, CalendarCheck, CalendarX, DollarSign, TrendingUp, Search, Bell, } from "lucide-react"; interface DashboardStats { total_users: number; active_users: number; total_bookings: number; upcoming_bookings: number; completed_bookings: number; cancelled_bookings: number; total_revenue: number; monthly_revenue: number; } export default function Dashboard() { const [stats, setStats] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { // Simulate API call const fetchStats = async () => { setLoading(true); // Simulate network delay await new Promise((resolve) => setTimeout(resolve, 500)); // Mock API response const mockData: DashboardStats = { total_users: 3, active_users: 3, total_bookings: 6, upcoming_bookings: 6, completed_bookings: 0, cancelled_bookings: 0, total_revenue: 0, monthly_revenue: 0, }; setStats(mockData); setLoading(false); }; fetchStats(); }, []); const statCards = [ { title: "Total Users", value: stats?.total_users ?? 0, icon: Users, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, { title: "Active Users", value: stats?.active_users ?? 0, icon: UserCheck, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, { title: "Total Bookings", value: stats?.total_bookings ?? 0, icon: Calendar, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, { title: "Upcoming Bookings", value: stats?.upcoming_bookings ?? 0, icon: CalendarCheck, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, { title: "Completed Bookings", value: stats?.completed_bookings ?? 0, icon: CalendarCheck, bgColor: "bg-gray-50", iconColor: "text-green-600", }, { title: "Cancelled Bookings", value: stats?.cancelled_bookings ?? 0, icon: CalendarX, bgColor: "bg-gray-50", iconColor: "text-red-600", }, { title: "Total Revenue", value: `$${stats?.total_revenue.toLocaleString() ?? 0}`, icon: DollarSign, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, { title: "Monthly Revenue", value: `$${stats?.monthly_revenue.toLocaleString() ?? 0}`, icon: TrendingUp, bgColor: "bg-gray-50", iconColor: "text-gray-600", }, ]; return (
{/* Side Navigation */}
{/* Top Header Bar */}
{/* Main Content */}
{/* Page Header */}

Dashboard

Overview of your practice statistics

{loading ? (
) : (
{statCards.map((card, index) => { const Icon = card.icon; return (

{card.title}

{card.value}

); })}
)}
); }