Skip to content

Commit 8f7ce02

Browse files
Merge pull request #621 from appwrite/fix-deployments-create
fix: deployments empty state create
2 parents f7c34a1 + 8bba236 commit 8f7ce02

3 files changed

Lines changed: 41 additions & 16 deletions

File tree

src/lib/components/empty.svelte

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { trackEvent } from '$lib/actions/analytics';
88
99
export let single = false;
10+
export let noMedia = false;
1011
export let target: string = null;
1112
export let href: string = null;
1213
@@ -23,17 +24,19 @@
2324
<article class="card u-grid u-cross-center u-width-full-line common-section">
2425
<div
2526
class="u-flex u-flex-vertical u-cross-center u-gap-24 u-width-full-line u-overflow-hidden">
26-
<button
27-
type="button"
28-
on:click|preventDefault
29-
on:click={track}
30-
aria-label="create {target}">
31-
{#if $app.themeInUse === 'dark'}
32-
<img src={EmptyDark} alt="create" aria-hidden="true" width="376" />
33-
{:else}
34-
<img src={EmptyLight} alt="create" aria-hidden="true" width="376" />
35-
{/if}
36-
</button>
27+
{#if !noMedia}
28+
<button
29+
type="button"
30+
on:click|preventDefault
31+
on:click={track}
32+
aria-label="create {target}">
33+
{#if $app.themeInUse === 'dark'}
34+
<img src={EmptyDark} alt="create" aria-hidden="true" width="376" />
35+
{:else}
36+
<img src={EmptyLight} alt="create" aria-hidden="true" width="376" />
37+
{/if}
38+
</button>
39+
{/if}
3740
<slot>
3841
<div class="u-text-center">
3942
<Heading size="7" tag="h2" trimmed={false}>

src/routes/console/project-[project]/functions/function-[function]/+page.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,25 @@
152152
</div>
153153
</svelte:fragment>
154154
</CardGrid>
155+
{:else if $deploymentList.total}
156+
<Empty noMedia single>
157+
<Create secondary round>
158+
<i class="icon-plus" />
159+
</Create>
160+
<div class="u-text-center">
161+
<p class="body-text-2 u-margin-block-start-4">
162+
Add a new deployment, or activate an existing one to see your function in
163+
action. <br />Learn more about deployments in our
164+
<a
165+
class="link"
166+
target="_blank"
167+
rel="noopener noreferrer"
168+
href="https://appwrite.io/docs/products/functions/deployment"
169+
>documentation</a
170+
>.
171+
</p>
172+
</div>
173+
</Empty>
155174
{:else}
156175
<Empty single target="deployment">
157176
<div class="u-text-center">

src/routes/console/project-[project]/functions/function-[function]/create.svelte

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { showCreateDeployment } from './store';
99
1010
export let secondary = false;
11+
export let round = false;
1112
// This allows us to know which one to open when the user uses the shortcut in the command center
1213
export let main = false;
1314
let show = false;
@@ -23,11 +24,13 @@
2324
</script>
2425

2526
<DropList bind:show placement="bottom-end">
26-
<Button {secondary} on:click={() => (show = !show)} event="create_deployment">
27-
{#if !secondary}
28-
<span class="icon-plus" aria-hidden="true" />
29-
{/if}
30-
<span class="text">Create deployment</span>
27+
<Button {secondary} {round} on:click={() => (show = !show)} event="create_deployment">
28+
<slot>
29+
{#if !secondary}
30+
<span class="icon-plus" aria-hidden="true" />
31+
{/if}
32+
<span class="text">Create deployment</span>
33+
</slot>
3134
</Button>
3235
<svelte:fragment slot="list">
3336
<DropListItem

0 commit comments

Comments
 (0)