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

New onboarding flow #1517

Draft
wants to merge 27 commits into
base: feat-pink-v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0f32fac
Override padding spacing
ernstmul Oct 15, 2024
e91069f
chore: remove backups relationships alert
ArmanNik Oct 16, 2024
0096182
Merge pull request #1420 from appwrite/chore-remove-backups-rel-alert
TorstenDittmann Oct 16, 2024
2c140d7
fix: duplicate id on creating multiple databases with policy
TorstenDittmann Oct 16, 2024
a24428c
Merge pull request #1421 from appwrite/fix-duplicate-id-on-policy
TorstenDittmann Oct 16, 2024
dd4d841
Merge pull request #1419 from appwrite/fix-remove-padding-spacing
TorstenDittmann Oct 16, 2024
fd9065f
Fix overflow variablecard when just slightly bigger than mobile
ernstmul Oct 17, 2024
0fda1be
fix: database deletion copy
ArmanNik Oct 17, 2024
af48143
Merge pull request #1423 from appwrite/fix-db-deletion-copy
ArmanNik Oct 17, 2024
510239a
Fix comment
ernstmul Oct 17, 2024
419bd77
Merge pull request #1422 from appwrite/fix-variable-card-on-inbetween…
ernstmul Oct 17, 2024
f2a384f
Merge branch 'main' into feat-pink-v2
ernstmul Oct 18, 2024
4271c66
WIP
ernstmul Nov 11, 2024
b3662b5
Restructure page
ernstmul Nov 12, 2024
3eba7b8
WIP
ernstmul Nov 13, 2024
5cf8825
Add region selection
ernstmul Nov 14, 2024
005c496
Add create button
ernstmul Nov 14, 2024
6f1e7f2
Animation WIP
ernstmul Nov 15, 2024
cd14148
Make animation responsive
ernstmul Nov 15, 2024
f0c05c8
WIP on animation
ernstmul Nov 15, 2024
192352b
Create the actual project
ernstmul Nov 15, 2024
1b46830
Merge remote-tracking branch 'origin/feat-pink-v2' into feat-pink-v2
ernstmul Nov 15, 2024
4ed5860
Merge branch 'feat-pink-v2' into feat-new-onboarding-flow
ernstmul Nov 15, 2024
38bb11d
Loading animation update
ernstmul Nov 19, 2024
6e2ee5e
Make background fully transparent at the start
ernstmul Nov 25, 2024
e22c8ed
Animation updates
ernstmul Nov 25, 2024
6ac6917
Adjust customId algignment. And animation adjustments
ernstmul Nov 25, 2024
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
28 changes: 17 additions & 11 deletions src/lib/layout/shell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

export let isOpen = false;
export let showSideNavigation = false;
export let showHeader = true;
export let showFooter = true;

let y: number;

