Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud 1.2.x #489

Closed
wants to merge 130 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
2f6ba45
feat: add support foor db pools
christyjacob4 Nov 17, 2022
4e2cece
fix: issues with usage
christyjacob4 Nov 17, 2022
e2b2442
Merge branch 'main' of https://github.com/appwrite/console into db-po…
christyjacob4 Nov 18, 2022
6aa50b8
feat: linter
christyjacob4 Nov 18, 2022
21c3d07
Sum stats instead of last
Meldiron Nov 21, 2022
25d2817
Merge branch 'main' of https://github.com/appwrite/console into db-po…
christyjacob4 Nov 22, 2022
b1a81a3
Merge branch 'main' of https://github.com/appwrite/console into db-po…
christyjacob4 Nov 22, 2022
759f3e2
Merge pull request #172 from appwrite/fix-overview-stats
christyjacob4 Nov 23, 2022
7fbec8e
Sum stats on usage page
Meldiron Nov 24, 2022
7339664
Fix executions usage
Meldiron Nov 24, 2022
0dfe71e
Fix missing error stats
Meldiron Nov 24, 2022
a65602f
Merge pull request #193 from appwrite/fix-usage-stats
christyjacob4 Nov 24, 2022
c1ac638
Merge branch 'main' of https://github.com/appwrite/console into db-po…
christyjacob4 Nov 25, 2022
43891a5
feat: update key for cloud and self-hosted
christyjacob4 Dec 18, 2022
d867461
feat: custom signup
ArmanNik Jan 13, 2023
b07128c
feat: add function
ArmanNik Jan 18, 2023
839aa1e
feat: account creation
ArmanNik Jan 18, 2023
a10648f
fix: tmp fallback for import?
ArmanNik Jan 18, 2023
8d90fad
feat: add tracking event
ArmanNik Jan 18, 2023
7032182
feat: add mlh
ArmanNik Jan 18, 2023
3c84dce
feat: move route, add custom img & title
ArmanNik Jan 18, 2023
d64fc2c
Merge branch 'feat-custom-signup' of github.com:appwrite/console into…
ArmanNik Jan 18, 2023
453f010
support usage metrics update
shimonewman Feb 7, 2023
7140e19
support usage metrics update
shimonewman Feb 7, 2023
3eadb55
support usage metrics update
shimonewman Feb 8, 2023
9d414f4
tmp-console-sdk
shimonewman Feb 8, 2023
760bfe3
tmp-console-sdk
shimonewman Feb 8, 2023
5f985d8
period links fix
shimonewman Feb 14, 2023
59cf3b0
period links fix
shimonewman Feb 14, 2023
740a794
period links fix
shimonewman Feb 15, 2023
a48bfeb
period links fix
shimonewman Feb 15, 2023
7f18d08
console sdk update
shimonewman Feb 16, 2023
16843f3
refactor: remove empty parent awaits
TGlide Mar 8, 2023
d171b33
refactor: change sdkForProject to a function
TGlide Mar 8, 2023
53c77dd
refactor: add sdk export
TGlide Mar 8, 2023
3ae953a
refactor: import sdk everywhere
TGlide Mar 8, 2023
e4cb016
refactor: replace sdkForConsole with sdk.forConsole
TGlide Mar 8, 2023
ef94411
refactor: replace sdkForProject() with sdk.forProject
TGlide Mar 8, 2023
f7c92b4
refactor: remove parent imports
TGlide Mar 8, 2023
5286b10
refactor: remove parent imports
TGlide Mar 8, 2023
bdc14ac
adding the missing quotes to JSON example
kabhamo Mar 9, 2023
8ec063c
test: add sdkForProject tests
TGlide Mar 9, 2023
1de6ab3
Merge branch 'appwrite:main' into fix-4940-missing-properties-josn-qu…
kabhamo Mar 9, 2023
f4542df
feat: smart forms
TorstenDittmann Mar 9, 2023
c21085f
feat: implement smart forms everywhere
TorstenDittmann Mar 9, 2023
9908338
tests: fix tests
TorstenDittmann Mar 9, 2023
6d7c6b9
fix: improve button logic
TorstenDittmann Mar 9, 2023
c0abf5b
fix: improve button readability
TorstenDittmann Mar 9, 2023
d339433
ci: update setup-node
TorstenDittmann Mar 9, 2023
8d11cef
fix: update Documentation hyperlink on empty sessions page
Pranav2612000 Mar 11, 2023
42f7a9e
refactor: remove members role col
TGlide Mar 14, 2023
0ccdcdc
feat: clickable member avatars
TGlide Mar 14, 2023
63aeccd
Updated danger zone to delete x
eldadfux Mar 14, 2023
a36a754
Updated comperssion card
eldadfux Mar 14, 2023
c4a1b2c
File extenstions card
eldadfux Mar 14, 2023
9b7c925
Removed `Update` prefix
eldadfux Mar 14, 2023
9e5a3ba
refactor: revert resend removal
TGlide Mar 15, 2023
2a489b7
fix: wrong docs link
TGlide Mar 15, 2023
e108b9a
refactor: make table sticky scroll only when overflowing
TGlide Mar 15, 2023
3c4e495
fix: wrong heading max file size
ArmanNik Mar 17, 2023
c14ce7e
refactor: rename buttons
TGlide Mar 17, 2023
73ab8c4
Merge branch 'main' into refactor/remove-parent-awaits
TorstenDittmann Mar 20, 2023
2c8d298
Merge pull request #348 from appwrite/refactor/rename-buttons
TorstenDittmann Mar 20, 2023
a49ef96
Merge pull request #345 from appwrite/fix/auth-docs-link
TorstenDittmann Mar 20, 2023
879fdd4
Merge pull request #347 from appwrite/fix-wrong-heading-max-file-size
TorstenDittmann Mar 20, 2023
487de8e
Merge pull request #341 from appwrite/feat/clickable-member-avatars
TorstenDittmann Mar 20, 2023
6936041
Merge pull request #340 from appwrite/refacotr/remove-role-column
TorstenDittmann Mar 20, 2023
c763227
Merge branch 'main' of https://github.com/appwrite/appwrite-console-p…
TorstenDittmann Mar 20, 2023
baaf9f1
Merge pull request #328 from appwrite/refactor/remove-parent-awaits
TorstenDittmann Mar 20, 2023
e091f99
Merge branch 'main' of https://github.com/appwrite/appwrite-console-p…
TorstenDittmann Mar 20, 2023
2c2b4ce
fix: some other forms
TorstenDittmann Mar 20, 2023
666b974
tests: add tests for new form
TorstenDittmann Mar 20, 2023
a7f56ee
tests: fix tests
TorstenDittmann Mar 20, 2023
d218cd5
tests: extend forms tests
TorstenDittmann Mar 20, 2023
4fd460d
Merge pull request #334 from appwrite/feat-smart-forms
TorstenDittmann Mar 20, 2023
47bb04c
Merge branch 'main' into fix-5189-update-documentation-link-on-empty-…
TorstenDittmann Mar 20, 2023
d906c91
Merge pull request #337 from Pranav2612000/fix-5189-update-documentat…
TorstenDittmann Mar 20, 2023
b09af13
Merge branch 'main' into feat-update-card-titles
TorstenDittmann Mar 20, 2023
d5cac3d
Merge pull request #343 from appwrite/feat-update-card-titles
TorstenDittmann Mar 20, 2023
532bd07
Merge pull request #346 from appwrite/refactor/sticky-scroll-only-on-…
TorstenDittmann Mar 20, 2023
dfe842c
Merge pull request #333 from kabhamo/fix-4940-missing-properties-josn…
TorstenDittmann Mar 20, 2023
a7575c0
fix: json
TorstenDittmann Mar 20, 2023
6fc1a60
sync against main
shimonewman Mar 21, 2023
e1552fa
sync against main
shimonewman Mar 21, 2023
bdb2acc
sync against main
shimonewman Apr 19, 2023
297f5f2
Add GitHub OAuth
Meldiron Apr 19, 2023
3835c13
reverting 3 commits
shimonewman Apr 19, 2023
6d1e9f7
Revert "sync against main"
shimonewman Apr 19, 2023
2b83ac3
Revert "sync against main" 2
shimonewman Apr 19, 2023
f58780f
removed unused vars + depress [any] type check
shimonewman Apr 19, 2023
7b64ac1
Merge branch 'cloud-current' of https://github.com/appwrite/console i…
christyjacob4 Apr 19, 2023
47213f5
adjustments
shimonewman Apr 20, 2023
513b6c3
Merge pull request #413 from appwrite/christy-usage-test
christyjacob4 Apr 20, 2023
94e3060
feat: add cloud beta card page
TGlide Apr 21, 2023
cd4649f
refactor: beta card adjustments & light mode
TGlide Apr 24, 2023
7fd8d0a
feat: responsive
TGlide Apr 24, 2023
1575995
refactor: change cloud-beta-card root dir
TGlide Apr 24, 2023
78452a0
fix: cloud beta card route
TGlide Apr 24, 2023
4f1fd88
Merge remote-tracking branch 'origin/feat-oauth' into feat/cloud-beta…
TGlide Apr 26, 2023
9b7369b
feat: get cloud cards from backend
TGlide Apr 26, 2023
3ba6275
feat: beta signup page desktop
TGlide Apr 26, 2023
df43167
feat: floating signup clouds
TGlide Apr 26, 2023
acccfb0
feat: cloud signup page
TGlide Apr 26, 2023
a54ac16
feat: style github link
TGlide Apr 27, 2023
032d301
feat: claim your card btn
TGlide Apr 27, 2023
61de491
refactor: header animation
TGlide Apr 27, 2023
177c528
refactor(wip): card routes
TGlide Apr 28, 2023
71147c6
feat: shareable card link
TGlide Apr 28, 2023
32b2fab
feat: embed cloud card code
TGlide Apr 28, 2023
186a4ca
feat: tweet it btn
TGlide Apr 28, 2023
1083624
fix: light theme stuff
TGlide Apr 28, 2023
b4cf8a1
refactor: prefers reduced motion
TGlide Apr 28, 2023
8c41e93
chore: force redeploy
TGlide Apr 28, 2023
dca8acf
refactor: small changes
TGlide Apr 28, 2023
722ce7b
feat: github btn styling
TGlide Apr 28, 2023
a07a788
chore: force redeploy
TGlide Apr 28, 2023
fa43e28
fix: GitHub naming
TGlide Apr 28, 2023
6a073a9
feat: card seo
TGlide Apr 28, 2023
811716d
chore: remove mocked card
TGlide Apr 28, 2023
5017dbb
fix: seo
TGlide Apr 28, 2023
1d579ca
Merge pull request #421 from appwrite/feat/cloud-beta-card
christyjacob4 Apr 28, 2023
6ce5f46
fix: broken build
TGlide Apr 28, 2023
163a234
fix: cloud card endpoint
TGlide Apr 28, 2023
a7ef769
feat: trigger card page on first login
TGlide Apr 29, 2023
2bec09c
refactor: cloud design review
TGlide Apr 30, 2023
7d4bc2f
Merge branch 'cloud-current' of https://github.com/appwrite/console i…
christyjacob4 Aug 4, 2023
e33335b
Merge branch 'cloud-1.1.x' of https://github.com/appwrite/console int…
christyjacob4 Aug 4, 2023
a7a4009
fix: build errors
christyjacob4 Aug 4, 2023
e760d47
Merge branch 'cloud-1.2.x' of https://github.com/appwrite/console int…
christyjacob4 Aug 4, 2023
9c6dd2d
Merge pull request #255 from appwrite/new-usage-support
christyjacob4 Aug 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
VITE_APPWRITE_ENDPOINT=
VITE_APPWRITE_ENDPOINT=https://localhost/v1
VITE_APPWRITE_GROWTH_ENDPOINT=
VITE_GA_PROJECT=
VITE_SENTRY_DSN=
VITE_CONSOLE_MODE=self-hosted
VITE_CONSOLE_MODE=cloud
VITE_CONSOLE_TIER=base
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
# - name: Audit dependencies
Expand Down
7 changes: 7 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
# and commit this file to your remote git repository to share the goodness with others.

