Skip to content

Commit 4a36260

Browse files
Add Sites feature flag and unavailable state
Display waitlist message when Sites feature is disabled. The feature can be toggled via the sitesLive flag and includes responsive mobile images for the unavailable state.
1 parent 33bd0c3 commit 4a36260

File tree

2 files changed

+68
-35
lines changed

2 files changed

+68
-35
lines changed

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

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
import { isServiceLimited } from '$lib/stores/billing';
1212
import { organization } from '$lib/stores/organization';
1313
import { canWriteSites } from '$lib/stores/roles.js';
14-
import { Icon, Layout } from '@appwrite.io/pink-svelte';
14+
import { Card, Icon, Layout, Typography } from '@appwrite.io/pink-svelte';
1515
import { Button } from '$lib/elements/forms';
1616
import { app } from '$lib/stores/app';
1717
import CreateSiteModal from './createSiteModal.svelte';
1818
import EmptyLight from './(images)/empty-sites-light.svg';
1919
import EmptyDark from './(images)/empty-sites-dark.svg';
20+
import EmptyLightMobile from './(images)/empty-sites-light-mobile.svg';
21+
import EmptyDarkMobile from './(images)/empty-sites-dark-mobile.svg';
2022
import Grid from './grid.svelte';
2123
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
2224
import { columns } from './store';
@@ -26,6 +28,7 @@
2628
import { invalidate } from '$app/navigation';
2729
import { Dependencies } from '$lib/constants';
2830
import { sdk } from '$lib/stores/sdk';
31+
import { isSmallViewport } from '$lib/stores/viewport';
2932
3033
export let data;
3134
@@ -55,46 +58,65 @@
5558
}
5659
});
5760
});
61+
62+
$: isDark = $app.themeInUse === 'dark';
63+
$: imgSrc = isDark
64+
? $isSmallViewport
65+
? EmptyDarkMobile
66+
: EmptyDark
67+
: $isSmallViewport
68+
? EmptyLightMobile
69+
: EmptyLight;
70+
$: imgClass = $isSmallViewport ? 'mobile' : 'desktop';
5871
</script>
5972

6073
<Container>
61-
<Layout.Stack direction="row" justifyContent="space-between">
62-
<Layout.Stack direction="row" alignItems="center">
63-
<SearchQuery placeholder="Search by name" />
64-
</Layout.Stack>
65-
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
66-
<ViewSelector {columns} view={data.view} hideColumns hideView={!data.siteList.total} />
67-
{#if $canWriteSites}
68-
<Button on:mousedown={() => (show = true)} event="create_site" size="s">
69-
<Icon icon={IconPlus} slot="start" size="s" />
70-
Create site
71-
</Button>
74+
{#if data.sitesLive}
75+
{#if data.siteList.total}
76+
{#if data.view === View.Grid}
77+
<Grid siteList={data.siteList} />
78+
{:else}
79+
<Table siteList={data.siteList} />
7280
{/if}
73-
</Layout.Stack>
74-
</Layout.Stack>
75-
{#if data.siteList.total}
76-
{#if data.view === View.Grid}
77-
<Grid siteList={data.siteList} />
81+
<PaginationWithLimit
82+
name="Sites"
83+
limit={data.limit}
84+
offset={data.offset}
85+
total={data.siteList.total} />
86+
{:else if data.search}
87+
<EmptySearch target="sites" />
7888
{:else}
79-
<Table siteList={data.siteList} />
89+
<Empty
90+
single
91+
allowCreate={$canWriteSites}
92+
href="https://appwrite.io/docs/products/sites"
93+
description="Deploy and manage your web your web applications with Sites. "
94+
target="site"
95+
src={$app.themeInUse === 'dark' ? EmptyDark : EmptyLight}
96+
on:click={() => (show = true)}>
97+
</Empty>
8098
{/if}
81-
<PaginationWithLimit
82-
name="Sites"
83-
limit={data.limit}
84-
offset={data.offset}
85-
total={data.siteList.total} />
86-
{:else if data.search}
87-
<EmptySearch target="sites" />
8899
{:else}
89-
<Empty
90-
single
91-
allowCreate={$canWriteSites}
92-
href="https://appwrite.io/docs/products/sites"
93-
description="Deploy and manage your web your web applications with Sites. "
94-
target="site"
95-
src={$app.themeInUse === 'dark' ? EmptyDark : EmptyLight}
96-
on:click={() => (show = true)}>
97-
</Empty>
100+
<Card.Base padding="m">
101+
<Layout.Stack gap="xxl">
102+
<img src={imgSrc} alt="create" aria-hidden="true" height="242" class={imgClass} />
103+
104+
<Layout.Stack>
105+
<Layout.Stack gap="m" alignItems="center">
106+
<Typography.Title size="s" align="center" color="--fgcolor-neutral-primary">
107+
Appwrite Sites is in high demand
108+
</Typography.Title>
109+
110+
<div style:max-width="600px">
111+
<Typography.Text align="center" color="--fgcolor-neutral-secondary">
112+
To ensure a smooth experience for everyone, we’re rolling out access
113+
gradually.
114+
</Typography.Text>
115+
</div>
116+
</Layout.Stack>
117+
</Layout.Stack>
118+
</Layout.Stack>
119+
</Card.Base>
98120
{/if}
99121
</Container>
100122

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ import { CARD_LIMIT, Dependencies } from '$lib/constants';
55

66
export const load = async ({ url, depends, route, params }) => {
77
depends(Dependencies.SITES);
8-
98
const page = getPage(url);
109
const search = getSearch(url);
1110
const limit = getLimit(url, route, CARD_LIMIT);
1211
const offset = pageToOffset(page, limit);
1312
const view = getView(url, route, View.Grid, View.Grid);
1413

14+
const sitesLive = false;
15+
16+
if (!sitesLive)
17+
return {
18+
sitesLive,
19+
offset,
20+
limit,
21+
search,
22+
view
23+
};
24+
1525
const siteList = await sdk
1626
.forProject(params.region, params.project)
1727
.sites.list(
@@ -20,6 +30,7 @@ export const load = async ({ url, depends, route, params }) => {
2030
);
2131

2232
return {
33+
sitesLive,
2334
offset,
2435
limit,
2536
search,

0 commit comments

Comments
 (0)