summaryrefslogtreecommitdiff
path: root/ui/lib/components/Invite.svelte
blob: 29631f42e634c0a83e254bcf1187082985bd4eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<script>
  import { copy } from 'svelte-copy';

  let { id } = $props();
  let inviteUrl = $derived(new URL(`/invite/${id}`, document.location));
  // Nota bene: we cannot use:copy={inviteUrl}, because inviteUrl is not a
  // string, and therefore will get treated as an options object. So we must
  // explicitly build an options object, containing the value that will
  // eventually be interpreted as a string.
</script>

<button use:copy={{ text: inviteUrl }}>copy</button>
<span class="invite-url-literal">{inviteUrl}</span>