fix(leaderboards): match active players by user id
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphus.ai>
This commit is contained in:
parent
dd2c868c89
commit
72715c42a4
3 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
</span>
|
||||
)}
|
||||
{activeTeams.some((team) => team.id === row.id) && (
|
||||
{row.userId !== null && activeTeams.some((team) => team.id === row.userId) && (
|
||||
<span
|
||||
className="size-2 rounded-full bg-emerald-400"
|
||||
title="Clearing now"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ interface ApiProfile {
|
|||
|
||||
interface LeaderboardRow {
|
||||
id: number;
|
||||
userId: number | null;
|
||||
name: string;
|
||||
gamesPlayed: number;
|
||||
totalPasses: number;
|
||||
|
|
@ -82,6 +83,7 @@ export function FlappyLeaderboard({ refreshKey = 0, currentUserId, activePilots
|
|||
user?.displayName || doc.profileTitle || user?.username || `Pilot #${doc.id}`;
|
||||
return {
|
||||
id: doc.id,
|
||||
userId: user?.id ?? null,
|
||||
name,
|
||||
gamesPlayed: flappy.gamesPlayed ?? 0,
|
||||
totalPasses: flappy.totalPasses ?? 0,
|
||||
|
|
@ -170,7 +172,7 @@ export function FlappyLeaderboard({ refreshKey = 0, currentUserId, activePilots
|
|||
unranked
|
||||
</span>
|
||||
)}
|
||||
{activePilots.some((pilot) => pilot.id === row.id) && (
|
||||
{row.userId !== null && activePilots.some((pilot) => pilot.id === row.userId) && (
|
||||
<span className="size-2 rounded-full bg-emerald-400" title="Playing now" aria-label="Playing now" />
|
||||
)}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
</span>
|
||||
)}
|
||||
{activeOperators.some((operator) => operator.id === row.id) && (
|
||||
{row.userId !== null && activeOperators.some((operator) => operator.id === row.userId) && (
|
||||
<span
|
||||
className="size-2 rounded-full bg-emerald-400"
|
||||
title="Transmitting now"
|
||||
|
|
|
|||
Loading…
Reference in a new issue