problem refrencing in live runs
This commit is contained in:
@@ -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({
|
||||
</TableCell>
|
||||
|
||||
{/* Problem + Category */}
|
||||
<TableCell>{run.problem}</TableCell>
|
||||
<TableCell>
|
||||
<Link
|
||||
href={`problems/${run.problem}`}
|
||||
className="hover:text-primary flex items-center gap-1"
|
||||
>
|
||||
<LinkIcon className="w-3 h-3" />
|
||||
{problem?.title || run.problem}
|
||||
</Link>
|
||||
</TableCell>
|
||||
|
||||
{/* Runtime */}
|
||||
<TableCell
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function getLiveRuns(): Promise<LiveRun[]> {
|
||||
{
|
||||
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<LiveRun[]> {
|
||||
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<LiveRun[]> {
|
||||
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%",
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user