mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: onboarding
This commit is contained in:
1 parent
8237dc5895
commit
27e045a2b1
15 files changed
+118
-45
No files matched your search
@@ -1,9 +1,15 @@
|
||||
<script lang="ts">
|
||||
export let overlapCover = false;
|
||||
export let size: 'small' | 'medium' | 'large' | 'xl' = null;
|
||||
|
||||
$: style = size
|
||||
? `--p-container-max-size: var(--container-max-size, var(--container-size-${size}))`
|
||||
: '';
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="container"
|
||||
{style}
|
||||
class:u-margin-block-start-24={!overlapCover}
|
||||
class:u-margin-block-start-negative-56={overlapCover}>
|
||||
<slot />
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
<script lang="ts">
|
||||
export let adjustContentToCover = false;
|
||||
|
||||
export let size: 'small' | 'medium' | 'large' | 'xl' = null;
|
||||
|
||||
$: style = size
|
||||
? `--p-container-max-size: var(--container-max-size, var(--container-size-${size}))`
|
||||
: '';
|
||||
</script>
|
||||
|
||||
<div class="top-cover" class:is-adjust-content-to-cover={adjustContentToCover}>
|
||||
<div class="container">
|
||||
<div class="container" {style}>
|
||||
<div class="u-flex u-cross-center u-gap-16 u-margin-block-start-20">
|
||||
<slot name="header" />
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Shell from '$lib/layout/shell.svelte';
|
||||
import SideNavigation from '$lib/layout/navigation.svelte';
|
||||
import Header from '$lib/layout/header.svelte';
|
||||
import { organizationList, newOrgModal } from '$lib/stores/organization';
|
||||
import { newOrgModal } from '$lib/stores/organization';
|
||||
import Create from './createOrganization.svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
@@ -33,7 +33,8 @@
|
||||
<Shell
|
||||
showSideNavigation={$page.url.pathname !== '/console' &&
|
||||
!$page?.params.organization &&
|
||||
!$page.url.pathname.includes('/console/account')}>
|
||||
!$page.url.pathname.includes('/console/account') &&
|
||||
!$page.url.pathname.includes('/console/onboarding')}>
|
||||
<svelte:fragment slot="header">
|
||||
<Header />
|
||||
</svelte:fragment>
|
||||
@@ -48,9 +49,7 @@
|
||||
<svelte:component this={$wizard.component} />
|
||||
{/if}
|
||||
|
||||
{#if $newOrgModal}
|
||||
<Create bind:show={$newOrgModal} closable={!!$organizationList?.total} />
|
||||
{/if}
|
||||
<Create bind:show={$newOrgModal} />
|
||||
|
||||
{#if $log.show}
|
||||
<Logs />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { base } from '$app/paths';
|
||||
import { newOrgModal } from '$lib/stores/organization';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
@@ -8,7 +7,6 @@ export const load: PageLoad = async ({ parent }) => {
|
||||
if (organizations.total) {
|
||||
throw redirect(303, `${base}/console/organization-${organizations.teams[0].$id}`);
|
||||
} else {
|
||||
newOrgModal.set(true);
|
||||
throw redirect(303, `${base}/console`);
|
||||
throw redirect(303, `${base}/console/onboarding`);
|
||||
}
|
||||
};
|
||||
@@ -9,9 +9,8 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
export let show = false;
|
||||
export let closable = true;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
$: console.log(show);
|
||||
let name: string;
|
||||
let id: string;
|
||||
let showCustomId = false;
|
||||
@@ -36,7 +35,7 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={create} size="big" bind:show {closable}>
|
||||
<Modal {error} on:submit={create} size="big" bind:show>
|
||||
<svelte:fragment slot="header">Create New Organization</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
@@ -59,7 +58,7 @@
|
||||
{/if}
|
||||
</FormList>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button disabled={!closable} secondary on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button secondary on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit>Create</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -0,0 +1 @@
|
||||
<slot />
|
||||
@@ -0,0 +1,8 @@
|
||||
import Header from './header.svelte';
|
||||
import type { LayoutLoad } from './$types';
|
||||
|
||||
export const load: LayoutLoad = async () => {
|
||||
return {
|
||||
header: Header
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Card } from '$lib/components';
|
||||
import CustomId from '$lib/components/customId.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import FormList from '$lib/elements/forms/formList.svelte';
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { ID } from '@aw-labs/appwrite-console';
|
||||
|
||||
let name: string;
|
||||
let id: string;
|
||||
let showCustomId = false;
|
||||
let loading = false;
|
||||
async function createProject() {
|
||||
try {
|
||||
loading = true;
|
||||
const org = await createOrganization();
|
||||
const project = await sdkForConsole.projects.create(id ?? ID.unique(), name, org.$id);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`/console/project-${project.$id}`);
|
||||
} catch ({ message }) {
|
||||
addNotification({
|
||||
message,
|
||||
type: 'error'
|
||||
});
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function createOrganization() {
|
||||
return await sdkForConsole.teams.create(ID.unique(), 'Personal Projects');
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container overlapCover size="large">
|
||||
<Card>
|
||||
<Form on:submit={createProject}>
|
||||
<FormList>
|
||||
<InputText
|
||||
id="name"
|
||||
label="Project name"
|
||||
placeholder="First Appwrite Project"
|
||||
disabled={loading}
|
||||
bind:value={name} />
|
||||
{#if !showCustomId}
|
||||
<div>
|
||||
<Pill button on:click={() => (showCustomId = !showCustomId)}>
|
||||
<span class="icon-pencil" aria-hidden="true" /><span class="text">
|
||||
Project ID
|
||||
</span>
|
||||
</Pill>
|
||||
</div>
|
||||
{:else}
|
||||
<CustomId bind:show={showCustomId} name="Project ID" bind:id />
|
||||
{/if}
|
||||
<Button fullWidth submit disabled={loading}>Create project</Button>
|
||||
</FormList>
|
||||
</Form>
|
||||
</Card>
|
||||
</Container>
|
||||
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Cover, CoverTitle } from '$lib/layout';
|
||||
</script>
|
||||
|
||||
<Cover size="large">
|
||||
<CoverTitle>Let's create your first project</CoverTitle>
|
||||
</Cover>
|
||||
@@ -11,7 +11,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
|
||||
try {
|
||||
return {
|
||||
header: Header,
|
||||
breadcrumb: Breadcrumbs,
|
||||
breadcrumbs: Breadcrumbs,
|
||||
organization: sdkForConsole.teams.get(params.organization),
|
||||
members: sdkForConsole.teams.listMemberships(params.organization)
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { newOrgModal, organization, organizationList } from '$lib/stores/organization';
|
||||
import { organization, organizationList } from '$lib/stores/organization';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -21,8 +21,8 @@
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`${base}/console/`);
|
||||
} else {
|
||||
newOrgModal.set(true);
|
||||
goto(`${base}/console`);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`${base}/console/onboarding`);
|
||||
}
|
||||
showDelete = false;
|
||||
} catch (error) {
|
||||
|
||||
@@ -52,9 +52,7 @@
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
{#each $organizationList.teams as org}
|
||||
<DropListLink
|
||||
href={`${base}/console/organization-${org.$id}`}
|
||||
on:click={() => (showDropdown = false)}>
|
||||
<DropListLink href={`${base}/console/organization-${org.$id}`}>
|
||||
{org.name}
|
||||
</DropListLink>
|
||||
{/each}
|
||||
@@ -62,12 +60,9 @@
|
||||
<svelte:fragment slot="other">
|
||||
<section class="drop-section">
|
||||
<ul class="drop-list">
|
||||
<DropListItem
|
||||
icon="plus"
|
||||
on:click={() => {
|
||||
showDropdown = false;
|
||||
newOrgModal.set(true);
|
||||
}}>New Organization</DropListItem>
|
||||
<DropListItem icon="plus" on:click={() => newOrgModal.set(true)}>
|
||||
New Organization
|
||||
</DropListItem>
|
||||
</ul>
|
||||
</section></svelte:fragment>
|
||||
</DropList>
|
||||
|
||||
@@ -3,8 +3,7 @@ import { sdkForConsole, sdkForProject, setProject } from '$lib/stores/sdk';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { LayoutLoad } from './$types';
|
||||
|
||||
export const load: LayoutLoad = async ({ params, depends, parent }) => {
|
||||
await parent();
|
||||
export const load: LayoutLoad = async ({ params, depends }) => {
|
||||
depends(Dependencies.PROJECT);
|
||||
|
||||
if (sdkForProject.client.config.project !== params.project) {
|
||||
|
||||
@@ -5,6 +5,4 @@
|
||||
|
||||
<slot />
|
||||
|
||||
{#if $execute}
|
||||
<Execute selectedFunction={$execute} />
|
||||
{/if}
|
||||
<Execute selectedFunction={$execute} />
|
||||
+6
-14
@@ -289,11 +289,7 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => {
|
||||
$execute = $func;
|
||||
}}>Execute now</Button>
|
||||
<Button secondary on:click={() => ($execute = $func)}>Execute now</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
@@ -573,14 +569,10 @@
|
||||
</Container>
|
||||
|
||||
<Delete bind:showDelete />
|
||||
|
||||
{#if showVariablesModal}
|
||||
<Variable
|
||||
bind:selectedVar
|
||||
bind:showCreate={showVariablesModal}
|
||||
on:created={handleVariableCreated}
|
||||
on:updated={handleVariableUpdated} />
|
||||
{/if}
|
||||
|
||||
<Variable
|
||||
bind:selectedVar
|
||||
bind:showCreate={showVariablesModal}
|
||||
on:created={handleVariableCreated}
|
||||
on:updated={handleVariableUpdated} />
|
||||
<Upload bind:show={showVariablesUpload} on:uploaded={handleVariableCreated} />
|
||||
<EventModal bind:show={showEvents} on:created={handleEvent} />
|
||||
Reference in new issue
Block a user