Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Henry li/solve the runtime error of the eye icon #471

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions components/Organizer/ApplicantsTab/ApplicantsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,13 @@ export const ApplicantsTab = () => {
visible={isAppModalOpen}
onOk={handleAppCloseModal}
onCancel={handleAppCloseModal}>
{selectedApplicant &&
Object.entries(selectedApplicant.application!)
{selectedApplicant?.application ? (
Object.entries(selectedApplicant.application)
.filter(([field, _]) => field in APPLICATION_KEY_MAP)
.map(createSingleApplicantEntry)}
.map(createSingleApplicantEntry)
) : (
<p>Application details are not available.</p>
)}
</Modal>
)}
{isCheckinModalOpen && (
Expand Down
16 changes: 15 additions & 1 deletion components/judges/TeamSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ function withCheckMark(value: string) {
</Row>
);
}

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();
Expand All @@ -34,10 +46,12 @@ export default function TeamSelect(props: TeamSelectProps) {
Team:
</strong>
<Select
showSearch
value={currentTeamID ? currentTeamID : 'Select a team'}
style={{ width: 300, maxWidth: '60vw' }}
onChange={handleChange}
allowClear>
allowClear
filterOption={(input, option) => optionComparator(input, String(option?.children))}>
{session?.userType === 'JUDGE' && (
<OptGroup label="My Teams">
{teamsData
Expand Down
12 changes: 10 additions & 2 deletions components/judges/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
<>
<td>{name}</td>
Expand All @@ -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 => <Tag key={member.id}>{member.name}</Tag>),
},
{
Expand All @@ -244,6 +244,13 @@ export function JudgeSchedule({ data, cutoffIndex, handleChange }: ScheduleProps
</Button>
),
},
{
title: 'Judgement State',
dataIndex: 'scores',
key: 'scores',
width: '10%',
render: (scores: []) => <Tag>{scores.length ? 'Judged' : 'Without Judgement'}</Tag>,
},
];
const dataSource = data.slice(showPast ? 0 : cutoffIndex).map(item => {
return {
Expand All @@ -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,
};
});

Expand Down
Loading