diff --git a/TODO.md b/TODO.md index 9f81124..bb0728c 100644 --- a/TODO.md +++ b/TODO.md @@ -5,7 +5,6 @@ ## Minor Gameplay Polish -- [ ] **Add invite link to Admin panel** - [ ] **Add crew/player/rat name to page title, if available**. This will make it easier to distinguish tabs/browser history entries - [ ] **Save active sessions in browser local storage**. Whenever you create or join a game, your browser local storage should be updated with the game ID, player ID, crew name, and player/rat names (if available). Going to the home page with saved sessions should provide a menu of games to rejoin in addition to the ability to start a new game. It should be possible to delete entries from this list, which only affects the browser local storage, not the backend database, and is undoable (the entry doesn't disappear immediately, it's just marked as deleted until page refresh). - [ ] **Dead Pi-Rat rank voting streamlined**. Don't allow voting for dead Pi-Rats. If a player's only vote options are dead, then they skip voting entirely. diff --git a/frontend/src/pages/Admin.svelte b/frontend/src/pages/Admin.svelte index 15d6950..6d2ac4e 100644 --- a/frontend/src/pages/Admin.svelte +++ b/frontend/src/pages/Admin.svelte @@ -10,11 +10,17 @@ let error = ''; let copiedPlayerId = null; let copiedTimer = null; + let copiedInvite = false; + let copiedInviteTimer = null; function rejoinLink(playerId) { return `${window.location.origin}/#/game/${gameId}/player/${playerId}`; } + function inviteLink() { + return `${window.location.origin}/#/game/${gameId}/join`; + } + function copyRejoinLink(playerId) { navigator.clipboard.writeText(rejoinLink(playerId)); copiedPlayerId = playerId; @@ -22,6 +28,13 @@ copiedTimer = setTimeout(() => { copiedPlayerId = null; }, 2000); } + function copyInviteLink() { + navigator.clipboard.writeText(inviteLink()); + copiedInvite = true; + clearTimeout(copiedInviteTimer); + copiedInviteTimer = setTimeout(() => { copiedInvite = false; }, 2000); + } + onMount(() => { // Try to load admin_key from local storage adminKey = localStorage.getItem(`admin_key_${gameId}`) || ''; @@ -75,6 +88,16 @@
Phase: {data.game.phase}
Admin Key: {data.game.admin_key}
+Share this link to let new players join the crew.
+