Files
Stirling-PDF/frontend/src/components/tools/shared/FileStatusIndicator.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1023 B
TypeScript
Raw Normal View History

import React from "react";
import { Text } from "@mantine/core";
import { useTranslation } from "react-i18next";
2025-07-16 17:53:50 +01:00
export interface FileStatusIndicatorProps {
selectedFiles?: File[];
placeholder?: string;
}
const FileStatusIndicator = ({
selectedFiles = [],
placeholder,
2025-07-16 17:53:50 +01:00
}: FileStatusIndicatorProps) => {
const { t } = useTranslation();
const defaultPlaceholder = placeholder || t("files.placeholder", "Select a PDF file in the main view to get started");
2025-08-15 14:43:30 +01:00
// Only show content when no files are selected
2025-07-16 17:53:50 +01:00
if (selectedFiles.length === 0) {
return (
<Text size="sm" c="dimmed">
{defaultPlaceholder}
2025-07-16 17:53:50 +01:00
</Text>
);
}
return (
<Text size="sm" c="dimmed" style={{ wordBreak: 'break-word', whiteSpace: 'normal' }}>
✓ {selectedFiles.length === 1 ? t("fileSelected", "Selected: {{filename}}", { filename: selectedFiles[0]?.name }) : t("filesSelected", "{{count}} files selected", { count: selectedFiles.length })}
</Text>
);
};
2025-07-16 17:53:50 +01:00
export default FileStatusIndicator;