Integrate name suggestions into encounter registration UI
Add clickable suggestion chips below the nickname input in the encounter
modal. Chips are fetched from GET /runs/{id}/name-suggestions via React
Query, shown only when a naming scheme is set. Clicking a chip fills in
the nickname; a regenerate button fetches a fresh random batch. Completes
the Name Generation epic.
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 { toast } from 'sonner'
|
||||
import { getRuns, getRun, createRun, updateRun, deleteRun, getNamingCategories } from '../api/runs'
|
||||
import { getRuns, getRun, createRun, updateRun, deleteRun, getNamingCategories, getNameSuggestions } from '../api/runs'
|
||||
import type { CreateRunInput, UpdateRunInput } from '../types/game'
|
||||
|
||||
export function useRuns() {
|
||||
@@ -59,3 +59,11 @@ export function useNamingCategories() {
|
||||
staleTime: Infinity,
|
||||
})
|
||||
}
|
||||
|
||||
export function useNameSuggestions(runId: number | null) {
|
||||
return useQuery({
|
||||
queryKey: ['name-suggestions', runId],
|
||||
queryFn: () => getNameSuggestions(runId!),
|
||||
enabled: runId !== null,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user