summaryrefslogtreecommitdiff
path: root/ui/lib/components
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-10-25 22:16:03 -0400
committerKit La Touche <kit@transneptune.net>2024-10-25 22:16:03 -0400
commita50911a03c8955e08c77b0f3764dbda963013971 (patch)
tree9f5319191438b85b860ba06c9a203d3f129072a1 /ui/lib/components
parent4c49283553f4b18bb2a74de280b340a073e3253e (diff)
parentc87b5c53077c02bf21234e24bf976aa7a5f2bac8 (diff)
Merge branch 'main' into wip/mobile
Diffstat (limited to 'ui/lib/components')
-rw-r--r--ui/lib/components/Invite.svelte40
1 files changed, 40 insertions, 0 deletions
diff --git a/ui/lib/components/Invite.svelte b/ui/lib/components/Invite.svelte
new file mode 100644
index 0000000..f4babad
--- /dev/null
+++ b/ui/lib/components/Invite.svelte
@@ -0,0 +1,40 @@
+<script>
+ import { base } from '$app/paths';
+ import { createInvite } from '$lib/apiServer';
+ import { clipboard } from '@skeletonlabs/skeleton';
+
+ let invite = null;
+ $: inviteUrl = invite ? new URL(`/invite/${invite.id}`, document.location) : null;
+ $: inviteUrl, console.log("invite url", inviteUrl);
+
+ async function onSubmit() {
+ let response = await createInvite();
+ if (response.status == 200) {
+ invite = response.data;
+ }
+ console.log("base url", base);
+ }
+
+ async function onReset() {
+ invite = null;
+ }
+</script>
+
+<form
+ on:submit|preventDefault={onSubmit}
+ on:reset|preventDefault={onReset}>
+ {#if inviteUrl}
+ <button
+ class="border-slate-500 border-solid border-2 font-bold p-1 rounded"
+ use:clipboard={inviteUrl}
+ type="reset">
+ Copy Invite
+ </button>
+ {:else}
+ <button
+ class="border-slate-500 border-solid border-2 font-bold p-1 rounded"
+ type="submit">
+ Invite
+ </button>
+ {/if}
+</form>