Add pokemon status management with death tracking
Implement status change workflow (alive → dead) with confirmation modal, death cause recording, and visual status indicators on pokemon cards. Includes backend migration for death_cause field and graveyard view on the run dashboard. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import type { EncounterDetail } from '../types'
|
||||
interface PokemonCardProps {
|
||||
encounter: EncounterDetail
|
||||
showFaintLevel?: boolean
|
||||
onClick?: () => void
|
||||
}
|
||||
|
||||
const typeColors: Record<string, string> = {
|
||||
@@ -26,15 +27,16 @@ const typeColors: Record<string, string> = {
|
||||
fairy: 'bg-pink-300',
|
||||
}
|
||||
|
||||
export function PokemonCard({ encounter, showFaintLevel }: PokemonCardProps) {
|
||||
const { pokemon, route, nickname, catchLevel, faintLevel } = encounter
|
||||
export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardProps) {
|
||||
const { pokemon, route, nickname, catchLevel, faintLevel, deathCause } = encounter
|
||||
const isDead = faintLevel !== null
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={onClick}
|
||||
className={`bg-white dark:bg-gray-800 rounded-lg shadow p-4 flex flex-col items-center text-center ${
|
||||
isDead ? 'opacity-60 grayscale' : ''
|
||||
}`}
|
||||
} ${onClick ? 'cursor-pointer hover:ring-2 hover:ring-blue-400 transition-shadow' : ''}`}
|
||||
>
|
||||
{pokemon.spriteUrl ? (
|
||||
<img
|
||||
@@ -48,8 +50,13 @@ export function PokemonCard({ encounter, showFaintLevel }: PokemonCardProps) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-2 font-semibold text-gray-900 dark:text-gray-100 text-sm">
|
||||
{nickname || pokemon.name}
|
||||
<div className="mt-2 flex items-center gap-1.5">
|
||||
<span
|
||||
className={`w-2 h-2 rounded-full shrink-0 ${isDead ? 'bg-red-500' : 'bg-green-500'}`}
|
||||
/>
|
||||
<span className="font-semibold text-gray-900 dark:text-gray-100 text-sm">
|
||||
{nickname || pokemon.name}
|
||||
</span>
|
||||
</div>
|
||||
{nickname && (
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400">
|
||||
@@ -77,6 +84,12 @@ export function PokemonCard({ encounter, showFaintLevel }: PokemonCardProps) {
|
||||
<div className="text-xs text-gray-400 dark:text-gray-500 mt-0.5">
|
||||
{route.name}
|
||||
</div>
|
||||
|
||||
{isDead && deathCause && (
|
||||
<div className="text-[10px] italic text-gray-400 dark:text-gray-500 mt-0.5 line-clamp-2">
|
||||
{deathCause}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user