"use client"; import { Users, CreditCard, CalendarCheck, TrendingUp, RefreshCw, } from "lucide-react"; import { StatsCard, StatsCardSkeleton } from "@/components/ui/StatsCard"; import { PageHeader } from "@/components/ui/PageHeader"; import { UserManagement } from "@/components/users/UserManagement"; import { AnalyticsDashboard } from "@/components/analytics/AnalyticsDashboard"; import { useDashboardStats } from "@/hooks/use-api"; import { useQueryClient } from "@tanstack/react-query"; import { Button } from "@/components/ui/button"; import { useUser } from "@clerk/nextjs"; import { useSearchParams } from "next/navigation"; import { GymSelector } from "@/components/gym/GymSelector"; export default function Home() { const { user } = useUser(); const searchParams = useSearchParams(); const gymId = searchParams.get("gymId") ?? undefined; const { data: stats, isLoading, refetch, isFetching, } = useDashboardStats(gymId); const queryClient = useQueryClient(); // Get user role from metadata const userRole = (user?.publicMetadata?.role as string) ?? "client"; const handleRefresh = () => { queryClient.invalidateQueries({ queryKey: ["dashboard-stats"] }); queryClient.invalidateQueries({ queryKey: ["analytics"] }); refetch(); }; const formatCurrency = (value: number) => { return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 0, maximumFractionDigits: 0, }).format(value || 0); }; return (
} /> {/* Stats Grid */}
{isLoading ? ( <> ) : ( <> 0 ? "+" : ""}${stats?.revenueGrowth ?? 0}%`} trend={(stats?.revenueGrowth ?? 0) >= 0 ? "up" : "down"} icon={CreditCard} color="purple" /> )}
{/* Main Content Grid */}
{/*
*/} {/*
*/} {/*
*/} {/*

Recent Activity

*/} {/*

*/} {/* Manage and view your users */} {/*

*/} {/*
*/} {/* */} {/*
*/} {/*
*/} {/* Analytics Sidebar */}

Quick Analytics

Overview of your gym metrics

); }