Animated live runs
This commit is contained in:
+21
-9
@@ -13,6 +13,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
TableCell,
|
TableCell,
|
||||||
} from "@/components/ui/table";
|
} from "@/components/ui/table";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
/* ---------------- mock data ---------------- */
|
/* ---------------- mock data ---------------- */
|
||||||
|
|
||||||
@@ -92,9 +93,7 @@ export default function LiveRuns() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<Badge className="bg-primary/10 text-primary">
|
<Badge className="bg-primary/10 text-primary">🔥 PB Pace</Badge>
|
||||||
🔥 PB Pace
|
|
||||||
</Badge>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Table */}
|
{/* Table */}
|
||||||
@@ -112,8 +111,8 @@ export default function LiveRuns() {
|
|||||||
</TableHeader>
|
</TableHeader>
|
||||||
|
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{sortedRuns.map((run) => (
|
{sortedRuns.map((run, index) => (
|
||||||
<LiveRunRow key={run.id} {...run} />
|
<LiveRunRow key={run.id} {...run} index={index} />
|
||||||
))}
|
))}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
@@ -123,15 +122,28 @@ export default function LiveRuns() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function LiveRunRow({ username, problem, category, time, pace, status }: any) {
|
function LiveRunRow({
|
||||||
|
index,
|
||||||
|
username,
|
||||||
|
problem,
|
||||||
|
category,
|
||||||
|
time,
|
||||||
|
pace,
|
||||||
|
status,
|
||||||
|
}: any) {
|
||||||
const pacePositive = pace.startsWith("+");
|
const pacePositive = pace.startsWith("+");
|
||||||
const isTop = status === "pb";
|
const isTop = status === "pb";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow
|
<TableRow
|
||||||
className={
|
className={cn(
|
||||||
isTop ? "bg-primary/5 hover:bg-primary/10" : "hover:bg-secondary/50"
|
"opacity-0 animate-fade-in",
|
||||||
}
|
isTop ? "bg-primary/5 hover:bg-primary/10" : "hover:bg-secondary/50",
|
||||||
|
)}
|
||||||
|
style={{
|
||||||
|
animationDelay: `${index * 0.05}s`,
|
||||||
|
animationFillMode: "forwards",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<TableCell className="font-medium pl-5">
|
<TableCell className="font-medium pl-5">
|
||||||
{isTop ? `🔥 ${username}` : username}
|
{isTop ? `🔥 ${username}` : username}
|
||||||
|
|||||||
Reference in New Issue
Block a user