tasks:
- init: npm install && npm run build
command: npm run dev
1,930 changes: 979 additions & 951 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@analytics/google-analytics": "^1.0.5",
"@analytics/google-tag-manager": "^0.5.3",
"@appwrite.io/pink": "^0.0.4",
"@aw-labs/appwrite-console": "^13.1.0",
"@aw-labs/appwrite-console": "npm:appwrite-shimon@^7.2.4",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.36.0",
"@sentry/tracing": "^7.36.0",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/avatarInitials.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import { sdkForConsole } from '$lib/stores/sdk';
import { sdk } from '$lib/stores/sdk';
import Avatar from './avatar.svelte';

export let name: string;
export let size: number;

$: src = sdkForConsole.avatars.getInitials(name, size * 2, size * 2).toString();
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2).toString();
</script>

<Avatar {name} {size} {src} />
25 changes: 20 additions & 5 deletions src/lib/components/card.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
<script lang="ts">
import { clickOnEnter } from '$lib/helpers/a11y';

type BaseProps = {
isTile?: boolean;
isDashed?: boolean;
danger?: boolean;
};

type ButtonProps = {
isButton: true;
href?: never;
};

type AnchorProps = {
href: string;
isButton?: never;
};

type $$Props = BaseProps & (ButtonProps | AnchorProps | BaseProps);

