diff --git a/frontend/src/components/FilePreview.js b/frontend/src/components/FilePreview.js index 1c28193..b4504c9 100644 --- a/frontend/src/components/FilePreview.js +++ b/frontend/src/components/FilePreview.js @@ -19,8 +19,40 @@ export function formatDuration(seconds) { return `${mins}:${secs.toString().padStart(2, '0')}`; } +// Hilfsfunktion zum Überprüfen ob eine Datei ignoriert werden soll +export function shouldIgnoreFile(filename) { + const ignoredFiles = [ + '.DS_Store', // macOS System file + 'Thumbs.db', // Windows Thumbnail cache + 'desktop.ini', // Windows Desktop configuration + '.gitignore', // Git configuration + '.gitkeep', // Git placeholder + 'config.yaml', // Configuration files + 'config.yml', + 'setup.yaml', + 'setup.yml', + '.htaccess', // Apache configuration + 'web.config', // IIS configuration + '.env', // Environment variables + '.env.local', + 'README.md', // Documentation + 'readme.txt', + 'license.txt', + 'LICENSE' + ]; + + return ignoredFiles.some(ignored => + filename.toLowerCase() === ignored.toLowerCase() + ); +} + // Datei-Vorschau-Komponente mit sofortiger Zoom-Skalierung und Loading-State export default function FilePreview({ file, zoom = 1, darkMode = false }) { + // Frühe Rückgabe für ignorierte Dateien + if (shouldIgnoreFile(file.name)) { + return null; + } + const [loaded, setLoaded] = React.useState(false); const width = file.width || 300; const height = file.height || 200; @@ -173,6 +205,10 @@ export default function FilePreview({ file, zoom = 1, darkMode = false }) { ); } + // Sonstige Datei: Prüfen ob ignoriert werden soll + if (shouldIgnoreFile(file.name)) { + return null; // Ignorierte Dateien nicht anzeigen + } // Sonstige Datei: Link return ( {file.name}