better file previews
This commit is contained in:
@@ -1,28 +1,41 @@
|
||||
export function getFileIcon(fileType: string) {
|
||||
if (fileType.startsWith('image/')) {
|
||||
export function getFileIcon(mimeType: string | null) {
|
||||
if (mimeType == null) {
|
||||
return 'lucide:folder';
|
||||
}
|
||||
|
||||
if (mimeType.startsWith('image/')) {
|
||||
return 'lucide:file-image';
|
||||
}
|
||||
|
||||
if (fileType.startsWith('video/')) {
|
||||
if (mimeType.startsWith('video/')) {
|
||||
return 'lucide:file-video-2';
|
||||
}
|
||||
|
||||
if (fileType.startsWith('audio/')) {
|
||||
if (mimeType.startsWith('audio/')) {
|
||||
return 'lucide:file-audio-2';
|
||||
}
|
||||
|
||||
if (fileType.startsWith('application/')) {
|
||||
if (fileType === 'application/x-msdownload') {
|
||||
if (mimeType.startsWith('application/')) {
|
||||
if (mimeType === 'application/x-msdownload') {
|
||||
return 'lucide:file-box';
|
||||
}
|
||||
if (fileType === 'application/json') {
|
||||
if (mimeType === 'application/json') {
|
||||
return 'lucide:file-json';
|
||||
}
|
||||
if (fileType === 'application/pdf') {
|
||||
if (mimeType === 'application/pdf') {
|
||||
return 'lucide:file-text';
|
||||
}
|
||||
if (mimeType === 'application/zip') {
|
||||
return 'lucide:file-archive';
|
||||
}
|
||||
if (
|
||||
mimeType === 'application/epub+zip' ||
|
||||
mimeType === 'application/x-mobipocket-ebook'
|
||||
) {
|
||||
return 'lucide:file-text';
|
||||
}
|
||||
}
|
||||
if (fileType === 'text/html') {
|
||||
if (mimeType === 'text/html') {
|
||||
return 'lucide:file-code';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user