import type { SVGProps } from 'react' import { SUPPORTED_AUDIO_EXTENSIONS, SUPPORTED_VIDEO_EXTENSIONS, } from '@/lib/uploads/utils/validation' export function PdfIcon(props: SVGProps) { return ( PDF ) } export function DocxIcon(props: SVGProps) { return ( ) } export function XlsxIcon(props: SVGProps) { return ( ) } export function CsvIcon(props: SVGProps) { return ( ) } export function TxtIcon(props: SVGProps) { return ( ) } export function PptxIcon(props: SVGProps) { return ( ) } export function AudioIcon(props: SVGProps) { return ( ) } export function VideoIcon(props: SVGProps) { return ( ) } export function HtmlIcon(props: SVGProps) { return ( ) } export function JsonIcon(props: SVGProps) { return ( ) } export function MarkdownIcon(props: SVGProps) { return ( ) } export function DefaultFileIcon(props: SVGProps) { return ( ) } export function getDocumentIcon( mimeType: string, filename: string ): (props: SVGProps) => React.JSX.Element { const extension = filename.split('.').pop()?.toLowerCase() if ( mimeType.startsWith('audio/') || (extension && SUPPORTED_AUDIO_EXTENSIONS.includes(extension as (typeof SUPPORTED_AUDIO_EXTENSIONS)[number])) ) { return AudioIcon } if ( mimeType.startsWith('video/') || (extension && SUPPORTED_VIDEO_EXTENSIONS.includes(extension as (typeof SUPPORTED_VIDEO_EXTENSIONS)[number])) ) { return VideoIcon } if (mimeType === 'application/pdf' || extension === 'pdf') { return PdfIcon } if ( mimeType === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' || mimeType === 'application/msword' || extension === 'docx' || extension === 'doc' ) { return DocxIcon } if ( mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || mimeType === 'application/vnd.ms-excel' || extension === 'xlsx' || extension === 'xls' ) { return XlsxIcon } if (mimeType === 'text/csv' || extension === 'csv') { return CsvIcon } if (mimeType === 'text/plain' || extension === 'txt') { return TxtIcon } if ( mimeType === 'application/vnd.openxmlformats-officedocument.presentationml.presentation' || mimeType === 'application/vnd.ms-powerpoint' || extension === 'pptx' || extension === 'ppt' ) { return PptxIcon } if (mimeType === 'text/html' || extension === 'html' || extension === 'htm') { return HtmlIcon } if (mimeType === 'application/json' || extension === 'json') { return JsonIcon } if (mimeType === 'text/markdown' || extension === 'md' || extension === 'mdx') { return MarkdownIcon } return DefaultFileIcon }