From db776231a1c05375b1a0c2d4b9a8be1690a60248 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Tue, 3 Feb 2026 15:00:56 +0100 Subject: [PATCH] Component structure --- .../components}/LeaderboardRow.tsx | 0 src/app/leaderboards/page.tsx | 2 +- src/app/runs/components/LiveRunNow.tsx | 86 +++++++++++++++ src/app/runs/components/StatCard.tsx | 21 ++++ src/app/runs/page.tsx | 103 +----------------- 5 files changed, 110 insertions(+), 102 deletions(-) rename src/{components/app => app/leaderboards/components}/LeaderboardRow.tsx (100%) create mode 100644 src/app/runs/components/LiveRunNow.tsx create mode 100644 src/app/runs/components/StatCard.tsx diff --git a/src/components/app/LeaderboardRow.tsx b/src/app/leaderboards/components/LeaderboardRow.tsx similarity index 100% rename from src/components/app/LeaderboardRow.tsx rename to src/app/leaderboards/components/LeaderboardRow.tsx diff --git a/src/app/leaderboards/page.tsx b/src/app/leaderboards/page.tsx index 1d9f1ad..dc1aff7 100644 --- a/src/app/leaderboards/page.tsx +++ b/src/app/leaderboards/page.tsx @@ -23,7 +23,7 @@ import { PaginationPrevious, } from "@/components/ui/pagination"; -import LeaderboardRow from "@/components/app/LeaderboardRow"; +import LeaderboardRow from "@/app/leaderboards/components/LeaderboardRow"; const globalLeaderboard = [ { diff --git a/src/app/runs/components/LiveRunNow.tsx b/src/app/runs/components/LiveRunNow.tsx new file mode 100644 index 0000000..13e9919 --- /dev/null +++ b/src/app/runs/components/LiveRunNow.tsx @@ -0,0 +1,86 @@ +"use client"; + +import { Eye } from "lucide-react"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { TableRow, TableCell } from "@/components/ui/table"; +import { cn } from "@/lib/utils"; + +export default function LiveRunRow({ + index, + username, + problem, + category, + time, + pace, + status, +}: any) { + const pacePositive = pace.startsWith("+"); + const isTop = status === "pb"; + + return ( + + + {isTop ? `🔥 ${username}` : username} + + + +
+ {problem} + + {category} + +
+
+ + + {time} + + + + + {pace} + + + + +
+ + Live +
+
+ + + + +
+ ); +} diff --git a/src/app/runs/components/StatCard.tsx b/src/app/runs/components/StatCard.tsx new file mode 100644 index 0000000..963e918 --- /dev/null +++ b/src/app/runs/components/StatCard.tsx @@ -0,0 +1,21 @@ +import { Card, CardHeader, CardTitle } from "@/components/ui/card"; + +export default function StatCard({ + icon: Icon, + label, + value, +}: { + icon: any; + label: string; + value: string; +}) { + return ( + + + + {value} +

{label}

+
+
+ ); +} diff --git a/src/app/runs/page.tsx b/src/app/runs/page.tsx index 715bf28..6b91ca2 100644 --- a/src/app/runs/page.tsx +++ b/src/app/runs/page.tsx @@ -14,6 +14,8 @@ import { TableCell, } from "@/components/ui/table"; import { cn } from "@/lib/utils"; +import LiveRunRow from "./components/LiveRunNow"; +import StatCard from "./components/StatCard"; /* ---------------- mock data ---------------- */ @@ -121,104 +123,3 @@ export default function LiveRuns() { ); } - -function LiveRunRow({ - index, - username, - problem, - category, - time, - pace, - status, -}: any) { - const pacePositive = pace.startsWith("+"); - const isTop = status === "pb"; - - return ( - - - {isTop ? `🔥 ${username}` : username} - - - -
- {problem} - - {category} - -
-
- - - {time} - - - - - {pace} - - - - -
- - Live -
-
- - - - -
- ); -} - -/* ---------------- helpers ---------------- */ - -function StatCard({ - icon: Icon, - label, - value, -}: { - icon: any; - label: string; - value: string; -}) { - return ( - - - - {value} -

{label}

-
-
- ); -}