Proper leaderboards layout

This commit is contained in:
2026-02-06 16:16:15 +01:00
parent 839967ccf1
commit 1db017b0b7
4 changed files with 139 additions and 68 deletions
+63 -23
View File
@@ -1,154 +1,194 @@
"use server";
import * as Core from "./core";
import { Leaderboard } from "./types";
import { LeaderboardRank } from "./types"; // updated interface
export async function getGlobalLeaderboard(): Promise<Leaderboard> {
export async function getGlobalLeaderboard(): Promise<LeaderboardRank[]> {
return [
{
rank: 1,
username: "speedmaster_x",
pb: "2:34.21",
runsCount: 2341,
category: "Any%",
problem: "Fix broken login flow",
category: "any%",
assisted: false,
},
{
rank: 2,
username: "algo_ninja",
pb: "2:38.54",
runsCount: 1876,
category: "Any%",
problem: "Refactor legacy API endpoints",
category: "any%",
assisted: false,
},
{
rank: 3,
username: "clockwork",
pb: "2:41.02",
runsCount: 3102,
category: "Any%",
problem: "Optimize image upload pipeline",
category: "any%",
assisted: false,
},
{
rank: 4,
username: "fastfingers99",
pb: "2:45.33",
runsCount: 987,
category: "Any%",
problem: "Build a mini chat server",
category: "any%",
assisted: false,
},
{
rank: 5,
username: "recursion_queen",
pb: "2:47.89",
runsCount: 1543,
category: "Any%",
problem: "Fix CSS layout bug in dashboard",
category: "any%",
assisted: false,
},
{
rank: 6,
username: "bitshifter",
pb: "2:52.11",
runsCount: 2109,
category: "Any%",
problem: "Implement JWT authentication",
category: "any%",
assisted: false,
},
{
rank: 7,
username: "nullpointer",
pb: "2:54.67",
runsCount: 876,
category: "Any%",
problem: "Create REST endpoint for user data",
category: "any%",
assisted: false,
},
{
rank: 8,
username: "stackattack",
pb: "2:58.23",
runsCount: 1234,
category: "Any%",
problem: "Fix off-by-one bug in sorting function",
category: "any%",
assisted: false,
},
{
rank: 9,
username: "looplegend",
pb: "3:01.45",
runsCount: 654,
category: "Any%",
problem: "Optimize SQL query for reports",
category: "any%",
assisted: false,
},
{
rank: 10,
username: "coderunner",
pb: "3:05.78",
runsCount: 1098,
category: "Any%",
problem: "Add file upload validation",
category: "any%",
assisted: false,
},
];
}
export async function getWeeklyLeaderboard(): Promise<Leaderboard> {
export async function getWeeklyLeaderboard(): Promise<LeaderboardRank[]> {
return [
{
rank: 1,
username: "weekly_warrior",
pb: "2:51.33",
runsCount: 156,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 2,
username: "speedmaster_x",
pb: "2:53.12",
runsCount: 89,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 3,
username: "newbie_grinder",
pb: "2:58.67",
runsCount: 234,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 4,
username: "algo_ninja",
pb: "3:02.45",
runsCount: 67,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 5,
username: "fresh_runner",
pb: "3:05.89",
runsCount: 45,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 6,
username: "practice_makes",
pb: "3:08.12",
runsCount: 112,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 7,
username: "splitmaster",
pb: "3:12.34",
runsCount: 78,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 8,
username: "grindtime",
pb: "3:15.56",
runsCount: 92,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 9,
username: "pb_hunter",
pb: "3:18.90",
runsCount: 56,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
{
rank: 10,
username: "reset_king",
pb: "3:22.11",
runsCount: 187,
category: "Any%",
problem: "Build notifications API",
category: "any%",
assisted: false,
},
];
}