feat: remove unused search, implemented empty search

This commit is contained in:
Arman committed 2022-10-07 11:43:39 +02:00
1 parent a866c04bb1
commit 9a53461026
8 files changed
+46 -96

No files matched your search

+6
View File
@@ -2,6 +2,7 @@
import { app } from '$lib/stores/app';
import Light from '$lib/images/search-light.svg';
import Dark from '$lib/images/search-dark.svg';
import Pagination from './pagination.svelte';
</script>
<article class="card u-grid u-cross-center u-width-full-line common-section">
@@ -14,3 +15,8 @@
<slot />
</div>
</article>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: 0</p>
<Pagination limit={1} offset={0} sum={0} />
</div>
@@ -1,7 +1,7 @@
<script lang="ts">
import { page } from '$app/stores';
import { sdkForProject } from '$lib/stores/sdk';
import { Empty, Pagination, Avatar, Copy, Search } from '$lib/components';
import { Empty, EmptySearch, Pagination, Avatar, Copy, Search } from '$lib/components';
import { Button } from '$lib/elements/forms';
import {
Table,
@@ -129,21 +129,13 @@
<Pagination limit={$pageLimit} bind:offset sum={$usersList.total} />
</div>
{:else if search}
<Empty single>
<div class="u-flex u-flex-vertical">
<EmptySearch>
<div class="u-text-center">
<b>Sorry, we couldn’t find ‘{search}’</b>
<div class="common-section">
<p>There are no users that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
<p>There are no users that match your search.</p>
</div>
</Empty>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$usersList.total}</p>
<Pagination limit={$pageLimit} bind:offset sum={$usersList.total} />
</div>
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</EmptySearch>
{:else}
<Empty isButton single on:click={() => (showCreate = true)}>
<div
@@ -11,7 +11,7 @@
TableCell
} from '$lib/elements/table';
import { Button } from '$lib/elements/forms';
import { Empty, Pagination, Avatar, Search } from '$lib/components';
import { Empty, EmptySearch, Pagination, Avatar, Search } from '$lib/components';
import Create from '../_createTeam.svelte';
import { goto } from '$app/navigation';
import { event } from '$lib/actions/analytics';
@@ -84,21 +84,13 @@
<Pagination limit={$pageLimit} bind:offset sum={$teamsList.total} />
</div>
{:else if search}
<Empty single>
<div class="common-section ">
<EmptySearch>
<div class="u-text-center">
<b>Sorry, we couldn’t find ‘{search}’</b>
</div>
<div class="common-section">
<p>There are no teams that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
</Empty>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$teamsList.total}</p>
<Pagination limit={$pageLimit} bind:offset sum={$teamsList.total} />
</div>
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</EmptySearch>
{:else}
<Empty isButton single on:click={() => (showCreate = true)}>
<div
@@ -1,6 +1,6 @@
<script lang="ts">
import { page } from '$app/stores';
import { Pagination, Empty, Avatar, Search } from '$lib/components';
import { Pagination, Empty, EmptySearch, Avatar, Search } from '$lib/components';
import {
Table,
TableHeader,
@@ -106,23 +106,13 @@
<Pagination limit={$pageLimit} bind:offset sum={$memberships.total} />
</div>
{:else if search}
<Empty>
<div class="u-flex u-flex-vertical">
<EmptySearch>
<div class="u-text-center">
<b>Sorry, we couldn’t find ‘{search}’</b>
<div class="common-section">
<p>There are no members that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
<p>There are no members that match your search.</p>
</div>
</Empty>
<div
class="u-flex u-margin-block-start-32
u-main-space-between">
<p class="text">Total results: {$memberships.total}</p>
<Pagination limit={$pageLimit} bind:offset sum={$memberships.total} />
</div>
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</EmptySearch>
{:else}
<Empty isButton single on:click={() => (showCreate = true)}>
<p>Add your first member to get started</p>
@@ -12,7 +12,6 @@
import { cardLimit } from '$lib/stores/layout';
let showCreate = false;
let search = '';
let offset = 0;
const project = $page.params.project;
@@ -24,8 +23,7 @@
);
};
$: collections.load(databaseId, [Query.limit($cardLimit), Query.offset(offset)], search);
$: if (search) offset = 0;
$: collections.load(databaseId, [Query.limit($cardLimit), Query.offset(offset)]);
</script>
<Container>
@@ -69,22 +67,6 @@
<p class="text">Total results: {$collections.total}</p>
<Pagination limit={$cardLimit} bind:offset sum={$collections.total} />
</div>
{:else if search}
<Empty>
<div class="u-flex u-flex-vertical">
<b>Sorry, we couldn’t find ‘{search}’</b>
<div class="common-section">
<p>There are no collections that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
</div>
</Empty>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$collections?.total}</p>
<Pagination limit={$cardLimit} bind:offset sum={$collections?.total} />
</div>
{:else}
<Empty isButton single on:click={() => (showCreate = true)}>
<p>Create your first collection to get started</p>
@@ -1,6 +1,13 @@
<script lang="ts">
import { page } from '$app/stores';
import { Empty, Pagination, Search, DropList, DropListItem } from '$lib/components';
import {
Empty,
EmptySearch,
Pagination,
Search,
DropList,
DropListItem
} from '$lib/components';
import { Button } from '$lib/elements/forms';
import { Pill } from '$lib/elements';
import {
@@ -140,21 +147,13 @@
<Pagination limit={$pageLimit} bind:offset sum={$indexList?.total} />
</div>
{:else if search}
<Empty>
<div class="u-flex u-flex-vertical">
<EmptySearch>
<div class="u-text-center">
<b>Sorry, we couldn’t find ‘{search}’</b>
<div class="common-section">
<p>There are no indexes that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
<p>There are no indexes that match your search.</p>
</div>
</Empty>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$indexList?.total}</p>
<Pagination limit={$pageLimit} bind:offset sum={$indexList?.total} />
</div>
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</EmptySearch>
{:else if $collection.indexes?.length}
<Empty isButton single on:click={() => (showCreateIndex = true)}>
<p>Create your first attribute to get started</p>
@@ -6,17 +6,13 @@ import { cachedStore } from '$lib/helpers/cache';
export const collections = cachedStore<
Models.CollectionList,
{
load: (databaseId: string, queries: string[], search: string) => Promise<void>;
load: (databaseId: string, queries: string[]) => Promise<void>;
total: (databaseId: string, id: string) => Promise<Record<string, unknown>>;
}
>('collections', function ({ set }) {
return {
load: async (databaseId, queries, search) => {
const response = await sdkForProject.databases.listCollections(
databaseId,
queries,
search
);
load: async (databaseId, queries) => {
const response = await sdkForProject.databases.listCollections(databaseId, queries);
set(response);
},
total: async (databaseId, id) => {
@@ -5,6 +5,7 @@
import { Button } from '$lib/elements/forms';
import {
Empty,
EmptySearch,
Pagination,
Avatar,
Search,
@@ -179,21 +180,13 @@
<Pagination limit={$pageLimit} bind:offset sum={$files.total} />
</div>
{:else if search}
<Empty>
<div class="u-flex u-flex-vertical">
<EmptySearch>
<div class="u-text-center">
<b>Sorry, we couldn’t find ‘{search}’</b>
<div class="common-section">
<p>There are no files that match your search.</p>
</div>
<div class="common-section">
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</div>
<p>There are no files that match your search.</p>
</div>
</Empty>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {$files?.total}</p>
<Pagination limit={$pageLimit} bind:offset sum={$files?.total} />
</div>
<Button secondary on:click={() => (search = '')}>Clear Search</Button>
</EmptySearch>
{:else}
<Empty isButton single on:click={() => (showCreate = true)}>
<p>Upload some files to get started</p>