Add genlocke transfer UI with transfer selection modal and backend support
When advancing to the next genlocke leg, users can now select surviving Pokemon to transfer. Transferred Pokemon are bred down to their base evolutionary form and appear as level-1 egg encounters in the next leg. A GenlockeTransfer record links source and target encounters for lineage tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { advanceLeg, createGenlocke, getGamesByRegion, getGenlockes, getGenlocke, getGenlockeGraveyard } from '../api/genlockes'
|
||||
import type { CreateGenlockeInput } from '../types/game'
|
||||
import { advanceLeg, createGenlocke, getGamesByRegion, getGenlockes, getGenlocke, getGenlockeGraveyard, getLegSurvivors } from '../api/genlockes'
|
||||
import type { AdvanceLegInput, CreateGenlockeInput } from '../types/game'
|
||||
|
||||
export function useGenlockes() {
|
||||
return useQuery({
|
||||
@@ -41,11 +41,19 @@ export function useCreateGenlocke() {
|
||||
})
|
||||
}
|
||||
|
||||
export function useLegSurvivors(genlockeId: number, legOrder: number, enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: ['genlockes', genlockeId, 'legs', legOrder, 'survivors'],
|
||||
queryFn: () => getLegSurvivors(genlockeId, legOrder),
|
||||
enabled,
|
||||
})
|
||||
}
|
||||
|
||||
export function useAdvanceLeg() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: ({ genlockeId, legOrder }: { genlockeId: number; legOrder: number }) =>
|
||||
advanceLeg(genlockeId, legOrder),
|
||||
mutationFn: ({ genlockeId, legOrder, transferEncounterIds }: { genlockeId: number; legOrder: number; transferEncounterIds?: number[] }) =>
|
||||
advanceLeg(genlockeId, legOrder, transferEncounterIds ? { transferEncounterIds } : undefined),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['runs'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['genlockes'] })
|
||||
|
||||
Reference in New Issue
Block a user