Add genlocke list and detail pages
Add GET /genlockes and GET /genlockes/{id} endpoints with aggregate
encounter/death stats per leg, and a frontend list page at /genlockes
plus a detail page at /genlockes/:genlockeId showing progress timeline,
cumulative stats, configuration, retired families, and quick actions.
Update nav link to point to the list page instead of /genlockes/new.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { advanceLeg, createGenlocke, getGamesByRegion } from '../api/genlockes'
|
||||
import { advanceLeg, createGenlocke, getGamesByRegion, getGenlockes, getGenlocke } from '../api/genlockes'
|
||||
import type { CreateGenlockeInput } from '../types/game'
|
||||
|
||||
export function useGenlockes() {
|
||||
return useQuery({
|
||||
queryKey: ['genlockes'],
|
||||
queryFn: getGenlockes,
|
||||
})
|
||||
}
|
||||
|
||||
export function useGenlocke(id: number) {
|
||||
return useQuery({
|
||||
queryKey: ['genlockes', id],
|
||||
queryFn: () => getGenlocke(id),
|
||||
})
|
||||
}
|
||||
|
||||
export function useRegions() {
|
||||
return useQuery({
|
||||
queryKey: ['games', 'by-region'],
|
||||
@@ -15,6 +29,7 @@ export function useCreateGenlocke() {
|
||||
mutationFn: (data: CreateGenlockeInput) => createGenlocke(data),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['runs'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['genlockes'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -26,6 +41,7 @@ export function useAdvanceLeg() {
|
||||
advanceLeg(genlockeId, legOrder),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['runs'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['genlockes'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user