2026-02-05 15:28:50 +01:00
|
|
|
import type { EncounterDetail } from '../types'
|
2026-02-07 21:12:45 +01:00
|
|
|
import { TypeBadge } from './TypeBadge'
|
2026-02-05 15:28:50 +01:00
|
|
|
|
2026-02-16 20:39:41 +01:00
|
|
|
export interface PokemonCardProps {
|
2026-02-05 15:28:50 +01:00
|
|
|
encounter: EncounterDetail
|
2026-02-16 20:39:41 +01:00
|
|
|
showFaintLevel?: boolean | undefined
|
|
|
|
|
onClick?: (() => void) | undefined
|
2026-02-05 15:28:50 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-16 20:39:41 +01:00
|
|
|
export function PokemonCard({ encounter, showFaintLevel, onClick }: PokemonCardProps) {
|
|
|
|
|
const { pokemon, currentPokemon, route, nickname, catchLevel, faintLevel, deathCause } = encounter
|
2026-02-05 15:28:50 +01:00
|
|
|
const isDead = faintLevel !== null
|
2026-02-05 19:26:49 +01:00
|
|
|
const displayPokemon = currentPokemon ?? pokemon
|
|
|
|
|
const isEvolved = currentPokemon !== null
|
2026-02-05 15:28:50 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
2026-02-05 18:36:08 +01:00
|
|
|
onClick={onClick}
|
2026-02-17 20:48:42 +01:00
|
|
|
className={`bg-surface-1 rounded-xl border border-border-default p-4 flex flex-col items-center text-center transition-all ${
|
|
|
|
|
isDead ? 'opacity-50 grayscale' : ''
|
|
|
|
|
} ${onClick ? 'cursor-pointer hover:border-accent-400/30 hover:-translate-y-0.5' : ''}`}
|
2026-02-05 15:28:50 +01:00
|
|
|
>
|
2026-02-05 19:26:49 +01:00
|
|
|
{displayPokemon.spriteUrl ? (
|
2026-02-16 20:39:41 +01:00
|
|
|
<img src={displayPokemon.spriteUrl} alt={displayPokemon.name} className="w-25 h-25" />
|
2026-02-05 15:28:50 +01:00
|
|
|
) : (
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="w-25 h-25 rounded-full bg-surface-3 flex items-center justify-center text-xl font-bold text-text-secondary">
|
2026-02-16 20:39:41 +01:00
|
|
|
{displayPokemon.name[0]?.toUpperCase()}
|
2026-02-05 15:28:50 +01:00
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-02-05 18:36:08 +01:00
|
|
|
<div className="mt-2 flex items-center gap-1.5">
|
|
|
|
|
<span
|
2026-02-17 20:48:42 +01:00
|
|
|
className={`w-2 h-2 rounded-full shrink-0 ${isDead ? 'bg-status-dead' : 'bg-status-alive'}`}
|
2026-02-05 18:36:08 +01:00
|
|
|
/>
|
2026-02-17 20:48:42 +01:00
|
|
|
<span className="font-semibold text-text-primary text-sm">
|
2026-02-05 19:26:49 +01:00
|
|
|
{nickname || displayPokemon.name}
|
2026-02-05 18:36:08 +01:00
|
|
|
</span>
|
2026-02-05 15:28:50 +01:00
|
|
|
</div>
|
2026-02-17 20:48:42 +01:00
|
|
|
{nickname && <div className="text-xs text-text-secondary">{displayPokemon.name}</div>}
|
2026-02-05 15:28:50 +01:00
|
|
|
|
2026-02-07 21:14:03 +01:00
|
|
|
<div className="flex flex-col items-center gap-0.5 mt-1">
|
2026-02-05 19:26:49 +01:00
|
|
|
{displayPokemon.types.map((type) => (
|
2026-02-07 21:12:45 +01:00
|
|
|
<TypeBadge key={type} type={type} />
|
2026-02-05 15:28:50 +01:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="text-xs font-mono text-text-secondary mt-1">
|
2026-02-05 15:28:50 +01:00
|
|
|
{showFaintLevel && isDead
|
|
|
|
|
? `Lv. ${catchLevel} → ${faintLevel}`
|
|
|
|
|
: `Lv. ${catchLevel ?? '?'}`}
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="text-xs text-text-tertiary mt-0.5">{route.name}</div>
|
2026-02-05 18:36:08 +01:00
|
|
|
|
2026-02-05 19:26:49 +01:00
|
|
|
{isEvolved && (
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="text-[10px] text-text-tertiary mt-0.5">Originally: {pokemon.name}</div>
|
2026-02-05 19:26:49 +01:00
|
|
|
)}
|
|
|
|
|
|
2026-02-05 18:36:08 +01:00
|
|
|
{isDead && deathCause && (
|
2026-02-17 20:48:42 +01:00
|
|
|
<div className="text-[10px] italic text-text-tertiary mt-0.5 line-clamp-2">
|
2026-02-05 18:36:08 +01:00
|
|
|
{deathCause}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-05 15:28:50 +01:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|