import useSWR from "swr"; import { FiHardDrive } from "react-icons/fi"; import { BiError } from "react-icons/bi"; import { formatBytes } from "utils/stats-helpers"; export default function Disk({ options }) { const { data, error } = useSWR(`/api/widgets/resources?type=disk&target=${options.disk}`, { refreshInterval: 1500, }); if (error || data?.error) { return (
Resources Error
); } if (!data) { return (
- Free - Used
); } return (
{formatBytes(data.drive.freeGb * 1024 * 1024 * 1024)} Free {formatBytes(data.drive.usedGb * 1024 * 1024 * 1024)} Used
); }