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}