Skip to content

Commit 745a596

Browse files
Add search and view controls to sites page
Adds SearchQuery input and ViewSelector components with create site button to provide filtering and display options for the sites list.
1 parent 4a36260 commit 745a596

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@
7272

7373
<Container>
7474
{#if data.sitesLive}
75+
<Layout.Stack direction="row" justifyContent="space-between">
76+
<Layout.Stack direction="row" alignItems="center">
77+
<SearchQuery placeholder="Search by name" />
78+
</Layout.Stack>
79+
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
80+
<ViewSelector
81+
{columns}
82+
view={data.view}
83+
hideColumns
84+
hideView={!data.siteList.total} />
85+
{#if $canWriteSites}
86+
<Button on:mousedown={() => (show = true)} event="create_site" size="s">
87+
<Icon icon={IconPlus} slot="start" size="s" />
88+
Create site
89+
</Button>
90+
{/if}
91+
</Layout.Stack>
92+
</Layout.Stack>
7593
{#if data.siteList.total}
7694
{#if data.view === View.Grid}
7795
<Grid siteList={data.siteList} />

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Query } from '@appwrite.io/console';
1+
import { Query, type Models } from '@appwrite.io/console';
22
import { sdk } from '$lib/stores/sdk';
33
import { getLimit, getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/load';
44
import { CARD_LIMIT, Dependencies } from '$lib/constants';
@@ -19,7 +19,11 @@ export const load = async ({ url, depends, route, params }) => {
1919
offset,
2020
limit,
2121
search,
22-
view
22+
view,
23+
siteList: {
24+
total: 0,
25+
sites: []
26+
} as Models.SiteList
2327
};
2428

2529
const siteList = await sdk

0 commit comments

Comments
 (0)