bugfix(FIL-04)
This commit is contained in:
parent
82844f0cbe
commit
dc174f570c
2 changed files with 26 additions and 3 deletions
|
|
@ -185,8 +185,8 @@ export interface FormGeneratorTableProps<T = any> {
|
||||||
getRowDataAttributes?: (row: T, index: number) => Record<string, string>;
|
getRowDataAttributes?: (row: T, index: number) => Record<string, string>;
|
||||||
// For passing hook data to action buttons
|
// For passing hook data to action buttons
|
||||||
hookData?: any; // Contains all hook data: refetch, operations, loading states, etc.
|
hookData?: any; // Contains all hook data: refetch, operations, loading states, etc.
|
||||||
// Custom empty message when table is empty
|
// Custom empty message when table is empty (string or custom ReactNode)
|
||||||
emptyMessage?: string;
|
emptyMessage?: React.ReactNode;
|
||||||
// API endpoint for CSV export (e.g. "/api/users/"). If provided, the CSV export button is shown.
|
// API endpoint for CSV export (e.g. "/api/users/"). If provided, the CSV export button is shown.
|
||||||
apiEndpoint?: string;
|
apiEndpoint?: string;
|
||||||
// Grouping configuration
|
// Grouping configuration
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,29 @@ export const FilesPage: React.FC = () => {
|
||||||
}));
|
}));
|
||||||
}, [folders]);
|
}, [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 ───────────────────────────────────────────────────────────
|
// ── Columns ───────────────────────────────────────────────────────────
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const hiddenColumns = ['id', 'fileHash', 'folderId'];
|
const hiddenColumns = ['id', 'fileHash', 'folderId'];
|
||||||
|
|
@ -499,7 +522,7 @@ export const FilesPage: React.FC = () => {
|
||||||
updateOptimistically: updateFileOptimistically,
|
updateOptimistically: updateFileOptimistically,
|
||||||
previewingFiles,
|
previewingFiles,
|
||||||
}}
|
}}
|
||||||
emptyMessage={t('Keine Dateien gefunden')}
|
emptyMessage={emptyTableMessage}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue