diff --git a/src/routes/card/+page.svelte b/src/routes/card/+page.svelte new file mode 100644 index 000000000..ee82e0700 --- /dev/null +++ b/src/routes/card/+page.svelte @@ -0,0 +1,7 @@ + + + diff --git a/src/routes/console/card/+page.ts b/src/routes/card/+page.ts similarity index 100% rename from src/routes/console/card/+page.ts rename to src/routes/card/+page.ts diff --git a/src/routes/console/card/Card.svelte b/src/routes/card/Card.svelte similarity index 96% rename from src/routes/console/card/Card.svelte rename to src/routes/card/Card.svelte index 8fadf44eb..5eaf5391e 100644 --- a/src/routes/console/card/Card.svelte +++ b/src/routes/card/Card.svelte @@ -18,8 +18,10 @@ diff --git a/src/routes/card/[uid]/+page.svelte b/src/routes/card/[uid]/+page.svelte new file mode 100644 index 000000000..e3f908620 --- /dev/null +++ b/src/routes/card/[uid]/+page.svelte @@ -0,0 +1,7 @@ + + + diff --git a/src/routes/card/[uid]/+page.ts b/src/routes/card/[uid]/+page.ts new file mode 100644 index 000000000..913a47f4e --- /dev/null +++ b/src/routes/card/[uid]/+page.ts @@ -0,0 +1,16 @@ +import { redirect } from '@sveltejs/kit'; +import { getCardImgUrls } from '../helpers.js'; + +export async function load({ params }) { + const userId = params.uid; + const { frontImg } = getCardImgUrls(userId); + + const res = await fetch(frontImg); + if (!res.ok) { + throw redirect(303, '/'); + } + + return { + userId: params.uid + }; +} diff --git a/src/routes/console/card/+page.svelte b/src/routes/card/display.svelte similarity index 83% rename from src/routes/console/card/+page.svelte rename to src/routes/card/display.svelte index e4e843393..2c6ae51c9 100644 --- a/src/routes/console/card/+page.svelte +++ b/src/routes/card/display.svelte @@ -2,8 +2,12 @@ import { Confetti } from 'svelte-confetti'; import Card from './Card.svelte'; import { fade } from 'svelte/transition'; + import { getCardImgUrls } from './helpers'; + import { copy } from '$lib/helpers/copy'; + import { addNotification } from '$lib/stores/notifications'; - export let data; + export let userId: string; + export let variant: 'owner' | 'external'; let triggerConfettiKey = 1; const confettiColors = [ @@ -17,12 +21,24 @@ let cardActive = false; let cardIsFlipped = false; + + $: title = variant === 'owner' ? 'Welcome to the cloud' : 'Join the Appwrite Cloud'; + + function copyShareableLink() { + const link = `${window.location.origin}/card/${userId}`; + copy(link); + addNotification({ + title: 'Link copied', + message: 'Share your card with everyone you know!', + type: 'success' + }); + }

- Welcome to the Cloud + {title}

-
- - Cloud Beta hoodies - Cloud Beta hoodies -
+ {#if variant === 'owner'} +
+ + Cloud Beta hoodies + Cloud Beta hoodies +
+ {/if}

Cloud is live in public

Beta

- Share your Cloud card and you may win an exclusive Cloud hoodie! + {#if variant === 'owner'} + Share your Cloud card and you may win an exclusive Cloud hoodie! + {:else} + Create your Cloud account and unlock your exclusive card! + {/if}

- The front of the card + The front of the card
  • + {#if variant === 'owner'} +
  • + +
  • + {/if}
  • - -
  • -
  • -
@@ -96,7 +127,7 @@ fallDistance="50px" />
{/if} - +
{#if cardActive}