import { type FormEvent, useState } from 'react' import type { BossBattle, CreateBossResultInput } from '../types/game' interface BossDefeatModalProps { boss: BossBattle onSubmit: (data: CreateBossResultInput) => void onClose: () => void isPending?: boolean } export function BossDefeatModal({ boss, onSubmit, onClose, isPending }: BossDefeatModalProps) { const [result, setResult] = useState<'won' | 'lost'>('won') const [attempts, setAttempts] = useState('1') const handleSubmit = (e: FormEvent) => { e.preventDefault() onSubmit({ bossBattleId: boss.id, result, attempts: Number(attempts) || 1, }) } return (

Battle: {boss.name}

{boss.location}

{/* Boss team preview */} {boss.pokemon.length > 0 && (
{boss.pokemon .sort((a, b) => a.order - b.order) .map((bp) => (
{bp.pokemon.spriteUrl ? ( {bp.pokemon.name} ) : (
)} {bp.pokemon.name} Lv.{bp.level}
))}
)}
setAttempts(e.target.value)} className="w-full px-3 py-2 border rounded-md dark:bg-gray-700 dark:border-gray-600" />
) }