Files
nuzlocke-tracker/frontend/src/hooks/useGames.ts
Julian Tabel 66b3c9286f Add run dashboard and encounter tracking interface
Run list at /runs shows all runs with status badges. Run dashboard at
/runs/:id displays stats, active team, graveyard, and rule badges.
Encounter tracking at /runs/:runId/encounters shows route list with
status indicators, progress bar, filters, and a modal for logging or
editing encounters with pokemon picker.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 15:28:50 +01:00

33 lines
770 B
TypeScript

import { useQuery } from '@tanstack/react-query'
import { getGames, getGame, getGameRoutes, getRoutePokemon } from '../api/games'
export function useGames() {
return useQuery({
queryKey: ['games'],
queryFn: getGames,
})
}
export function useGame(id: number) {
return useQuery({
queryKey: ['games', id],
queryFn: () => getGame(id),
})
}
export function useGameRoutes(gameId: number | null) {
return useQuery({
queryKey: ['games', gameId, 'routes'],
queryFn: () => getGameRoutes(gameId!),
enabled: gameId !== null,
})
}
export function useRoutePokemon(routeId: number | null) {
return useQuery({
queryKey: ['routes', routeId, 'pokemon'],
queryFn: () => getRoutePokemon(routeId!),
enabled: routeId !== null,
})
}