import { Alert, Badge, Button, Divider, Group, Progress, Skeleton, Stack, Text, Tooltip, } from '@mantine/core'; import { IconAlertCircle, IconCalendarClock, IconDatabase } from '@tabler/icons-react'; import { __, sprintf } from '@wordpress/i18n'; import useSWR from 'swr'; import { post } from '../utils/post'; type Data = { name: string; count: string; value: number; color: string; }; function formatBytes(bytes: number): string { if (bytes === 0) { return '0 B'; } const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1); return `${Number.parseFloat((bytes / k ** i).toFixed(1))} ${sizes[i]}`; } function ProgressBar({ label, count, data, itemLabel, }: { label: string; count: number; data: Data[]; itemLabel: string; }) { return (