From 2416726a18cd02234895012277a637e5deb27888 Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 9 May 2024 22:13:11 -0700 Subject: [PATCH] Make challenges list work on mobile --- .../src/components/ChallengePanel.tsx | 22 ++++++++----------- .../src/components/GameNoticePanel.tsx | 4 ++-- .../src/pages/games/[id]/Challenges.tsx | 13 +++++++++-- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/GZCTF/ClientApp/src/components/ChallengePanel.tsx b/src/GZCTF/ClientApp/src/components/ChallengePanel.tsx index c25e3a3f..693f34c0 100644 --- a/src/GZCTF/ClientApp/src/components/ChallengePanel.tsx +++ b/src/GZCTF/ClientApp/src/components/ChallengePanel.tsx @@ -25,6 +25,7 @@ import ChallengeDetailModal from '@Components/ChallengeDetailModal' import Empty from '@Components/Empty' import WriteupSubmitModal from '@Components/WriteupSubmitModal' import { useChallengeTagLabelMap, SubmissionTypeIconMap } from '@Utils/Shared' +import { useIsMobile } from '@Utils/ThemeOverride' import { useGame, useGameTeamInfo } from '@Utils/useGame' import { ChallengeInfo, ChallengeTag, SubmissionType } from '@Api' @@ -63,16 +64,12 @@ const ChallengePanel: FC = () => { const challengeTagLabelMap = useChallengeTagLabelMap() const { t } = useTranslation() + const isMobile = useIsMobile(1300) + // skeleton for loading if (!challenges) { return ( - + {Array(10) .fill(null) @@ -88,7 +85,6 @@ const ChallengePanel: FC = () => { pt={0} spacing="sm" pos="relative" - w="calc(100% - 9rem)" cols={{ base: 3, w18: 4, w24: 6, w30: 8, w36: 10, w42: 12, w48: 14 }} > {Array(8) @@ -139,9 +135,9 @@ const ChallengePanel: FC = () => { wrap="nowrap" justify="space-between" align="flex-start" - miw="calc(100% - 20rem)" + style={{ flex: '100% 1' }} > - + {game?.writeupRequired && ( <>