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:
2
TODO.md
2
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
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
</table>
|
||||
|
||||
<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>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user