feat(BatchResultEntry): make form intent configurable

Canonical tournament admin page will submit with a different intent
(batch-upsert-results). Existing per-window callers continue to get
"batch-add-results" as the default, so no behavior changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Chris Parsons 2026-05-01 21:27:42 +00:00
parent 0040e078d8
commit cda578d0ac
No known key found for this signature in database

View file

@ -46,12 +46,18 @@ interface BatchResultEntryProps {
participants: Participant[];
sportsSeasonId: string;
existingResultParticipantIds: Set<string>;
/**
* Form intent name posted on "Save All". Defaults to "batch-add-results" for
* the existing per-window flow. Canonical tournament pages override this.
*/
intent?: string;
}
export function BatchResultEntry({
participants,
sportsSeasonId,
existingResultParticipantIds,
intent = "batch-add-results",
}: BatchResultEntryProps) {
const [stage, setStage] = useState<Stage>("idle");
const [pasteText, setPasteText] = useState("");
@ -172,7 +178,7 @@ export function BatchResultEntry({
placement: r.placement,
}));
const formData = new FormData();
formData.set("intent", "batch-add-results");
formData.set("intent", intent);
formData.set("results", JSON.stringify(results));
saveFetcher.submit(formData, { method: "post" });
}