From 72715c42a42c93ae2b20cd21dc15973799f7bed4 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Fri, 4 Sep 2026 12:04:44 -0400 Subject: [PATCH] fix(leaderboards): match active players by user id Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/components/frontend/eod/EodLeaderboard.tsx | 4 +++- src/components/frontend/flappy/FlappyLeaderboard.tsx | 4 +++- src/components/frontend/radio/RadioLeaderboard.tsx | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/frontend/eod/EodLeaderboard.tsx b/src/components/frontend/eod/EodLeaderboard.tsx index 6073c58..586b3ff 100644 --- a/src/components/frontend/eod/EodLeaderboard.tsx +++ b/src/components/frontend/eod/EodLeaderboard.tsx @@ -44,6 +44,7 @@ interface ApiProfile { interface LeaderboardRow { id: number; + userId: number | null; name: string; gamesPlayed: number; wins: number; @@ -113,6 +114,7 @@ export function EodLeaderboard({ user?.displayName || doc.profileTitle || user?.username || `Operator #${doc.id}`; return { id: doc.id, + userId: user?.id ?? null, name, gamesPlayed: eod.gamesPlayed ?? 0, wins: eod.wins ?? 0, @@ -236,7 +238,7 @@ export function EodLeaderboard({ unranked )} - {activeTeams.some((team) => team.id === row.id) && ( + {row.userId !== null && activeTeams.some((team) => team.id === row.userId) && ( )} - {activePilots.some((pilot) => pilot.id === row.id) && ( + {row.userId !== null && activePilots.some((pilot) => pilot.id === row.userId) && ( )} diff --git a/src/components/frontend/radio/RadioLeaderboard.tsx b/src/components/frontend/radio/RadioLeaderboard.tsx index 6ca4ea9..8e0f79b 100644 --- a/src/components/frontend/radio/RadioLeaderboard.tsx +++ b/src/components/frontend/radio/RadioLeaderboard.tsx @@ -41,6 +41,7 @@ interface ApiProfile { interface LeaderboardRow { id: number; + userId: number | null; name: string; totalMessages: number; bestScore: number; @@ -134,6 +135,7 @@ export function RadioLeaderboard({ const user = typeof doc.user === "object" && doc.user !== null ? doc.user : null; return { id: doc.id, + userId: user?.id ?? null, name: user?.displayName || doc.profileTitle || user?.username || `Operator #${doc.id}`, totalMessages: radioTraffic[mode === "sprint" ? "sprintTotalMessages" : "watchTotalMessages"] ?? 0, @@ -299,7 +301,7 @@ export function RadioLeaderboard({ unranked )} - {activeOperators.some((operator) => operator.id === row.id) && ( + {row.userId !== null && activeOperators.some((operator) => operator.id === row.userId) && (