Merge pull request #123 from appwrite/refactor-empty-v2

refatctor: empty element to use falback slot
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2022-11-09 16:19:50 +01:00
commit eeb67e6e31
16 files changed
+101 -254

No files matched your search

+15 -1
View File
@@ -3,8 +3,11 @@
import { Button } from '$lib/elements/forms';
import EmptyLight from '$lib/images/empty-light.svg';
import EmptyDark from '$lib/images/empty-dark.svg';
import { Heading } from '.';
export let single = false;
export let target: string = null;
export let href: string = null;
</script>
{#if single}
@@ -17,7 +20,18 @@
<img src={EmptyLight} alt="create" aria-hidden="true" />
{/if}
</button>
<slot />
<slot>
<div class="u-text-center">
<Heading size="7" tag="h4">Create your first {target} to get started.</Heading>
<p class="body-text-2 u-margin-block-start-4">
Need a hand? Check out our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
<Button external {href} text>Documentation</Button>
<Button secondary on:click>Create {target}</Button>
</div>
</slot>
</div>
</article>
{:else}
@@ -137,28 +137,11 @@
<Button href={`/console/project-${projectId}/auth`} secondary>Clear Search</Button>
</EmptySearch>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div
class="common-section"
use:event={{
name: 'console_users',
action: 'click_create',
parameters: {
type: 'user'
}
}}>
<div class="u-text-center common-section">
<p>Create your first user to get started.</p>
<p>Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16 common-section u-main-center">
<Button external href="https://appwrite.io/docs/server/users" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create user</Button>
</div>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/server/users"
target="user"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -90,28 +90,11 @@
</Button>
</EmptySearch>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div
class="common-section"
use:event={{
name: 'console_users',
action: 'click_create',
parameters: {
type: 'team'
}
}}>
<div class="u-text-center common-section">
<p>Create your first team to get started.</p>
<p>Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16 common-section u-main-center">
<Button external href="https://appwrite.io/docs/client/teams" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create team</Button>
</div>
</div>
</Empty>
<Empty
single
on:click={() => (showCreate = true)}
href="https://appwrite.io/docs/client/teams"
target="team" />
{/if}
</Container>
@@ -97,21 +97,11 @@
>Clear Search</Button>
</EmptySearch>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Add your first member to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button
external
href="https://appwrite.io/docs/client/teams?sdk=web-default#teamsCreateMembership"
text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create membership</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/client/teams?sdk=web-default#teamsCreateMembership"
target="membership"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -58,18 +58,11 @@
sum={data.databases.total} />
</div>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first database to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create database</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases"
target="database"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -77,18 +77,11 @@
sum={data.collections.total} />
</div>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first collection to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases#collection" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create collection</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases#collection"
target="collection"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -85,37 +85,18 @@
sum={data.documents.total} />
</div>
{:else}
<Empty single on:click={openWizard}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first document to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button
external
href="https://appwrite.io/docs/databases#create-documents"
text>
Documentation
</Button>
<Button secondary on:click={openWizard}>Create document</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases#create-documents"
target="document"
on:click={openWizard} />
{/if}
{:else}
<Empty single on:click={() => (showCreateAttribute = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first attribute to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases#attributes" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreateAttribute = true)}>
Create attribute
</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases#attributes"
target="attribute"
on:click={() => (showCreateAttribute = true)} />
{/if}
</Container>
@@ -110,18 +110,11 @@
<p class="text">Total results: {$attributes.length}</p>
</div>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first attribute to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases#attributes" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create attribute</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases#attributes"
target="attribute"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -116,35 +116,18 @@
<p class="text">Total results: {$indexes.length}</p>
</div>
{:else}
<Empty single on:click={() => (showCreateIndex = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first index to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases#indexes" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreateIndex = true)}
>Create index</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/databases#indexes"
target="index"
on:click={() => (showCreateIndex = true)} />
{/if}
{:else}
<Empty single on:click={() => (showCreateAttribute = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first attribute to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/databases#attributes" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreateAttribute = true)}>
Create attribute
</Button>
</div>
</Empty>
<Empty
single
target="attribute"
href="https://appwrite.io/docs/databases#attributes"
on:click={() => (showCreateAttribute = true)} />
{/if}
</Container>
@@ -101,17 +101,10 @@
sum={data.functions.total} />
</div>
{:else}
<Empty single on:click={openWizard}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first function to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button href="https://appwrite.io/docs/functions" external text>
Documentation
</Button>
<Button secondary on:click={openWizard}>Create function</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/functions"
target="function"
on:click={openWizard} />
{/if}
</Container>
@@ -128,23 +128,11 @@
</svelte:fragment>
</CardGrid>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">
Create a new deployment, or activate an existing one to see your function in
action.
</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-12">
<Button text external href="https://appwrite.io/docs/functions#createFunction">
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>
Create deployment
</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/functions#createFunction"
target="deployment"
on:click={() => (showCreate = true)} />
{/if}
<div class="common-section">
@@ -238,21 +226,11 @@
</TableBody>
</Table>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">
Create a new deployment, or activate an existing one to see your function in
action.
</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button text external href="https://appwrite.io/docs/functions#createFunction">
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create deployment</Button>
</div>
</Empty>
<Empty
single
target="deployment"
href="https://appwrite.io/docs/functions#createFunction"
on:click={() => (showCreate = true)} />
{/if}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {data.deployments.total}</p>
@@ -59,14 +59,5 @@
</TableBody>
</Table>
{:else}
<Empty single on:click={create}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first API Key to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-12">
<Button external href="https://appwrite.io/docs/keys" text>Documentation</Button>
<Button secondary on:click={create}>Create API Key</Button>
</div>
</Empty>
<Empty single href="https://appwrite.io/docs/keys" target="API Key" on:click={create} />
{/if}
@@ -139,20 +139,11 @@
</TableBody>
</Table>
{:else}
<Empty single on:click={openWizard}>
<div class="common-section">
<div class="u-text-center common-section">
<p class="text u-line-height-1-5">Create your first domain to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16 common-section u-main-center">
<Button external href="https://appwrite.io/docs/custom-domains" text>
Documentation
</Button>
<Button secondary on:click={openWizard}>Create domain</Button>
</div>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/custom-domains"
target="domain"
on:click={openWizard} />
{/if}
</Container>
@@ -71,17 +71,10 @@
</TableBody>
</Table>
{:else}
<Empty single>
<div class="common-section u-text-center">
<p class="text u-line-height-1-5">Create your first Webhook to get started.</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16 common-section">
<Button text href="https://appwrite.io/docs/webhooks">Documentation</Button>
<Button secondary on:click={openWizard}>
<span class="text">Create Webhook</span>
</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/webhooks"
target="webhook"
on:click={openWizard} />
{/if}
</Container>
@@ -91,16 +91,11 @@
sum={data.buckets.total} />
</div>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create your first bucket to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/storage" text>Documentation</Button>
<Button secondary on:click={() => (showCreate = true)}>Create bucket</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/storage"
target="bucket"
on:click={() => (showCreate = true)} />
{/if}
</Container>
@@ -192,18 +192,11 @@
</Button>
</EmptySearch>
{:else}
<Empty single on:click={() => (showCreate = true)}>
<div class="u-text-center">
<p class="text u-line-height-1-5">Create a files to get started</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation.</p>
</div>
<div class="u-flex u-gap-16">
<Button external href="https://appwrite.io/docs/storage#createFile" text>
Documentation
</Button>
<Button secondary on:click={() => (showCreate = true)}>Create file</Button>
</div>
</Empty>
<Empty
single
href="https://appwrite.io/docs/storage#createFile"
target="file"
on:click={() => (showCreate = true)} />
{/if}
</Container>