import React, { useEffect, useState } from 'react' import { Database, Mail, Globe, Lock, Anchor, Clock } from 'lucide-react' import { api } from '../api/client' import { useAuth } from '../contexts/AuthContext' interface Stats { diskUsedMb: number diskLimitMb: number bandwidthUsedMb: number bandwidthLimitMb: number counts: { emailAccounts: number; databases: number; ftpAccounts: number subdomains: number; addonDomains: number; sslCertificates: number; cronJobs: number } limits: { maxEmailAccounts: number; maxDatabases: number; maxFtpAccounts: number maxSubdomains: number; maxAddonDomains: number; maxCronJobs: number } | null } function UsageBar({ used, limit, label }: { used: number; limit: number; label: string }) { const pct = limit === 0 ? 0 : Math.min(100, Math.round((used / limit) * 100)) const color = pct > 90 ? 'bg-red-500' : pct > 70 ? 'bg-amber-500' : 'bg-sky-500' return (
{used}
{limit > 0 &&of {limit}
} {limit === 0 &&unlimited
} ) } export default function Overview() { const { user } = useAuth() const [stats, setStats] = useState{user?.domain}