From 90ad03ba56b803a0f69a0be2776ec98807dd4e3b Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 12 Dec 2025 09:35:44 +0100 Subject: [PATCH] allow empty player slots for manual entry --- .../(main)/match/components/TeamSelection.tsx | 19 ++++++++++++++----- src/app/[locale]/(main)/match/page.tsx | 2 +- src/schemas.ts | 6 +++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/[locale]/(main)/match/components/TeamSelection.tsx b/src/app/[locale]/(main)/match/components/TeamSelection.tsx index f9a40f8..c9724dd 100644 --- a/src/app/[locale]/(main)/match/components/TeamSelection.tsx +++ b/src/app/[locale]/(main)/match/components/TeamSelection.tsx @@ -71,15 +71,24 @@ const TeamSelection = ({ name, label, clubOptions, className }: IProps) => { fetchPlayers(); }, [selectedId, name, setTeamsPlayers]); - const playerOptions = - teamsPlayers[name]?.map((player) => ({ + const playerOptions = [ + { + value: { + nrFFE: "", + name: "", + elo: "", + }, + label: "-- EMPTY PLAYER --", + }, + ...(teamsPlayers[name]?.map((player) => ({ value: { nrFFE: player.nrFFE, name: player.name, elo: player.elo, }, label: `${player.name} (${player.elo})`, - })) || []; + })) || []), + ]; return (
@@ -122,7 +131,7 @@ const TeamSelection = ({ name, label, clubOptions, className }: IProps) => { instanceId={`${name}-player-${index}`} options={playerOptions} isSearchable - placeholder="Search player..." + placeholder="Search for a player..." onChange={(option) => selectField.onChange(option?.value)} value={playerOptions.find( (op) => op.value === selectField.value, @@ -152,7 +161,7 @@ const TeamSelection = ({ name, label, clubOptions, className }: IProps) => { teamsPlayers[name]?.length > 0 && (