Point Admin back button at the active game, not the join screen

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 09:33:53 -07:00
parent ceaf88ef22
commit 473fd74a00
2 changed files with 12 additions and 2 deletions

View File

@@ -16,7 +16,7 @@
- [x] Captain should not be autoassigned. That's something the crew has to earn. - [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 - [ ] Add a toast pop-up for new events entering the event log, that then fades into the event log button

View File

@@ -2,11 +2,21 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { apiRequest } from '../lib/api'; import { apiRequest } from '../lib/api';
import { setPageTitle } from '../lib/title'; import { setPageTitle } from '../lib/title';
import { getSessions } from '../lib/sessions';
export let params = {}; export let params = {};
let gameId = params.id; let gameId = params.id;
let adminKey = ''; 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 data = null;
let error = ''; let error = '';
let copiedPlayerId = null; let copiedPlayerId = null;
@@ -187,7 +197,7 @@
</table> </table>
<div class="mt-8"> <div class="mt-8">
<a href="/#/game/{gameId}/join" class="btn btn-secondary">Back to Game Join Page</a> <a href={backLink} class="btn btn-secondary">{backLabel}</a>
</div> </div>
</div> </div>
{/if} {/if}