import React, { useMemo } from 'react' import ArtworkBreadcrumbs from './ArtworkBreadcrumbs' function formatCount(value) { const number = Number(value || 0) if (number >= 1_000_000) return `${(number / 1_000_000).toFixed(1).replace(/\.0$/, '')}M` if (number >= 1_000) return `${(number / 1_000).toFixed(1).replace(/\.0$/, '')}k` return `${number}` } function formatDate(value) { if (!value) return '—' try { return new Date(value).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }) } catch { return '—' } } export default function ArtworkDetailsDrawer({ isOpen, onClose, artwork, stats }) { const width = artwork?.dimensions?.width || artwork?.width || 0 const height = artwork?.dimensions?.height || artwork?.height || 0 const fileType = useMemo(() => { const mime = artwork?.file?.mime_type || artwork?.mime_type || '' if (mime) return mime const url = artwork?.file?.url || artwork?.thumbs?.xl?.url || '' const ext = url.split('.').pop() return ext ? ext.toUpperCase() : '—' }, [artwork]) if (!isOpen) return null return (