fix(ui): keep the squad picker off a generic event until asked
This commit is contained in:
1 parent
06c77aaf7c
commit
d2c8ce5ccb
1 file changed
+13
-4
@@ -69,6 +69,7 @@ export function EventForm({ api, orgId, onClose, onCreated }: { api: ApiClient;
|
||||
const [match, setMatch] = useState<SportsFixture | null>(null);
|
||||
/** Generic event (a training): borrow this match's squads without becoming the match. */
|
||||
const [squadMatch, setSquadMatch] = useState<SportsFixture | null>(null);
|
||||
const [showSquad, setShowSquad] = useState(false);
|
||||
const [kind, setKind] = useState<Kind>("match");
|
||||
const [caption, setCaption] = useState("");
|
||||
const fields: readonly (typeof FIELDS)[number][] = kind === "match" ? FIELDS : OTHER_FIELDS;
|
||||
@@ -150,10 +151,18 @@ export function EventForm({ api, orgId, onClose, onCreated }: { api: ApiClient;
|
||||
</div>
|
||||
{kind === "match" && <FixturePicker api={api} match={match} onPick={pick} onClear={() => setMatch(null)} />}
|
||||
{kind === "other" && (
|
||||
<div className="border-b border-line">
|
||||
<p className="px-4 pt-3 text-[11px] text-faint">{t.eventForm.squadFromMatch}</p>
|
||||
<FixturePicker api={api} match={squadMatch} onPick={setSquadMatch} onClear={() => setSquadMatch(null)} />
|
||||
<p className="px-4 pb-2 text-[11px] text-faint">{t.eventForm.squadFromMatchHelp}</p>
|
||||
<div className="border-b border-line px-4 py-3">
|
||||
{!showSquad && !squadMatch ? (
|
||||
<button type="button" className="text-[12px] text-accent hover:underline" onClick={() => setShowSquad(true)}>
|
||||
{t.eventForm.squadFromMatch}
|
||||
</button>
|
||||
) : (
|
||||
<>
|
||||
<p className="mb-1 text-[11px] text-faint">{t.eventForm.squadFromMatch}</p>
|
||||
<FixturePicker api={api} match={squadMatch} onPick={setSquadMatch} onClear={() => { setSquadMatch(null); setShowSquad(false); }} />
|
||||
<p className="mt-1 text-[11px] text-faint">{t.eventForm.squadFromMatchHelp}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{kind === "other" && (
|
||||
|
||||
Reference in new issue
Block a user