From 06babe529629a504e6dd7a42051fe53dda8fd184 Mon Sep 17 00:00:00 2001 From: Nathan Raymant Date: Mon, 4 Mar 2024 17:22:49 -0500 Subject: [PATCH] Quiz intro splash text animations now only play when following a shareable link --- .../(pages)/leaderboard/[...query]/page.tsx | 3 +- frontend/app/(pages)/quiz/[...query]/page.tsx | 41 ++++++++++++++----- frontend/app/components/data-rows/QuizRow.tsx | 4 +- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/frontend/app/(pages)/leaderboard/[...query]/page.tsx b/frontend/app/(pages)/leaderboard/[...query]/page.tsx index 462bd8f..327370c 100644 --- a/frontend/app/(pages)/leaderboard/[...query]/page.tsx +++ b/frontend/app/(pages)/leaderboard/[...query]/page.tsx @@ -276,7 +276,7 @@ export default function Leaderboard({ params }: { params: { query: string[]}}) { {renderLeaderboardEntries()} {!loading && quiz &&
- +
} - ); } \ No newline at end of file diff --git a/frontend/app/(pages)/quiz/[...query]/page.tsx b/frontend/app/(pages)/quiz/[...query]/page.tsx index b0080e4..fc8b533 100644 --- a/frontend/app/(pages)/quiz/[...query]/page.tsx +++ b/frontend/app/(pages)/quiz/[...query]/page.tsx @@ -49,9 +49,22 @@ const isTimeAttack = (quizInfo: TimeAttackQuizInfo | SurvivalQuizInfo): quizInfo export default function Quiz({ params }: { params: { query: string[] } }) { - // Extracting the NextJS route query parameters "/quiz/{quizId}/{?urlToken}" + // Extracting the NextJS route query parameters "/quiz/{quizId}/{?urlToken}/{?noa}" const quizId = Number(params.query[0]); - const urlToken: string | null = params.query.length > 1 ? params.query[1] : null; + let urlToken: string | null = null; + let doAnimateIntro: boolean = true; + if (params.query.length === 2) { + if (params.query[1] === "noa") { + doAnimateIntro = false; + } else { + urlToken = params.query[1]; + } + } else if (params.query.length > 2) { + urlToken = params.query[1]; + if (params.query[2] === "noa") { + doAnimateIntro = false; + } + } // ----------- Hooks ------------------ const router = useRouter(); @@ -164,14 +177,22 @@ export default function Quiz({ params }: { params: { query: string[] } }) { setStaticDataLoading(false); // Begin the intro splash timing sequence - const introSplashSequence = [ - { action: () => setIntroSplashTextEntering(["ENTERING", "WAITING"]), delay: 1800 }, - { action: () => setIntroSplashTextEntering(["EXITING", "WAITING"]), delay: 2250 }, - { action: () => setIntroSplashTextEntering(["WAITING", "ENTERING"]), delay: 500 }, - { action: () => setIntroSplashTextEntering(["WAITING", "EXITING"]), delay: 2500}, - { action: () => setLandingActionsHeight("auto"), delay: 500 }, - { action: () => setLandingActionsVisible(true), delay: 500 } - ]; + let introSplashSequence: Array<{ action: () => void, delay: number }>; + if (doAnimateIntro) { + introSplashSequence = [ + { action: () => setIntroSplashTextEntering(["ENTERING", "WAITING"]), delay: 1800 }, + { action: () => setIntroSplashTextEntering(["EXITING", "WAITING"]), delay: 2250 }, + { action: () => setIntroSplashTextEntering(["WAITING", "ENTERING"]), delay: 500 }, + { action: () => setIntroSplashTextEntering(["WAITING", "EXITING"]), delay: 2500}, + { action: () => setLandingActionsHeight("auto"), delay: 500 }, + { action: () => setLandingActionsVisible(true), delay: 500 } + ]; + } else { + introSplashSequence = [ + { action: () => setLandingActionsHeight("auto"), delay: 1800 }, + { action: () => setLandingActionsVisible(true), delay: 500 } + ]; + } executeEventSequence(introSplashSequence); } getPageData(); diff --git a/frontend/app/components/data-rows/QuizRow.tsx b/frontend/app/components/data-rows/QuizRow.tsx index 153a0e3..1d8d4e3 100644 --- a/frontend/app/components/data-rows/QuizRow.tsx +++ b/frontend/app/components/data-rows/QuizRow.tsx @@ -232,7 +232,7 @@ export default function QuizRow({groupChatId, quiz, setReloadCounter, dropdownPo }}> Copy Shareable Link - +
@@ -273,7 +273,7 @@ export default function QuizRow({groupChatId, quiz, setReloadCounter, dropdownPo {renderQuizTypeBadge(quiz.type)}
- +