From 40e3e92b551b6e36dd0e2a9ddfbc297ad0bdeeda Mon Sep 17 00:00:00 2001 From: Isabella Lam Date: Fri, 1 May 2026 10:37:32 -0400 Subject: [PATCH 1/3] 940: Created component for duel timer --- js/src/app/duel/current/DuelTimer.tsx | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 js/src/app/duel/current/DuelTimer.tsx diff --git a/js/src/app/duel/current/DuelTimer.tsx b/js/src/app/duel/current/DuelTimer.tsx new file mode 100644 index 000000000..da8929f1c --- /dev/null +++ b/js/src/app/duel/current/DuelTimer.tsx @@ -0,0 +1,43 @@ +import { Text } from "@mantine/core"; +import { useState, useEffect } from "react"; + +interface DuelTimerProps { + endTime: number; // milliseconds +} + +const DuelTimer = ({ endTime }: DuelTimerProps) => { + const getTimeRemaining = () => { + const total = endTime - Date.now(); + const seconds = Math.floor((total / 1000) % 60); + const minutes = Math.floor((total / 1000 / 60) % 60); + if (total <= 0) { + return { + minutes: 0, + seconds: 0, + }; + } + return { + minutes, + seconds, + }; + }; + + const [timeLeft, setTimeLeft] = useState(() => getTimeRemaining()); + useEffect(() => { + const timer = setInterval(() => { + setTimeLeft(getTimeRemaining()); + }, 1); + + return () => clearInterval(timer); + }); + + return ( +
+ + {timeLeft.minutes}:{timeLeft.seconds.toString().padStart(2, "0")} + +
+ ); +}; + +export default DuelTimer; From 63e774b882ff834b562472c710a458706a2a926d Mon Sep 17 00:00:00 2001 From: Isabella Lam Date: Fri, 1 May 2026 10:38:41 -0400 Subject: [PATCH 2/3] 940: Created temporary path to test duel timer --- js/src/lib/router.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/src/lib/router.tsx b/js/src/lib/router.tsx index cbb99e497..ff8a39a47 100644 --- a/js/src/lib/router.tsx +++ b/js/src/lib/router.tsx @@ -3,6 +3,7 @@ import ClubSignUp from "@/app/club/[clubSlug]/ClubSignUp.page"; import DashboardPage from "@/app/dashboard/Dashboard.page"; import DuelPage from "@/app/duel/[lobbyCode]/Duel.page"; import CurrentDuelPage from "@/app/duel/current/CurrentDuel.page"; +import DuelTimer from "@/app/duel/current/DuelTimer"; import PartyEntryPage from "@/app/duel/PartyEntry.page"; import LeaderboardEmbed from "@/app/embed/leaderboard/LeaderboardEmbed"; import PotdEmbed from "@/app/embed/potd/PotdEmbed"; @@ -239,4 +240,13 @@ export const router = createBrowserRouter([ ), errorElement: , }, + { + path: "/timer", + element: ( + + + + ), + errorElement: , + }, ]); From 1f2d29fa4c6ca1473a3e166a98ec6e020e54ddf5 Mon Sep 17 00:00:00 2001 From: Isabella Lam Date: Thu, 28 May 2026 13:29:10 -0400 Subject: [PATCH 3/3] 940: Moved DuelTimer file to ~/_components/current to match ticket --- js/src/app/duel/{ => _components}/current/DuelTimer.tsx | 0 js/src/lib/router.tsx | 2 +- pom.xml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename js/src/app/duel/{ => _components}/current/DuelTimer.tsx (100%) diff --git a/js/src/app/duel/current/DuelTimer.tsx b/js/src/app/duel/_components/current/DuelTimer.tsx similarity index 100% rename from js/src/app/duel/current/DuelTimer.tsx rename to js/src/app/duel/_components/current/DuelTimer.tsx diff --git a/js/src/lib/router.tsx b/js/src/lib/router.tsx index ff8a39a47..d05d5835b 100644 --- a/js/src/lib/router.tsx +++ b/js/src/lib/router.tsx @@ -1,9 +1,9 @@ import AdminPage from "@/app/admin/admin.page"; import ClubSignUp from "@/app/club/[clubSlug]/ClubSignUp.page"; import DashboardPage from "@/app/dashboard/Dashboard.page"; +import DuelTimer from "@/app/duel/_components/current/DuelTimer"; import DuelPage from "@/app/duel/[lobbyCode]/Duel.page"; import CurrentDuelPage from "@/app/duel/current/CurrentDuel.page"; -import DuelTimer from "@/app/duel/current/DuelTimer"; import PartyEntryPage from "@/app/duel/PartyEntry.page"; import LeaderboardEmbed from "@/app/embed/leaderboard/LeaderboardEmbed"; import PotdEmbed from "@/app/embed/potd/PotdEmbed"; diff --git a/pom.xml b/pom.xml index 11b7fe7c3..968e110d7 100644 --- a/pom.xml +++ b/pom.xml @@ -306,4 +306,4 @@ - + \ No newline at end of file