bugfix(FIL-04)

This commit is contained in:
Ida 2026-04-17 14:41:44 +02:00
parent 82844f0cbe
commit dc174f570c
2 changed files with 26 additions and 3 deletions

View file

@ -185,8 +185,8 @@ export interface FormGeneratorTableProps<T = any> {
getRowDataAttributes?: (row: T, index: number) => Record<string, string>;
// For passing hook data to action buttons
hookData?: any; // Contains all hook data: refetch, operations, loading states, etc.
// Custom empty message when table is empty
emptyMessage?: string;
// Custom empty message when table is empty (string or custom ReactNode)
emptyMessage?: React.ReactNode;
// API endpoint for CSV export (e.g. "/api/users/"). If provided, the CSV export button is shown.
apiEndpoint?: string;
// Grouping configuration

View file

@ -152,6 +152,29 @@ export const FilesPage: React.FC = () => {
}));
}, [folders]);
const selectedFolderName = useMemo(() => {
if (!selectedFolderId) return null;
return folders.find(f => f.id === selectedFolderId)?.name ?? null;
}, [folders, selectedFolderId]);
const emptyTableMessage = useMemo(() => {
if (!selectedFolderId) {
return t('Keine Dateien gefunden');
}
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.35rem', alignItems: 'center' }}>
<div style={{ fontWeight: 600 }}>
{selectedFolderName
? t('Der Ordner „{name}" ist leer.', { name: selectedFolderName })
: t('Dieser Ordner ist leer.')}
</div>
<div style={{ color: 'var(--text-muted, #64748b)' }}>
{t('Lade eine neue Datei hoch oder verschiebe bestehende Dateien hierher.')}
</div>
</div>
);
}, [selectedFolderId, selectedFolderName, t]);
// ── Columns ───────────────────────────────────────────────────────────
const columns = useMemo(() => {
const hiddenColumns = ['id', 'fileHash', 'folderId'];
@ -499,7 +522,7 @@ export const FilesPage: React.FC = () => {
updateOptimistically: updateFileOptimistically,
previewingFiles,
}}
emptyMessage={t('Keine Dateien gefunden')}
emptyMessage={emptyTableMessage}
/>
</div>
</div>