import React, { useEffect, useRef, useState } from 'react' import { createPortal } from 'react-dom' function formatCount(value) { const n = Number(value || 0) if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1).replace(/\.0$/, '')}M` if (n >= 1_000) return `${(n / 1_000).toFixed(1).replace(/\.0$/, '')}k` return `${n}` } /* ── SVG Icons ─────────────────────────────────────────────────────────────── */ function HeartIcon({ filled }) { return filled ? ( ) : ( ) } function BookmarkIcon({ filled }) { return filled ? ( ) : ( ) } function CloudDownIcon() { return ( ) } function DownloadArrowIcon() { return ( ) } function ShareIcon() { return ( ) } function FlagIcon() { return ( ) } /* ── Report Modal ──────────────────────────────────────────────────────────── */ const REPORT_REASONS = [ 'Inappropriate content', 'Copyright violation', 'Spam or misleading', 'Offensive or abusive', ] function ReportModal({ open, onClose, onSubmit, submitting }) { const [selected, setSelected] = useState('') const [details, setDetails] = useState('') const backdropRef = useRef(null) const inputRef = useRef(null) // Reset & focus when opening useEffect(() => { if (open) { setSelected('') setDetails('') const t = setTimeout(() => inputRef.current?.focus(), 80) return () => clearTimeout(t) } }, [open]) // Close on Escape useEffect(() => { if (!open) return const handler = (e) => { if (e.key === 'Escape') onClose() } window.addEventListener('keydown', handler) return () => window.removeEventListener('keydown', handler) }, [open, onClose]) if (!open) return null const trimmedDetails = details.trim() const canSubmit = selected.length > 0 && trimmedDetails.length >= 10 && !submitting const fullReason = `${selected}: ${trimmedDetails}` return createPortal(
{ if (e.target === backdropRef.current) onClose() }} className="fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4" >
{/* Header */}

Report Artwork

{/* Body */}
{/* Step 1 — pick a reason */}
{REPORT_REASONS.map((r) => ( ))}
{/* Step 2 — describe & prove */}