Skip to content

Commit

Permalink
fix(frontend): incorrect icon map
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Jun 7, 2024
1 parent 4876dba commit 704d368
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/GZCTF/ClientApp/src/components/ChallengeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface ChallengeCardProps {
challenge: ChallengeInfo
solved?: boolean
onClick?: () => void
iconMap: Map<SubmissionType, PartialIconProps>
iconMap: Map<SubmissionType, PartialIconProps | undefined>
colorMap: Map<SubmissionType, string | undefined>
teamId?: number
}
Expand Down
2 changes: 1 addition & 1 deletion src/GZCTF/ClientApp/src/components/ScoreboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const TableRow: FC<{
allRank: boolean
tableRank: number
onOpenDetail: () => void
iconMap: Map<SubmissionType, PartialIconProps>
iconMap: Map<SubmissionType, PartialIconProps | undefined>
challenges?: Record<string, ChallengeInfo[]>
}> = ({ item, challenges, onOpenDetail, iconMap, tableRank, allRank }) => {
const theme = useMantineTheme()
Expand Down
9 changes: 3 additions & 6 deletions src/GZCTF/ClientApp/src/utils/Shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const SubmissionTypeColorMap = () => {
const { colorScheme } = useMantineColorScheme()

return new Map([
[SubmissionType.Unaccepted, theme.colors.alert[5]],
[SubmissionType.Unaccepted, undefined],
[SubmissionType.Normal, theme.colors[theme.primaryColor][colorScheme === 'dark' ? 8 : 6]],
[SubmissionType.FirstBlood, theme.colors.yellow[5]],
[
Expand All @@ -274,11 +274,8 @@ export const SubmissionTypeColorMap = () => {
export const SubmissionTypeIconMap = (size: number) => {
const colorMap = SubmissionTypeColorMap()
return {
iconMap: new Map<SubmissionType, PartialIconProps>([
[
SubmissionType.Unaccepted,
{ path: mdiFlag, size: size, color: colorMap.get(SubmissionType.Unaccepted) },
],
iconMap: new Map<SubmissionType, PartialIconProps | undefined>([
[SubmissionType.Unaccepted, undefined],
[
SubmissionType.Normal,
{ path: mdiFlag, size: size, color: colorMap.get(SubmissionType.Normal) },
Expand Down

0 comments on commit 704d368

Please sign in to comment.