Add genlocke cumulative graveyard with backend endpoint and UI
Aggregates all fainted encounters across every leg of a genlocke into a
unified graveyard view. Backend serves GET /genlockes/{id}/graveyard with
per-entry leg/game context and summary stats (total deaths, deaths per
leg, deadliest leg). Frontend adds a toggle button on the genlocke detail
page that reveals a filterable/sortable grid of grayscale Pokemon cards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Link, useParams } from 'react-router-dom'
|
||||
import { useGenlocke } from '../hooks/useGenlockes'
|
||||
import { usePokemonFamilies } from '../hooks/usePokemon'
|
||||
import { StatCard, RuleBadges } from '../components'
|
||||
import { GenlockeGraveyard, StatCard, RuleBadges } from '../components'
|
||||
import type { GenlockeLegDetail, RetiredPokemon, RunStatus } from '../types'
|
||||
import { useMemo } from 'react'
|
||||
import { useMemo, useState } from 'react'
|
||||
|
||||
const statusColors: Record<RunStatus, string> = {
|
||||
completed: 'bg-blue-500',
|
||||
@@ -86,6 +86,8 @@ export function GenlockeDetail() {
|
||||
const { data: genlocke, isLoading, error } = useGenlocke(id)
|
||||
const { data: familiesData } = usePokemonFamilies()
|
||||
|
||||
const [showGraveyard, setShowGraveyard] = useState(false)
|
||||
|
||||
const activeLeg = useMemo(() => {
|
||||
if (!genlocke) return null
|
||||
return genlocke.legs.find((l) => l.runStatus === 'active') ?? null
|
||||
@@ -285,9 +287,12 @@ export function GenlockeDetail() {
|
||||
</Link>
|
||||
)}
|
||||
<button
|
||||
disabled
|
||||
className="px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded-lg font-medium cursor-not-allowed"
|
||||
title="Coming soon"
|
||||
onClick={() => setShowGraveyard((v) => !v)}
|
||||
className={`px-4 py-2 rounded-lg font-medium transition-colors ${
|
||||
showGraveyard
|
||||
? 'bg-red-600 text-white hover:bg-red-700'
|
||||
: 'bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600'
|
||||
}`}
|
||||
>
|
||||
Graveyard
|
||||
</button>
|
||||
@@ -300,6 +305,16 @@ export function GenlockeDetail() {
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Graveyard */}
|
||||
{showGraveyard && (
|
||||
<section>
|
||||
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4">
|
||||
Cumulative Graveyard
|
||||
</h2>
|
||||
<GenlockeGraveyard genlockeId={id} />
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user