updating the playtime frontend with claude only code to replace the one graph with a dumb-bell graph, having each individual map show its players at beginning versus end and also the overall impact of maps + their popularity

This commit is contained in:
jenz
2026-10-02 14:43:45 +02:00
parent 6019e6854d
commit 8a76454784
14 changed files with 3300 additions and 159 deletions
@@ -0,0 +1,23 @@
import { NextRequest, NextResponse } from 'next/server';
import { getMapImpactLeaderboard } from '@/lib/queries';
const PAGE_SIZE = 50;
export async function GET(req: NextRequest) {
const sortByParam = req.nextUrl.searchParams.get('sortBy');
const directionParam = req.nextUrl.searchParams.get('direction');
const offset = Math.max(0, Number(req.nextUrl.searchParams.get('offset')) || 0);
const sortBy = sortByParam === 'popularity' ? 'popularity' : 'impact';
// Impact defaults to ascending (worst/most population-harming first, the
// whole point of the feature); popularity defaults to descending (most
// played first). Either can be flipped explicitly via `direction`.
const direction = directionParam === 'asc' || directionParam === 'desc'
? directionParam
: sortBy === 'popularity' ? 'desc' : 'asc';
const maps = await getMapImpactLeaderboard(sortBy, direction, PAGE_SIZE, offset);
const hasMore = maps.length === PAGE_SIZE;
return NextResponse.json({ maps, hasMore });
}