1
0
Fork 0

fix(qualification): expose updated aim trainer leaderboard data

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphus.ai>
This commit is contained in:
Jason Fraley 2026-09-04 12:04:44 -04:00
parent 15e5fa7d01
commit dd2c868c89

View file

@ -15,6 +15,7 @@ import {
type LeaderboardRow = {
readonly id: number;
readonly userId: number | null;
readonly name: string;
readonly gamesPlayed: number;
readonly bestScore: number;
@ -24,9 +25,9 @@ type LeaderboardRow = {
};
function rankClass(index: number): string {
if (index === 0) return "font-bold text-primary";
if (index === 1) return "font-semibold text-foreground";
if (index === 2) return "font-semibold text-muted-foreground";
if (index === 0) return "font-bold text-amber-400";
if (index === 1) return "font-semibold text-slate-300";
if (index === 2) return "font-semibold text-amber-700";
return "text-muted-foreground";
}
@ -77,6 +78,7 @@ export function AimTrainerLeaderboard({
const aimTrainer = profile.aimTrainer;
return {
id: profile.id,
userId,
name,
gamesPlayed: aimTrainer?.gamesPlayed ?? 0,
bestScore: aimTrainer?.[tier.scoreField] ?? 0,
@ -111,7 +113,7 @@ export function AimTrainerLeaderboard({
<Card className="w-full max-w-3xl overflow-hidden">
<CardHeader className="gap-1 border-b border-border px-4 py-3">
<div className="flex items-center gap-2">
<Trophy aria-hidden="true" className="size-4 text-primary" />
<Trophy aria-hidden="true" className="size-4 text-amber-400" />
<CardTitle className="text-sm">Qualification leaderboard</CardTitle>
<span className="ml-auto text-xs text-muted-foreground">{tier.label} · Top 10</span>
</div>
@ -121,7 +123,7 @@ export function AimTrainerLeaderboard({
className="border-b border-border px-4 py-2 text-xs text-muted-foreground"
aria-live="polite"
>
<span className="font-medium text-primary">{activeTrainees.length}</span>{" "}
<span className="font-medium text-emerald-400">{activeTrainees.length}</span>{" "}
{activeTrainees.length === 1 ? "trainee is" : "trainees are"} on the line
{activeTrainees.length > 0 && (
<span className="ml-1 text-foreground">
@ -190,9 +192,9 @@ export function AimTrainerLeaderboard({
unranked
</span>
)}
{activeTrainees.some((trainee) => trainee.id === row.id) && (
{row.userId !== null && activeTrainees.some((trainee) => trainee.id === row.userId) && (
<span
className="size-2 rounded-full bg-primary"
className="size-2 rounded-full bg-emerald-400"
title="Playing now"
aria-label="Playing now"
/>