Add player re-join links to admin page

Each player row now has Open/Copy actions for their dashboard link, so
the creator can recover access for players who lose their URL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 01:17:30 -07:00
parent 3a00774b50
commit bc867c95a1
2 changed files with 32 additions and 10 deletions

View File

@@ -8,6 +8,19 @@
let data = null;
let error = '';
let copiedPlayerId = null;
let copiedTimer = null;
function rejoinLink(playerId) {
return `${window.location.origin}/#/game/${gameId}/player/${playerId}`;
}
function copyRejoinLink(playerId) {
navigator.clipboard.writeText(rejoinLink(playerId));
copiedPlayerId = playerId;
clearTimeout(copiedTimer);
copiedTimer = setTimeout(() => { copiedPlayerId = null; }, 2000);
}
onMount(() => {
// Try to load admin_key from local storage
@@ -58,6 +71,7 @@
<th class="p-3">Role</th>
<th class="p-3">Status</th>
<th class="p-3">Rank</th>
<th class="p-3">Re-join Link</th>
</tr>
</thead>
<tbody>
@@ -78,6 +92,14 @@
{/if}
</td>
<td class="p-3">{p.rank}</td>
<td class="p-3">
<div class="link-copy-action">
<a href={rejoinLink(p.id)} class="btn btn-secondary btn-small">Open</a>
<button on:click={() => copyRejoinLink(p.id)} class="btn btn-secondary btn-small">
{copiedPlayerId === p.id ? '✓ Copied' : 'Copy'}
</button>
</div>
</td>
</tr>
{/each}
</tbody>