Add copy invite link button and auto-populate invite code from URL
Admin panel gets "Copy Link" button on active invites that copies a signup URL with ?invite= param. Client auto-opens signup form with invite code pre-filled when visiting that link. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -454,7 +454,8 @@ async function loadInvites() {
|
||||
<td>${status}</td>
|
||||
<td>
|
||||
${invite.is_active && !isExpired && invite.remaining_uses > 0
|
||||
? `<button class="btn btn-small btn-danger" onclick="promptRevokeInvite('${invite.code}')">Revoke</button>`
|
||||
? `<button class="btn btn-small" onclick="copyInviteLink('${invite.code}')">Copy Link</button>
|
||||
<button class="btn btn-small btn-danger" onclick="promptRevokeInvite('${invite.code}')">Revoke</button>`
|
||||
: '-'
|
||||
}
|
||||
</td>
|
||||
@@ -619,6 +620,16 @@ async function handleCreateInvite() {
|
||||
}
|
||||
}
|
||||
|
||||
function copyInviteLink(code) {
|
||||
const link = `${window.location.origin}/?invite=${encodeURIComponent(code)}`;
|
||||
navigator.clipboard.writeText(link).then(() => {
|
||||
showToast('Invite link copied!', 'success');
|
||||
}).catch(() => {
|
||||
// Fallback: select text for manual copy
|
||||
prompt('Copy this link:', link);
|
||||
});
|
||||
}
|
||||
|
||||
async function promptRevokeInvite(code) {
|
||||
if (!confirm(`Are you sure you want to revoke invite code ${code}?`)) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user