Skip to content

Commit 34de9f5

Browse files
committed
add: sites waitlist again.
1 parent a2a93e8 commit 34de9f5

File tree

2 files changed

+71
-9
lines changed

2 files changed

+71
-9
lines changed

src/lib/helpers/waitlist.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { sdk } from '$lib/stores/sdk';
2+
import { type Account } from '$lib/stores/user';
3+
4+
export const joinWaitlistSites = (user: Account) => {
5+
const prefs = user.prefs;
6+
const newPrefs = {
7+
...prefs,
8+
joinWaitlistSites: true
9+
};
10+
11+
sdk.forConsole.account.updatePrefs(newPrefs);
12+
13+
if (sessionStorage) {
14+
sessionStorage.setItem('joinWaitlistSites', 'true');
15+
}
16+
};
17+
18+
export const isOnWaitlistSites = (user: Account): boolean => {
19+
const prefs = user.prefs;
20+
const joinedInPrefs = 'joinWaitlistSites' in prefs;
21+
22+
let joinedInSession = false;
23+
if (sessionStorage) {
24+
joinedInSession = sessionStorage.getItem('joinWaitlistSites') === 'true';
25+
}
26+
27+
return joinedInSession || joinedInPrefs;
28+
};

src/routes/(console)/project-[region]-[project]/sites/+page.svelte

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@
2929
import { Dependencies } from '$lib/constants';
3030
import { sdk } from '$lib/stores/sdk';
3131
import { isSmallViewport } from '$lib/stores/viewport';
32+
import { addNotification } from '$lib/stores/notifications';
33+
import { isOnWaitlistSites, joinWaitlistSites } from '$lib/helpers/waitlist';
34+
import { user } from '$lib/stores/user';
3235
3336
export let data;
3437
3538
let show = false;
39+
let isOnWaitlist = isOnWaitlistSites($user);
3640
3741
$: $registerCommands([
3842
{
@@ -68,6 +72,17 @@
6872
? EmptyLightMobile
6973
: EmptyLight;
7074
$: imgClass = $isSmallViewport ? 'mobile' : 'desktop';
75+
76+
function addToWaitlist() {
77+
joinWaitlistSites($user);
78+
addNotification({
79+
type: 'success',
80+
title: 'Waitlist joined',
81+
message: "We'll let you know as soon as Appwrite Sites is ready for you."
82+
});
83+
84+
isOnWaitlist = true;
85+
}
7186
</script>
7287

7388
<Container>
@@ -120,18 +135,37 @@
120135
<img src={imgSrc} alt="create" aria-hidden="true" height="242" class={imgClass} />
121136

122137
<Layout.Stack>
123-
<Layout.Stack gap="m" alignItems="center">
138+
{#if isOnWaitlist}
124139
<Typography.Title size="s" align="center" color="--fgcolor-neutral-primary">
125-
Appwrite Sites is in high demand
140+
You've successfully joined the Sites waitlist
126141
</Typography.Title>
127142

128-
<div style:max-width="600px">
129-
<Typography.Text align="center" color="--fgcolor-neutral-secondary">
130-
To ensure a smooth experience for everyone, we’re rolling out access
131-
gradually.
132-
</Typography.Text>
133-
</div>
134-
</Layout.Stack>
143+
<Typography.Text align="center" color="--fgcolor-neutral-secondary">
144+
We can't wait for you to try out Sites on Cloud. You will get access
145+
soon.
146+
</Typography.Text>
147+
{:else}
148+
<Layout.Stack gap="m" alignItems="center">
149+
<Typography.Title
150+
size="s"
151+
align="center"
152+
color="--fgcolor-neutral-primary">
153+
Appwrite Sites is in high demand
154+
</Typography.Title>
155+
156+
<div style:max-width="600px">
157+
<Typography.Text align="center" color="--fgcolor-neutral-secondary">
158+
To ensure a smooth experience for everyone, we’re rolling out
159+
access gradually. Join the waitlist and be one of the first to
160+
deploy with Sites.
161+
</Typography.Text>
162+
</div>
163+
164+
<div style:margin-block-start="1rem">
165+
<Button on:click={addToWaitlist}>Join waitlist</Button>
166+
</div>
167+
</Layout.Stack>
168+
{/if}
135169
</Layout.Stack>
136170
</Layout.Stack>
137171
</Card.Base>

0 commit comments

Comments
 (0)