Expand Down Expand Up @@ -59,16 +61,18 @@
{#if $activeHeaderAlert?.show}
<svelte:component this={$activeHeaderAlert.component} />
{/if}
<header class="main-header u-padding-inline-end-0">
<button
class:u-hide={!showSideNavigation}
class="icon-button is-not-desktop"
aria-label="Open Menu"
on:click={toggleMenu}>
<span class:icon-x={isOpen} class:icon-menu={!isOpen} aria-hidden="true" />
</button>
<slot name="header" />
</header>
{#if showHeader}
<header class="main-header u-padding-inline-end-0">
<button
class:u-hide={!showSideNavigation}
class="icon-button is-not-desktop"
aria-label="Open Menu"
on:click={toggleMenu}>
<span class:icon-x={isOpen} class:icon-menu={!isOpen} aria-hidden="true" />
</button>
<slot name="header" />
</header>
{/if}
{#if showSideNavigation}
<nav class="main-side">
<slot name="side" />
Expand All @@ -80,7 +84,9 @@
{/if}

<slot />
<slot name="footer" />
{#if showFooter}
<slot name="footer" />
{/if}
</section>
</main>

Expand Down
4 changes: 3 additions & 1 deletion src/routes/(console)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@
!$page?.params.organization &&
!$page.url.pathname.includes('/console/account') &&
!$page.url.pathname.includes('/console/card') &&
!$page.url.pathname.includes('/console/onboarding')}>
!$page.url.pathname.includes('/console/onboarding')}
showHeader={!$page.url.pathname.includes('/console/onboarding')}
showFooter={!$page.url.pathname.includes('/console/onboarding')}>
<Header slot="header" />
<SideNavigation slot="side" bind:isOpen />
<slot />
Expand Down
5 changes: 0 additions & 5 deletions src/routes/(console)/onboarding/+layout.svelte

This file was deleted.

8 changes: 0 additions & 8 deletions src/routes/(console)/onboarding/+layout.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/routes/(console)/onboarding/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

<Container overlapCover size="large">
<Card>
<Heading size="4" tag="h2">Create a new organization</Heading>
<Heading size="4" tag="h2">Create a new organization!</Heading>
<Form onSubmit={handleSubmit}>
<FormList gap={16}>
<InputText
Expand Down
169 changes: 169 additions & 0 deletions src/routes/(console)/onboarding/create-project/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<script lang="ts">
import { Card, Layout, Typography, Input, Tag, Icon, Button } from '@appwrite.io/pink-svelte';
import { IconPencil } from '@appwrite.io/pink-icons-svelte';
import { CustomId } from '$lib/components/index.js';
import type { RegionList } from '$lib/sdk/billing';
import { onMount } from 'svelte';
import { isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import { isValueOfStringEnum } from '$lib/helpers/types';
import { Flag, ID, Region } from '@appwrite.io/console';
import Loading from './loading.svelte';
import { BillingPlan } from '$lib/constants';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { addNotification } from '$lib/stores/notifications';
import { goto } from '$app/navigation';
import { base } from '$app/paths';

let showCustomId = false;
let isLoading = false;
let id: string;
let startAnimation = false;
let projectName = '';

let regions: RegionList;
onMount(async () => {
if (isCloud) {
regions = await sdk.forConsole.billing.listRegions();
}
});

function getFlagUrl(countryCode: string) {
if (!isValueOfStringEnum(Flag, countryCode)) return '';
return sdk.forProject.avatars.getFlag(countryCode, 22, 15, 100)?.toString();
}

async function createProject() {
isLoading = true;
//create new org
let org = await sdk.forConsole.billing.createOrganization(
ID.unique(),
'Personal Projects',
BillingPlan.FREE,
null,
null
);

const teamId = org.$id;
try {
const project = await sdk.forConsole.projects.create(
id ?? ID.unique(),
projectName,
teamId,
Region.Default
);
trackEvent(Submit.ProjectCreate, {
customId: !!id,
teamId
});

startAnimation = true;

setTimeout(() => {
goto(`${base}/project-${project.$id}`);
}, 3000);
} catch (e) {
// error = e.message;
trackError(e, Submit.ProjectCreate);
// disabled = false;
}
}
</script>

<div
class="page-container u-flex-vertical u-cross-child-center u-cross-center u-margin-block-start-96">
{#if isLoading}
<button
on:click={() => {
startAnimation = !startAnimation;
}}>toggle</button>
<Loading {startAnimation} />
{:else}
<img
src="/console/images/appwrite-logo-light.svg"
width="120"
height="22"
class="u-only-light"
alt="Appwrite Logo" />
<img
src="/console/images/appwrite-logo-dark.svg"
width="120"
height="22"
class="u-only-dark"
alt="Appwrite Logo" />
<Card.Base variant="primary"
><Layout.Stack direction="column" gap="xxl">
<Typography.Title size="l">Create your project</Typography.Title>
<form>
<Layout.Stack direction="column" gap="xl">
<Layout.Stack direction="column" gap="s">
<Input.Text
label="Name"
placeholder="Project name"
bind:value={projectName} />
{#if !showCustomId}
<div>
<Tag
size="s"
on:click={() => {
showCustomId = true;
}}><Icon icon={IconPencil} /> Project ID</Tag>
</div>
{/if}
<CustomId
bind:show={showCustomId}
name="Project"
isProject
bind:id
fullWidth={true} />
</Layout.Stack>
{#if regions}
<Input.Select
placeholder="Select a region"
options={regions.regions
.filter((region) => region.$id !== 'default')
.sort((regionA, regionB) => {
if (regionA.disabled && !regionB.disabled) {
return 1;
}
return regionA.name > regionB.name ? 1 : -1;
})
.map((region) => {
return {
label: region.name,
value: region.$id,
leadingHtml: `<img src='${getFlagUrl(region.flag)}' alt='Region flag'/>`,
disabled: region.disabled
};
})}
label="Region" />
{/if}
<div class="u-flex u-main-end">
<Button.Button
type="button"
variant="primary"
size="m"
on:click={createProject}>
Create</Button.Button>
</div>
</Layout.Stack>
</form>
</Layout.Stack></Card.Base>
{/if}
</div>

<style lang="scss">
@import '@appwrite.io/pink/src/abstract/variables/_devices.scss';

.page-container {
width: calc(100% - 2rem);
margin: 0 1rem;
min-height: 100vh;
gap: 4.5rem;
color: var(--color-fgcolor-neutral-primary, #2d2d31);

@media #{$break2open} {
width: 700px;
}
}
</style>
Loading