'use client' import { useEffect, useRef } from 'react' import type { Game } from '@/types' import TagSelector from '@/components/tags/TagSelector' interface Props { game: Game libraryId: string onClose: () => void } export default function GameDetailModal({ game, libraryId, onClose }: Props) { const overlayRef = useRef(null) useEffect(() => { const handleKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose() } document.addEventListener('keydown', handleKey) document.body.style.overflow = 'hidden' return () => { document.removeEventListener('keydown', handleKey) document.body.style.overflow = '' } }, [onClose]) const handleOverlayClick = (e: React.MouseEvent) => { if (e.target === overlayRef.current) onClose() } const downloadHref = `/api/file?libraryId=${encodeURIComponent(libraryId)}&path=${encodeURIComponent(game.zipPath)}` return (
{/* Close button */} {/* Wide cover / cover hero */}
{game.wideCoverUrl ? ( // eslint-disable-next-line @next/next/no-img-element {`${game.title} ) : game.coverUrl ? ( // eslint-disable-next-line @next/next/no-img-element {`${game.title} ) : (
🎮
)}
{/* Info */}

{game.title}

((e.currentTarget as HTMLElement).style.backgroundColor = 'var(--accent-hover)')} onMouseLeave={(e) => ((e.currentTarget as HTMLElement).style.backgroundColor = 'var(--accent)')} > Download .zip {/* Tags */}

Tags

) }