From f313f090f875451a1bd6fc0714354e75b06b0423 Mon Sep 17 00:00:00 2001 From: Raymond <101374892+raymonable@users.noreply.github.com> Date: Fri, 15 May 2026 23:57:36 -0400 Subject: [PATCH] fix: default to user's last played game for rankings in navbar --- AquaNet/src/App.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AquaNet/src/App.svelte b/AquaNet/src/App.svelte index 127d820e..948ebb61 100644 --- a/AquaNet/src/App.svelte +++ b/AquaNet/src/App.svelte @@ -34,12 +34,19 @@ let me: AquaNetUser let playedMai = false + let recentGame: string = "mai2"; + if (USER.isLoggedIn()) { USER.me().then(m => { me = m CARD.userGames(me.username).then(game => { playedMai = !!game.mai2 + recentGame = Object.keys(game) + .filter(k => !!game[k]) + .sort((a, b) => { + return (new Date(game[b].lastLogin)) - (new Date(game[a].lastLogin)) + })[0] ?? "mai2" }) }).catch(e => console.error(e)) } @@ -61,7 +68,8 @@ {t('navigation.home').toLowerCase()} - {t('navigation.rankings').toLowerCase()} + + {t('navigation.rankings').toLowerCase()} {#if playedMai} photo {/if}