2026-02-09 09:47:28 +01:00
|
|
|
import type { RunStatus, RunGenlockeContext } from '../types'
|
2026-02-07 13:12:56 +01:00
|
|
|
|
|
|
|
|
interface EndRunModalProps {
|
|
|
|
|
onConfirm: (status: RunStatus) => void
|
|
|
|
|
onClose: () => void
|
|
|
|
|
isPending?: boolean
|
2026-02-09 09:47:28 +01:00
|
|
|
genlockeContext?: RunGenlockeContext | null
|
2026-02-07 13:12:56 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-16 20:39:41 +01:00
|
|
|
export function EndRunModal({ onConfirm, onClose, isPending, genlockeContext }: EndRunModalProps) {
|
2026-02-09 09:47:28 +01:00
|
|
|
const victoryDescription = genlockeContext
|
|
|
|
|
? genlockeContext.isFinalLeg
|
|
|
|
|
? 'Complete the final leg of your genlocke!'
|
|
|
|
|
: 'Complete this leg and continue your genlocke'
|
|
|
|
|
: 'Beat the game successfully'
|
|
|
|
|
|
|
|
|
|
const defeatDescription = genlockeContext
|
|
|
|
|
? 'This will end the entire genlocke'
|
|
|
|
|
: 'All Pokemon fainted or gave up'
|
|
|
|
|
|
2026-02-07 13:12:56 +01:00
|
|
|
return (
|
|
|
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
|
|
|
<div className="fixed inset-0 bg-black/50" onClick={onClose} />
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="relative bg-surface-1 rounded-lg shadow-xl max-w-md w-full mx-4">
|
|
|
|
|
<div className="px-6 py-4 border-b border-border-default">
|
2026-02-07 13:12:56 +01:00
|
|
|
<h2 className="text-lg font-semibold">End Run</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="px-6 py-6">
|
2026-02-17 20:48:42 +01:00
|
|
|
<p className="text-text-tertiary mb-6">How did your run end?</p>
|
2026-02-07 13:12:56 +01:00
|
|
|
<div className="flex flex-col gap-3">
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => onConfirm('completed')}
|
|
|
|
|
disabled={isPending}
|
|
|
|
|
className="w-full px-4 py-3 rounded-lg font-medium text-left border-2 border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 hover:border-blue-400 dark:hover:border-blue-600 disabled:opacity-50 transition-colors"
|
|
|
|
|
>
|
|
|
|
|
<div className="font-semibold">Victory</div>
|
2026-02-09 09:47:28 +01:00
|
|
|
<div className="text-sm opacity-80">{victoryDescription}</div>
|
2026-02-07 13:12:56 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => onConfirm('failed')}
|
|
|
|
|
disabled={isPending}
|
2026-02-17 20:48:42 +01:00
|
|
|
className="w-full px-4 py-3 rounded-lg font-medium text-left border-2 border-red-200 dark:border-red-800 bg-status-failed-bg text-red-700 dark:text-red-300 hover:border-red-400 dark:hover:border-red-600 disabled:opacity-50 transition-colors"
|
2026-02-07 13:12:56 +01:00
|
|
|
>
|
|
|
|
|
<div className="font-semibold">Defeat</div>
|
2026-02-09 09:47:28 +01:00
|
|
|
<div className="text-sm opacity-80">{defeatDescription}</div>
|
2026-02-07 13:12:56 +01:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="px-6 py-4 border-t border-border-default flex justify-end">
|
2026-02-07 13:12:56 +01:00
|
|
|
<button
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
disabled={isPending}
|
2026-02-17 20:48:42 +01:00
|
|
|
className="px-4 py-2 text-sm font-medium rounded-md border border-border-default hover:bg-surface-2"
|
2026-02-07 13:12:56 +01:00
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|