From 473fd74a007475f02c90d686939319324a3c9b7c Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Sun, 14 Jun 2026 09:33:53 -0700 Subject: [PATCH] Point Admin back button at the active game, not the join screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Admin page's back button now returns to this browser's own Pi-Rat dashboard for the game (looked up from the saved sessions), labelled "← Back to Game". Falls back to the join page only when this browser has no saved session for the game. Co-Authored-By: Claude Opus 4.8 --- TODO.md | 2 +- frontend/src/pages/Admin.svelte | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 7cf5036..cab226b 100644 --- a/TODO.md +++ b/TODO.md @@ -16,7 +16,7 @@ - [x] Captain should not be autoassigned. That's something the crew has to earn. -- [ ] The back button on the admin page should go back to the active game, not the join screen +- [x] The back button on the admin page should go back to the active game, not the join screen - [ ] Add a toast pop-up for new events entering the event log, that then fades into the event log button diff --git a/frontend/src/pages/Admin.svelte b/frontend/src/pages/Admin.svelte index dc5db27..fe40f43 100644 --- a/frontend/src/pages/Admin.svelte +++ b/frontend/src/pages/Admin.svelte @@ -2,11 +2,21 @@ import { onMount } from 'svelte'; import { apiRequest } from '../lib/api'; import { setPageTitle } from '../lib/title'; + import { getSessions } from '../lib/sessions'; export let params = {}; let gameId = params.id; let adminKey = ''; + // Return to this browser's own Pi-Rat dashboard for the game (the most + // recently used session), not the public join screen. Falls back to join + // if this browser has no saved session for the game. + $: mySession = getSessions().find(s => s.gameId === gameId); + $: backLink = mySession + ? `/#/game/${gameId}/player/${mySession.playerId}` + : `/#/game/${gameId}/join`; + $: backLabel = mySession ? '← Back to Game' : 'Back to Game Join Page'; + let data = null; let error = ''; let copiedPlayerId = null; @@ -187,7 +197,7 @@ {/if}