chore: update frontend configuration

This commit is contained in:
Matthieu
2025-09-26 11:29:47 +02:00
parent b7caa4f552
commit a78938a4d1
64 changed files with 5790 additions and 5129 deletions

View File

@@ -1,24 +1,24 @@
import { getFileIcon } from './fileIcons'
export const getPreviewType = (document) => {
if (!document) return null
if (!document) { return null }
const mime = (document.mimeType || '').toLowerCase()
const path = document.path || ''
const check = (prefix) => mime.startsWith(prefix) || path.startsWith(`data:${prefix}`)
const check = prefix => mime.startsWith(prefix) || path.startsWith(`data:${prefix}`)
if (check('image/')) return 'image'
if (mime === 'application/pdf' || path.startsWith('data:application/pdf')) return 'pdf'
if (check('audio/')) return 'audio'
if (check('video/')) return 'video'
if (check('text/') || mime.includes('json') || mime.includes('xml') || path.startsWith('data:application/json')) return 'text'
if (check('image/')) { return 'image' }
if (mime === 'application/pdf' || path.startsWith('data:application/pdf')) { return 'pdf' }
if (check('audio/')) { return 'audio' }
if (check('video/')) { return 'video' }
if (check('text/') || mime.includes('json') || mime.includes('xml') || path.startsWith('data:application/json')) { return 'text' }
return null
}
export const canPreviewDocument = (document = {}) => !!getPreviewType(document)
export const describeDocument = (document) => {
if (!document) return ''
if (!document) { return '' }
const name = document.filename || document.name || ''
const icon = getFileIcon({ name, mime: document.mimeType })
return icon.label