From bfd2ce571957bf523668a0bdd417d00b4ade3519 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sat, 7 Feb 2026 22:22:41 +0100 Subject: [PATCH] problem refrencing in live runs --- src/app/runs/components/LiveRunRow.tsx | 16 +++++++++++++++- src/modules/live-run/actions.ts | 8 ++++---- src/modules/problems/core.ts | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/app/runs/components/LiveRunRow.tsx b/src/app/runs/components/LiveRunRow.tsx index 03b8a3b..5655586 100644 --- a/src/app/runs/components/LiveRunRow.tsx +++ b/src/app/runs/components/LiveRunRow.tsx @@ -5,6 +5,10 @@ import { TableRow, TableCell } from "@/components/ui/table"; import { cn } from "@/lib/utils"; import { LiveRun } from "@/modules/live-run/types"; import formatTime from "@/lib/time-format"; +import useAction from "@/hook/use-action"; +import { getProblem } from "@/modules/problems/actions"; +import Link from "next/link"; +import { LinkIcon } from "lucide-react"; export default function LiveRunRow({ index, @@ -13,6 +17,8 @@ export default function LiveRunRow({ index: number; run: LiveRun; }) { + const [problem] = useAction(() => getProblem(run.problem)); + const now = new Date().getTime() + 1000; const isTop = run.views > 5; @@ -33,7 +39,15 @@ export default function LiveRunRow({ {/* Problem + Category */} - {run.problem} + + + + {problem?.title || run.problem} + + {/* Runtime */} { { id: "1", username: "speedmaster_x", - problem: "Two Sum Dash", + problem: "fix-auth-callback", category: "any%", views: 670, runsCount: 1, @@ -24,7 +24,7 @@ export async function getLiveRuns(): Promise { id: "2", username: "algo_ninja", views: 3, - problem: "Binary Sprint", + problem: "fix-prod-build", category: "any%", runsCount: 1, start: new Date().getTime(), @@ -33,14 +33,14 @@ export async function getLiveRuns(): Promise { id: "3", username: "stackattack", views: 3, - problem: "String Scramble", + problem: "add-user-profile-endpoint", category: "any%", runsCount: 1, start: new Date().getTime(), }, { id: "4", - username: "reset_king", + username: "fix-prod-build", views: 3, problem: "Linked List Rush", category: "any%", diff --git a/src/modules/problems/core.ts b/src/modules/problems/core.ts index 707a28f..a0c2346 100644 --- a/src/modules/problems/core.ts +++ b/src/modules/problems/core.ts @@ -20,7 +20,7 @@ const problems: ProblemDefinition[] = [ description: "Production build fails while development works. Fix the build.", language: "javascript", - difficulty: "easy", + difficulty: "hard", validate100: () => true, validateAny: () => true, }, @@ -29,7 +29,7 @@ const problems: ProblemDefinition[] = [ title: "Implement Missing API Endpoint", description: "The frontend expects `/api/me`. Implement it correctly.", language: "go", - difficulty: "easy", + difficulty: "medium", validate100: () => true, validateAny: () => true, },