import { useQuery } from 'react-query'; import { Users, Building, Code, Database, Activity, HardDrive, } from 'lucide-react'; import apiService from '@/services/api'; import type { DashboardStats } from '@/types'; const StatCard = ({ title, value, icon: Icon, change, changeType }: any) => (
{title}
{value}
{change && (
{changeType === 'increase' ? '↑' : '↓'} {change}
)}
); export default function DashboardStatsComponent() { const { data: stats, isLoading } = useQuery( 'dashboard-stats', () => apiService.getDashboardStats(), { refetchInterval: 30000, // Refetch every 30 seconds } ); if (isLoading) { return (
{[...Array(4)].map((_, i) => (
))}
); } return (
); }