import React from "react"; import { Card, Group, Text, Button, Progress } from "@mantine/core"; import { useTranslation } from "react-i18next"; import StorageIcon from "@mui/icons-material/Storage"; import DeleteIcon from "@mui/icons-material/Delete"; import { StorageStats } from "../services/fileStorage"; import { formatFileSize } from "../utils/fileUtils"; import { getStorageUsagePercent } from "../utils/storageUtils"; interface StorageStatsCardProps { storageStats: StorageStats | null; filesCount: number; onClearAll: () => void; onReloadFiles: () => void; } const StorageStatsCard: React.FC = ({ storageStats, filesCount, onClearAll, onReloadFiles, }) => { const { t } = useTranslation(); if (!storageStats) return null; const storageUsagePercent = getStorageUsagePercent(storageStats); return (
{t("fileManager.storage", "Storage")}: {formatFileSize(storageStats.used)} {storageStats.quota && ` / ${formatFileSize(storageStats.quota)}`} {storageStats.quota && ( 80 ? "red" : storageUsagePercent > 60 ? "yellow" : "blue"} size="sm" mt={4} /> )} {storageStats.fileCount} {t("fileManager.filesStored", "files stored")}
{filesCount > 0 && ( )}
); }; export default StorageStatsCard;