From db1d8c1f72422bc4d759e926b2eddb446961f187 Mon Sep 17 00:00:00 2001 From: Jiheng Li <136323923+JihengLi@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:47:42 -0500 Subject: [PATCH 1/4] Add a column for the judgement state -- whether a team has been judged (#467) * Add a column for the judgement state -- whether a team has been judged * Add the search function to the drop down menu * typo change * delete useless import in components/judges/schedule.tsx --- components/judges/TeamSelect.tsx | 16 +++++++++++++++- components/judges/schedule.tsx | 12 ++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/components/judges/TeamSelect.tsx b/components/judges/TeamSelect.tsx index 03fe84f9..4dca5d2a 100644 --- a/components/judges/TeamSelect.tsx +++ b/components/judges/TeamSelect.tsx @@ -20,6 +20,18 @@ function withCheckMark(value: string) { ); } + +const optionComparator = (input: string, option: string) => { + let searchPosition = 0; + const cin = input.toLowerCase(); + const opt = option.toLowerCase(); + for (let i = 0; i < opt.length; ++i) { + if (opt[i] === cin[searchPosition]) ++searchPosition; + else break; + } + return searchPosition === input.length; +}; + export default function TeamSelect(props: TeamSelectProps) { const { teamsData, currentTeamID, handleChange } = props; const { data: session } = useSession(); @@ -34,10 +46,12 @@ export default function TeamSelect(props: TeamSelectProps) { Team: setNameFilter(e.target.value)} + style={{ width: 200, marginRight: 8 }} + /> + + + + + {filteredData.map(config => ( - {config.name} +