export let isTile = false;
export let isDashed = false;
export let isButton = false;
export let danger = false;
export let href: string = null;

//allows to add the href attribute without throwing an error
let attributes = { href } as Record<string, string>;

function getElement(): string {
function getElement() {
switch (true) {
case !!href:
return 'a';
Expand All @@ -30,6 +45,6 @@
class:is-danger={danger}
on:click
on:keyup={clickOnEnter}
{...attributes}>
{href}>
<slot />
</svelte:element>
2 changes: 1 addition & 1 deletion src/lib/components/code.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
});
</script>

<section class="box u-overflow-hidden " class:common-section={!noMargin}>
<section class="box u-overflow-hidden" class:common-section={!noMargin}>
<div
class="controls u-position-absolute u-inset-inline-end-8 u-inset-block-start-8 u-flex u-gap-8">
{#if label}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/dropList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<section
class:u-overflow-y-auto={scrollable}
class:u-max-height-200={scrollable}
class="drop-section ">
class="drop-section">
<ul class="drop-list">
<slot name="list" />
</ul>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/eventModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
}
</script>

<Modal bind:show on:submit={create} size="big">
<Modal bind:show onSubmit={create} size="big">
<svelte:fragment slot="header">Create Event</svelte:fragment>
<slot />
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/feedbackGeneral.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
Your feedback is important to us. Please be honest and tell us what you think.
</div>

<Form on:submit={handleSubmit}>
<Form onSubmit={handleSubmit}>
<FormList>
<InputText
label="name"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/feedbackNPS.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
think.
</div>

<Form on:submit={handleSubmit}>
<Form onSubmit={handleSubmit}>
<Evaluation bind:value>
How likely are you to recommend Appwrite to a friend or colleague?
</Evaluation>
Expand Down
9 changes: 6 additions & 3 deletions src/lib/components/modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import { Alert } from '$lib/components';
import { trackEvent } from '$lib/actions/analytics';
import { Form } from '$lib/elements/forms';

export let show = false;
export let size: 'small' | 'big' = null;
export let warning = false;
export let error: string = null;
export let closable = true;
export let onSubmit: () => Promise<void> | void = function () {
return;
};

let dialog: HTMLDialogElement;
let alert: HTMLElement;
Expand Down Expand Up @@ -77,8 +81,7 @@
class:is-big={size === 'big'}
bind:this={dialog}>
{#if show}
<!-- svelte-ignore a11y-no-redundant-roles -->
<form class="modal-form" role="form" on:submit|preventDefault>
<Form isModal {onSubmit}>
<header class="modal-header">
{#if warning}
<div class="avatar is-warning is-medium">
Expand Down Expand Up @@ -127,6 +130,6 @@
</div>
</div>
{/if}
</form>
</Form>
{/if}
</dialog>
4 changes: 2 additions & 2 deletions src/lib/components/permissions/custom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$: disabled = !value || $groups.has(value);
</script>

<Modal bind:show on:close={reset} on:submit={create}>
<Modal bind:show on:close={reset} onSubmit={create}>
<svelte:fragment slot="header">Custom permission</svelte:fragment>
<p class="text">
Custom permissions allow you to grant access to specific users or teams using their ID and
Expand All @@ -44,6 +44,6 @@
</FormList>

<svelte:fragment slot="footer">
<Button submit {disabled}>Create</Button>
<Button submit {disabled}>Add</Button>
</svelte:fragment>
</Modal>
10 changes: 5 additions & 5 deletions src/lib/components/permissions/row.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip';
import { sdkForProject } from '$lib/stores/sdk';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import { tick } from 'svelte';
import { AvatarInitials } from '../';
Expand All @@ -18,11 +18,11 @@
const role = permission.split(':')[0];
const id = permission.split(':')[1].split('/')[0];
if (role === 'user') {
const user = await sdkForProject.users.get(id);
const user = await sdk.forProject.users.get(id);
return user;
}
if (role === 'team') {
const team = await sdkForProject.teams.get(id);
const team = await sdk.forProject.teams.get(id);
return team;
}
}
Expand Down Expand Up @@ -68,13 +68,13 @@
{@const isAnonymous = !data.email && !data.phone && isUser}
<div class="user-profile">
{#if isAnonymous}
<div class="avatar is-size-small ">
<div class="avatar is-size-small">
<span class="icon-anonymous" aria-hidden="true" />
</div>
{:else if data.name}
<AvatarInitials name={data.name} size={40} />
{:else}
<div class="avatar is-size-small ">
<div class="avatar is-size-small">
<span class="icon-minus-sm" aria-hidden="true" />
</div>
{/if}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/permissions/team.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Button, InputSearch } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { sdkForProject } from '$lib/stores/sdk';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import type { Writable } from 'svelte/store';
Expand Down Expand Up @@ -31,7 +31,7 @@

async function request() {
if (!show) return;
results = await sdkForProject.teams.list([Query.limit(5), Query.offset(offset)], search);
results = await sdk.forProject.teams.list([Query.limit(5), Query.offset(offset)], search);
}

function onSelection(event: Event, role: string) {
Expand All @@ -58,7 +58,7 @@
}
</script>

<Modal bind:show on:submit={create} on:close={reset} size="big">
<Modal bind:show onSubmit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select teams</svelte:fragment>
<p class="text">
Grant access to any member of a specific team. To grant access to team members with specific
Expand Down Expand Up @@ -144,6 +144,6 @@
{/if}

<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
<Button submit disabled={!hasSelection}>Add</Button>
</svelte:fragment>
</Modal>
12 changes: 6 additions & 6 deletions src/lib/components/permissions/user.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Button, InputSearch } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import { sdkForProject } from '$lib/stores/sdk';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import type { Writable } from 'svelte/store';
import type { Permission } from './permissions.svelte';
Expand Down Expand Up @@ -31,7 +31,7 @@

async function request() {
if (!show) return;
results = await sdkForProject.users.list([Query.limit(5), Query.offset(offset)], search);
results = await sdk.forProject.users.list([Query.limit(5), Query.offset(offset)], search);
}

function onSelection(event: Event, role: string) {
Expand All @@ -58,7 +58,7 @@
}
</script>

<Modal bind:show on:submit={create} on:close={reset} size="big">
<Modal bind:show onSubmit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select users</svelte:fragment>
<p class="text">Grant access to any authenticated or anonymous user.</p>
<InputSearch
Expand Down Expand Up @@ -96,7 +96,7 @@
<div class="u-x-small">{user.$id}</div>
</div>
{:else}
<div class="avatar is-size-small ">
<div class="avatar is-size-small">
<span class="icon-minus-sm" aria-hidden="true" />
</div>
<div class="u-line-height-1-5">
Expand All @@ -107,7 +107,7 @@
</div>
{/if}
{:else}
<div class="avatar is-size-small ">
<div class="avatar is-size-small">
<span class="icon-anonymous" aria-hidden="true" />
</div>
<div class="u-line-height-1-5">
Expand Down Expand Up @@ -163,6 +163,6 @@
{/if}

<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
<Button submit disabled={!hasSelection}>Add</Button>
</svelte:fragment>
</Modal>
4 changes: 2 additions & 2 deletions src/lib/components/uploadBox.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script lang="ts">
import { uploader } from '$lib/stores/uploader';
import { Pill } from '$lib/elements';
import { sdkForProject } from '$lib/stores/sdk';
import { sdk } from '$lib/stores/sdk';
import { Avatar } from '$lib/components';
import { base } from '$app/paths';
import { page } from '$app/stores';

let hovering = false;

const getPreview = (fileId: string, bucketId: string) =>
sdkForProject.storage.getFilePreview(bucketId, fileId, 32, 32).toString() + '&mode=admin';
sdk.forProject.storage.getFilePreview(bucketId, fileId, 32, 32).toString() + '&mode=admin';
</script>

{#if $uploader?.isOpen}
Expand Down
13 changes: 11 additions & 2 deletions src/lib/elements/forms/button.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script lang="ts">
import { trackEvent } from '$lib/actions/analytics';
import { getContext, hasContext } from 'svelte';
import { readable } from 'svelte/store';
import type { FormContext } from './form.svelte';

export let submit = false;
export let secondary = false;
Expand All @@ -15,8 +18,14 @@
export let noMargin = false;
export let event: string = null;

const isSubmitting = hasContext('form')
? getContext<FormContext>('form').isSubmitting
: readable(false);

$: internalDisabled = (submit && $isSubmitting) || disabled;

//allows to add the disabled attribute to <a> tag without throwing an error
let attributes = { disabled } as Record<string, boolean>;
$: attributes = { internalDisabled } as Record<string, boolean>;

function track() {
if (!event) {
Expand Down Expand Up @@ -51,7 +60,7 @@
<button
on:click
on:click={track}
{disabled}
disabled={internalDisabled}
class="button"
class:is-only-icon={round}
class:is-secondary={secondary}
Expand Down
Loading