diff --git a/client/admin.js b/client/admin.js
index b40bbae..e906967 100644
--- a/client/admin.js
+++ b/client/admin.js
@@ -317,7 +317,7 @@ async function loadUsers() {
${user.games_played} (${user.games_won} wins) |
${formatDateShort(user.created_at)} |
-
+
|
`;
@@ -404,7 +404,7 @@ async function loadGames() {
${game.status} |
${formatDate(game.created_at)} |
-
+
|
`;
@@ -454,8 +454,8 @@ async function loadInvites() {
${status} |
${invite.is_active && !isExpired && invite.remaining_uses > 0
- ? `
- `
+ ? `
+ `
: '-'
}
|
@@ -815,6 +815,18 @@ document.addEventListener('DOMContentLoaded', () => {
});
});
+ // Delegated click handlers for dynamically-created buttons
+ document.addEventListener('click', (e) => {
+ const btn = e.target.closest('[data-action]');
+ if (!btn) return;
+
+ const action = btn.dataset.action;
+ if (action === 'view-user') viewUser(btn.dataset.id);
+ else if (action === 'end-game') promptEndGame(btn.dataset.id);
+ else if (action === 'copy-invite') copyInviteLink(btn.dataset.code);
+ else if (action === 'revoke-invite') promptRevokeInvite(btn.dataset.code);
+ });
+
// Check auth on load
checkAuth();
});