import React, { useEffect, useMemo, useRef } from 'react' import { AnimatePresence, motion, useReducedMotion } from 'framer-motion' export default function ScreenshotUploader({ title = 'Archive screenshots', description = 'Screenshot requirement placeholder for archive uploads', visible = false, files = [], perFileErrors = [], errors = [], invalid = false, showLooksGood = false, looksGoodText = 'Looks good', onFilesChange, min = 1, max = 5, }) { const inputRef = useRef(null) const prefersReducedMotion = useReducedMotion() const quickTransition = prefersReducedMotion ? { duration: 0 } : { duration: 0.2, ease: 'easeOut' } const previewItems = useMemo(() => files.map((file) => ({ file, url: URL.createObjectURL(file), })), [files]) useEffect(() => { return () => { previewItems.forEach((item) => URL.revokeObjectURL(item.url)) } }, [previewItems]) if (!visible) return null const emitFiles = (fileList, merge = false) => { const incoming = Array.from(fileList || []) const next = merge ? [...files, ...incoming] : incoming if (typeof onFilesChange === 'function') { onFilesChange(next.slice(0, max)) } } const removeAt = (index) => { const next = files.filter((_, idx) => idx !== index) if (typeof onFilesChange === 'function') { onFilesChange(next) } } return (
{/* Intended props: screenshots, minResolution, maxFileSizeMb, required, onChange, onRemove, error */}

{title} (Required)

{Math.min(files.length, max)}/{max} screenshots

{description}

Why we need screenshots

Screenshots provide a visual thumbnail and help AI analysis/moderation before archive contents are published.

Rules: JPG/PNG/WEBP · 1280×720 minimum · 10MB max each · {min} to {max} files.

event.preventDefault()} onDrop={(event) => { event.preventDefault() emitFiles(event.dataTransfer?.files, true) }} >

Drop screenshots here or click to browse

emitFiles(event.target.files, true)} />
{files.length} selected · minimum {min}, maximum {max}
{showLooksGood && (
{looksGoodText}
)} {previewItems.length > 0 && ( )} {errors.length > 0 && ( )} {invalid && (

Continue is blocked until screenshot requirements are valid.

)}
) }