'use client' import { useState, useEffect } from 'react' import { useCSFApi } from '@/hooks/use-csf-api' function formatBytes(bytes: number): string { const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] if (bytes === 0) return '0 Bytes' const i = Math.floor(Math.log(bytes) / Math.log(1024)) return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i] } function formatUptime(seconds: number): string { const days = Math.floor(seconds / 86400) const hours = Math.floor((seconds % 86400) / 3600) const minutes = Math.floor((seconds % 3600) / 60) if (days > 0) { return `${days}d ${hours}h ${minutes}m` } else if (hours > 0) { return `${hours}h ${minutes}m` } else { return `${minutes}m` } } interface StatsCardProps { title: string value: string | number subtitle?: string color?: 'blue' | 'green' | 'red' | 'yellow' | 'purple' icon?: React.ReactNode } function StatsCard({ title, value, subtitle, color = 'blue', icon }: StatsCardProps) { const colorClasses = { blue: 'bg-blue-500', green: 'bg-green-500', red: 'bg-red-500', yellow: 'bg-yellow-500', purple: 'bg-purple-500' } return (
{value}
{subtitle &&{subtitle}
}