From d48f30174e20280edbc1a7e80c4857bf74bb263c Mon Sep 17 00:00:00 2001 From: JihengLi Date: Mon, 8 Apr 2024 23:27:51 -0500 Subject: [PATCH 1/7] Add a column for the judgement state -- whether a team has been judged --- components/judges/schedule.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/judges/schedule.tsx b/components/judges/schedule.tsx index b49bb613..608a17ce 100644 --- a/components/judges/schedule.tsx +++ b/components/judges/schedule.tsx @@ -1,5 +1,5 @@ import { Space, Table, Collapse, Tag, Switch, Button, notification, Upload, Spin, theme, Radio } from 'antd'; -import React, { useContext, useMemo, useState } from 'react'; +import React, { useContext, useEffect, useMemo, useState } from 'react'; import { DateTime } from 'luxon'; import Link from 'next/link'; import { JudgingSessionData } from '../../types/database'; @@ -205,7 +205,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps title: 'Project', dataIndex: 'project', key: 'project', - width: '30%', + width: '25%', render: ({ name, link }: { name: string; link: URL }) => ( <> {name} @@ -223,7 +223,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps title: 'Team Members', dataIndex: 'teamMembers', key: 'teamMembers', - width: '30%', + width: '25%', render: (members: User[]) => members.map(member => {member.name}), }, { @@ -244,6 +244,13 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps ), }, + { + title: 'Judgement State', + dataIndex: 'scores', + key: 'scores', + width: '10%', + render: (scores: []) => {scores.length ? 'Judged' : 'Without Judgement'}, + }, ]; const dataSource = data.slice(showPast ? 0 : cutoffIndex).map(item => { return { @@ -253,6 +260,7 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps teamMembers: item.team.members, judge: item.judge, teamId: item.team._id, + scores: item.team.scores, }; }); From 0cc219bdef1b5a41c0253c7d0b9b3a8484ac9083 Mon Sep 17 00:00:00 2001 From: JihengLi Date: Tue, 9 Apr 2024 00:26:44 -0500 Subject: [PATCH 2/7] Add the search function to the drop down menu --- components/judges/TeamSelect.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/components/judges/TeamSelect.tsx b/components/judges/TeamSelect.tsx index 03fe84f9..c9bd251a 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: