import React from 'react'; import { Card, Row, Col, Statistic, Progress, Alert } from 'antd'; import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, AreaChart, Area } from 'recharts'; import { useSystemData } from '../hooks/useServiceStatus'; const SystemMetrics = () => { const { systemStats, loading, error } = useSystemData(); // Mock data for charts (fallback when services are unavailable) const cpuData = [ { time: '00:00', cpu: 25 }, { time: '04:00', cpu: 30 }, { time: '08:00', cpu: 45 }, { time: '12:00', cpu: 60 }, { time: '16:00', cpu: 55 }, { time: '20:00', cpu: 40 }, { time: '24:00', cpu: 35 } ]; const memoryData = [ { time: '00:00', memory: 2.1 }, { time: '04:00', memory: 2.3 }, { time: '08:00', memory: 2.8 }, { time: '12:00', memory: 3.2 }, { time: '16:00', memory: 3.0 }, { time: '20:00', memory: 2.7 }, { time: '24:00', memory: 2.4 } ]; const networkData = [ { time: '00:00', in: 5, out: 3 }, { time: '04:00', in: 8, out: 4 }, { time: '08:00', in: 15, out: 8 }, { time: '12:00', in: 20, out: 12 }, { time: '16:00', in: 18, out: 10 }, { time: '20:00', in: 12, out: 7 }, { time: '24:00', in: 6, out: 4 } ]; if (loading) { return (
Loading metrics...
); } return (
{error && ( )}
); }; export default SystemMetrics;