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:
parent
0040e078d8
commit
cda578d0ac
1 changed files with 7 additions and 1 deletions
|
|
@ -46,12 +46,18 @@ interface BatchResultEntryProps {
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
sportsSeasonId: string;
|
sportsSeasonId: string;
|
||||||
existingResultParticipantIds: Set<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({
|
export function BatchResultEntry({
|
||||||
participants,
|
participants,
|
||||||
sportsSeasonId,
|
sportsSeasonId,
|
||||||
existingResultParticipantIds,
|
existingResultParticipantIds,
|
||||||
|
intent = "batch-add-results",
|
||||||
}: BatchResultEntryProps) {
|
}: BatchResultEntryProps) {
|
||||||
const [stage, setStage] = useState<Stage>("idle");
|
const [stage, setStage] = useState<Stage>("idle");
|
||||||
const [pasteText, setPasteText] = useState("");
|
const [pasteText, setPasteText] = useState("");
|
||||||
|
|
@ -172,7 +178,7 @@ export function BatchResultEntry({
|
||||||
placement: r.placement,
|
placement: r.placement,
|
||||||
}));
|
}));
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.set("intent", "batch-add-results");
|
formData.set("intent", intent);
|
||||||
formData.set("results", JSON.stringify(results));
|
formData.set("results", JSON.stringify(results));
|
||||||
saveFetcher.submit(formData, { method: "post" });
|
saveFetcher.submit(formData, { method: "post" });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue