import React from "react"; import { Group, Text, ActionIcon, Tooltip } from "@mantine/core"; import SelectAllIcon from "@mui/icons-material/SelectAll"; import DeleteIcon from "@mui/icons-material/Delete"; import DownloadIcon from "@mui/icons-material/Download"; import { useTranslation } from "react-i18next"; import { useFileManagerContext } from "../../contexts/FileManagerContext"; const FileActions: React.FC = () => { const { t } = useTranslation(); const { recentFiles, selectedFileIds, filteredFiles, onSelectAll, onDeleteSelected, onDownloadSelected } = useFileManagerContext(); const handleSelectAll = () => { onSelectAll(); }; const handleDeleteSelected = () => { if (selectedFileIds.length > 0) { onDeleteSelected(); } }; const handleDownloadSelected = () => { if (selectedFileIds.length > 0) { onDownloadSelected(); } }; // Only show actions if there are files if (recentFiles.length === 0) { return null; } const allFilesSelected = filteredFiles.length > 0 && selectedFileIds.length === filteredFiles.length; const hasSelection = selectedFileIds.length > 0; return (
{/* Left: Select All */}
{/* Center: Selected count */}
{hasSelection && ( {t("fileManager.selectedCount", "{{count}} selected", { count: selectedFileIds.length })} )}
{/* Right: Delete and Download */}
); }; export default FileActions;