import React from "react"; import { Text, Anchor } from "@mantine/core"; import { useTranslation } from "react-i18next"; import FolderIcon from '@mui/icons-material/Folder'; import { useFilesModalContext } from "../../../contexts/FilesModalContext"; import { useAllFiles } from "../../../contexts/FileContext"; export interface FileStatusIndicatorProps { selectedFiles?: File[]; placeholder?: string; } const FileStatusIndicator = ({ selectedFiles = [], placeholder, }: FileStatusIndicatorProps) => { const { t } = useTranslation(); const { openFilesModal } = useFilesModalContext(); const { files: workbenchFiles } = useAllFiles(); // Check if there are no files in the workbench if (workbenchFiles.length === 0) { return ( {t("files.noFiles", "No files uploaded. ")}{" "} {t("files.addFiles", "Add files")} ); } // Show selection status when there are files in workbench if (selectedFiles.length === 0) { return ( {t("files.selectFromWorkbench", "Select files from the workbench or ") + " "} {t("files.addFiles", "Add files")} ); } return ( ✓ {selectedFiles.length === 1 ? t("fileSelected", "Selected: {{filename}}", { filename: selectedFiles[0]?.name }) : t("filesSelected", "{{count}} files selected", { count: selectedFiles.length })} ); }; export default FileStatusIndicator;