mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #1667 from appwrite/feat-changes-to-onboarding
Feat changes to onboarding
This commit is contained in:
17 files changed
+348
-93
No files matched your search
@@ -1,3 +1,13 @@
|
||||
<script lang="ts" context="module">
|
||||
export type NavbarProject = {
|
||||
name: string;
|
||||
$id: string;
|
||||
isSelected: boolean;
|
||||
platformCount: number;
|
||||
pingCount: number;
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import {
|
||||
Navbar,
|
||||
@@ -45,7 +55,7 @@
|
||||
isSelected: boolean;
|
||||
showUpgrade: boolean;
|
||||
tierName: string;
|
||||
projects: Array<{ name: string; $id: string; isSelected: boolean }>;
|
||||
projects: Array<NavbarProject>;
|
||||
}>;
|
||||
showAccountMenu: boolean;
|
||||
};
|
||||
@@ -84,6 +94,7 @@
|
||||
updateTheme(activeTheme);
|
||||
}
|
||||
$: currentOrg = organizations.find((org) => org.isSelected);
|
||||
$: selectedProject = currentOrg?.projects.find((project) => project.isSelected);
|
||||
</script>
|
||||
|
||||
<Navbar.Base {...$$props}>
|
||||
@@ -101,6 +112,14 @@
|
||||
<img src={logo.src} alt={logo.alt} />
|
||||
</a>
|
||||
<Breadcrumbs {organizations} />
|
||||
{#if selectedProject && selectedProject.pingCount === 0}
|
||||
<div class="only-desktop">
|
||||
<Button.Anchor
|
||||
href={`${base}/project-${selectedProject.$id}/get-started`}
|
||||
variant="secondary"
|
||||
size="xs">Connect</Button.Anchor>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div slot="right" class="only-desktop">
|
||||
<div class="right">
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
export function isMac(): boolean {
|
||||
return window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||
}
|
||||
|
||||
export const getPlatformInfo = (platform: string) => {
|
||||
let name: string, icon: string;
|
||||
if (platform.includes('flutter')) {
|
||||
name = 'Flutter';
|
||||
icon = 'flutter';
|
||||
} else if (platform.includes('react-native')) {
|
||||
name = 'React Native';
|
||||
icon = 'react-native';
|
||||
} else if (platform.includes('apple')) {
|
||||
name = 'Apple';
|
||||
icon = 'apple';
|
||||
} else if (platform.includes('android')) {
|
||||
name = 'Android';
|
||||
icon = 'android';
|
||||
} else if (platform.includes('unity')) {
|
||||
name = 'Unity';
|
||||
icon = 'unity';
|
||||
} else if (platform.includes('web')) {
|
||||
name = 'Web';
|
||||
icon = 'code';
|
||||
} else {
|
||||
name = 'Unknown';
|
||||
icon = 'unknown';
|
||||
}
|
||||
return { name, icon };
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { Navbar, Sidebar } from '$lib/components';
|
||||
import { type NavbarProject } from '$lib/components/navbar.svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { log } from '$lib/stores/logs';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
@@ -22,7 +23,7 @@
|
||||
export let showSideNavigation = false;
|
||||
export let showHeader = true;
|
||||
export let showFooter = true;
|
||||
export let loadedProjects: Array<{ name: string; $id: string; isSelected: boolean }> = [];
|
||||
export let loadedProjects: Array<NavbarProject> = [];
|
||||
export let projects: Array<Models.Project> = [];
|
||||
|
||||
$: selectedProject = loadedProjects.find((project) => project.isSelected);
|
||||
|
||||
@@ -13,6 +13,7 @@ export type WizardStore = {
|
||||
nextDisabled: boolean;
|
||||
step: number;
|
||||
interceptorNotificationEnabled: boolean;
|
||||
props: Record<string, unknown>;
|
||||
};
|
||||
|
||||
function createWizardStore() {
|
||||
@@ -25,7 +26,8 @@ function createWizardStore() {
|
||||
media: null,
|
||||
nextDisabled: false,
|
||||
step: 1,
|
||||
finalAction: null
|
||||
finalAction: null,
|
||||
props: {}
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -34,7 +36,8 @@ function createWizardStore() {
|
||||
start: (
|
||||
component: typeof SvelteComponent<unknown>,
|
||||
media: string = null,
|
||||
step: number = 1
|
||||
step: number = 1,
|
||||
props: Record<string, unknown> = {}
|
||||
) =>
|
||||
update((n) => {
|
||||
n.show = true;
|
||||
@@ -46,6 +49,7 @@ function createWizardStore() {
|
||||
n.cover = null;
|
||||
n.nextDisabled = false;
|
||||
n.finalAction = null;
|
||||
n.props = props;
|
||||
trackEvent('wizard_start');
|
||||
return n;
|
||||
}),
|
||||
|
||||
@@ -69,7 +69,9 @@
|
||||
return {
|
||||
name: project?.name,
|
||||
$id: project.$id,
|
||||
isSelected: data.currentProjectId === project.$id
|
||||
isSelected: data.currentProjectId === project.$id,
|
||||
platformCount: project.platforms.length,
|
||||
pingCount: project.pingCount
|
||||
};
|
||||
});
|
||||
|
||||
@@ -350,7 +352,7 @@
|
||||
</Shell>
|
||||
|
||||
{#if $wizard.show && $wizard.component}
|
||||
<svelte:component this={$wizard.component} />
|
||||
<svelte:component this={$wizard.component} {...$wizard.props} />
|
||||
{:else if $wizard.cover}
|
||||
<svelte:component this={$wizard.cover} />
|
||||
{/if}
|
||||
|
||||
@@ -35,36 +35,13 @@
|
||||
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import { getPlatformInfo } from '$lib/helpers/platform';
|
||||
|
||||
export let data;
|
||||
|
||||
let addOrganization = false;
|
||||
let showCreate = false;
|
||||
|
||||
const getPlatformInfo = (platform: string) => {
|
||||
let name: string, icon: string;
|
||||
if (platform.includes('flutter')) {
|
||||
name = 'Flutter';
|
||||
icon = 'flutter';
|
||||
} else if (platform.includes('apple')) {
|
||||
name = 'Apple';
|
||||
icon = 'apple';
|
||||
} else if (platform.includes('android')) {
|
||||
name = 'Android';
|
||||
icon = 'android';
|
||||
} else if (platform.includes('unity')) {
|
||||
name = 'Unity';
|
||||
icon = 'unity';
|
||||
} else if (platform.includes('web')) {
|
||||
name = 'Web';
|
||||
icon = 'code';
|
||||
} else {
|
||||
name = 'Unknown';
|
||||
icon = 'unknown';
|
||||
}
|
||||
return { name, icon };
|
||||
};
|
||||
|
||||
function allServiceDisabled(project: Models.Project): boolean {
|
||||
let disabled = true;
|
||||
services.load(project);
|
||||
|
||||
@@ -9,4 +9,7 @@
|
||||
<title>Console - Appwrite</title>
|
||||
</svelte:head>
|
||||
|
||||
<Onboard {projectId} hasPlatforms={$page.data.project.platforms.length > 0} />
|
||||
<Onboard
|
||||
{projectId}
|
||||
platforms={$page.data.project.platforms}
|
||||
pingCount={$page.data.project.pingCount} />
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 207 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 202 KiB |
@@ -1,8 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { Step, Link, Icon, Layout, Card, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { addPlatform } from './platforms/+page.svelte';
|
||||
import {
|
||||
Step,
|
||||
Link,
|
||||
Icon,
|
||||
Layout,
|
||||
Card,
|
||||
Typography,
|
||||
Badge,
|
||||
ProgressCircle,
|
||||
Button
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { addPlatform, continuePlatform } from './platforms/+page.svelte';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { IconArrowRight } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
IconArrowRight,
|
||||
IconNodeJs,
|
||||
IconPhp,
|
||||
IconPython
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import DatabaseImgSource from './assets/database.png';
|
||||
import DatabaseImgSourceDark from './assets/database-dark.png';
|
||||
import UsersImgSource from './assets/users.svg';
|
||||
@@ -19,19 +34,42 @@
|
||||
import Wizard from './keys/wizard.svelte';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { AvatarGroup } from '$lib/components';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { getPlatformInfo } from '$lib/helpers/platform';
|
||||
|
||||
function createKey() {
|
||||
wizard.start(Wizard);
|
||||
}
|
||||
|
||||
export let projectId: string;
|
||||
export let hasPlatforms: boolean;
|
||||
export let platforms: Models.Platform[] = [];
|
||||
export let pingCount = 0;
|
||||
|
||||
function openPlatformWizard(type: number, platform?: Models.Platform) {
|
||||
if (platform) {
|
||||
continuePlatform(type, platform.name, platform.key, platform.type);
|
||||
} else {
|
||||
addPlatform(type);
|
||||
}
|
||||
}
|
||||
|
||||
let platformMap = new Map();
|
||||
|
||||
$: {
|
||||
let updatedMap = new Map();
|
||||
platforms.forEach((platform) => {
|
||||
const platformInfo = getPlatformInfo(platform.type);
|
||||
updatedMap.set(platformInfo.name, platform);
|
||||
});
|
||||
platformMap = updatedMap;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div style:container-type="inline-size">
|
||||
<div class="console-container">
|
||||
<div class="dashboard-content">
|
||||
{#if !hasPlatforms}
|
||||
{#if platforms.length === 0 || pingCount === 0}
|
||||
<Step.List>
|
||||
<Step.Item state="previous"
|
||||
><div>
|
||||
@@ -46,7 +84,7 @@
|
||||
<Layout.Stack gap="m">
|
||||
<Typography.Title
|
||||
color="--color-fgcolor-neutral-primary"
|
||||
size="s">Add a platform</Typography.Title>
|
||||
size="s">Connect your platform</Typography.Title>
|
||||
<div class="build-info">
|
||||
<span>
|
||||
Start building with your preferred web, mobile, and
|
||||
@@ -59,95 +97,254 @@
|
||||
<Layout.Stack
|
||||
gap="l"
|
||||
direction={$isSmallViewport ? 'column' : 'row'}>
|
||||
<Card.Button on:click={() => addPlatform(0)} padding="s"
|
||||
><Layout.Stack gap="xl"
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
openPlatformWizard(0, platformMap.get('Web'));
|
||||
}}
|
||||
padding="s"
|
||||
><Layout.Stack
|
||||
gap={platformMap.has('Web') ? 'm' : 'xl'}
|
||||
height="100%"
|
||||
justifyContent="space-between"
|
||||
><div class="card-top-image web-image-light"></div>
|
||||
<div class="card-top-image web-image-dark"></div>
|
||||
{#if platformMap.has('Web')}
|
||||
<Layout.Stack alignItems="flex-start">
|
||||
<Badge
|
||||
size="s"
|
||||
variant="secondary"
|
||||
content="In progress">
|
||||
<div
|
||||
slot="start"
|
||||
style:margin="-4px 4px 0 0">
|
||||
<ProgressCircle
|
||||
size="xs"
|
||||
showAnimation={false}
|
||||
backgroundStrokeColor="--progress-background-color"
|
||||
progress={33} />
|
||||
</div>
|
||||
</Badge>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between">
|
||||
<Typography.Title size="s">Web</Typography.Title>
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{#if platformMap.has('Web')}<Button.Button size="xs"
|
||||
>Continue</Button.Button
|
||||
>{:else}
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack></Card.Button>
|
||||
<Card.Button on:click={createKey} padding="s"
|
||||
><Layout.Stack gap="xl"
|
||||
><div class="card-top-image server-image-light"></div>
|
||||
<div class="card-top-image server-image-dark"></div>
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
openPlatformWizard(4, platformMap.get('React Native'));
|
||||
}}
|
||||
padding="s"
|
||||
><Layout.Stack
|
||||
gap={platformMap.has('React Native') ? 'm' : 'xl'}
|
||||
height="100%"
|
||||
justifyContent="space-between">
|
||||
<div class="card-top-image reactnative-image-light">
|
||||
</div>
|
||||
<div class="card-top-image reactnative-image-dark">
|
||||
</div>
|
||||
{#if platformMap.has('React Native')}
|
||||
<Layout.Stack alignItems="flex-start">
|
||||
<Badge
|
||||
size="s"
|
||||
variant="secondary"
|
||||
content="In progress">
|
||||
<div
|
||||
slot="start"
|
||||
style:margin="-4px 4px 0 0">
|
||||
<ProgressCircle
|
||||
size="xs"
|
||||
showAnimation={false}
|
||||
backgroundStrokeColor="--progress-background-color"
|
||||
progress={33} />
|
||||
</div>
|
||||
</Badge>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between">
|
||||
<Typography.Title size="s">Server</Typography.Title>
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
<Typography.Title size="s"
|
||||
>React Native</Typography.Title>
|
||||
{#if platformMap.has('React Native')}<Button.Button
|
||||
size="xs">Continue</Button.Button
|
||||
>{:else}
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack></Card.Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack
|
||||
gap="l"
|
||||
direction={$isSmallViewport ? 'column' : 'row'}>
|
||||
<Card.Button on:click={() => addPlatform(3)} padding="s">
|
||||
<Layout.Stack gap="xxl">
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
openPlatformWizard(3, platformMap.get('Apple'));
|
||||
}}
|
||||
padding="s">
|
||||
<Layout.Stack
|
||||
gap={platformMap.has('Apple') ? 's' : 'xxl'}
|
||||
height="100%"
|
||||
justifyContent="space-between">
|
||||
<img
|
||||
class="platform-image"
|
||||
src={$app.themeInUse === 'dark'
|
||||
? PlatformIosImgSourceDark
|
||||
: PlatformIosImgSource}
|
||||
alt="" />
|
||||
{#if platformMap.has('Apple')}
|
||||
<Layout.Stack alignItems="flex-start">
|
||||
<Badge
|
||||
size="s"
|
||||
variant="secondary"
|
||||
content="In progress">
|
||||
<div
|
||||
slot="start"
|
||||
style:margin="-4px 4px 0 0">
|
||||
<ProgressCircle
|
||||
size="xs"
|
||||
showAnimation={false}
|
||||
backgroundStrokeColor="--progress-background-color"
|
||||
progress={33} />
|
||||
</div>
|
||||
</Badge>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between">
|
||||
<Typography.Title size="s">Apple</Typography.Title>
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div></Layout.Stack>
|
||||
{#if platformMap.has('Apple')}<Button.Button
|
||||
size="xs">Continue</Button.Button
|
||||
>{:else}
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{/if}</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Card.Button>
|
||||
<Card.Button on:click={() => addPlatform(2)} padding="s">
|
||||
<Layout.Stack gap="xxl">
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
openPlatformWizard(2, platformMap.get('Android'));
|
||||
}}
|
||||
padding="s">
|
||||
<Layout.Stack
|
||||
gap={platformMap.has('Android') ? 's' : 'xxl'}
|
||||
height="100%"
|
||||
justifyContent="space-between">
|
||||
<img
|
||||
class="platform-image"
|
||||
src={$app.themeInUse === 'dark'
|
||||
? PlatformAndroidImgSourceDark
|
||||
: PlatformAndroidImgSource}
|
||||
alt="" />
|
||||
{#if platformMap.has('Android')}
|
||||
<Layout.Stack alignItems="flex-start">
|
||||
<Badge
|
||||
size="s"
|
||||
variant="secondary"
|
||||
content="In progress">
|
||||
<div
|
||||
slot="start"
|
||||
style:margin="-4px 4px 0 0">
|
||||
<ProgressCircle
|
||||
size="xs"
|
||||
showAnimation={false}
|
||||
backgroundStrokeColor="--progress-background-color"
|
||||
progress={33} />
|
||||
</div>
|
||||
</Badge>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between">
|
||||
<Typography.Title size="s"
|
||||
>Android</Typography.Title>
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div></Layout.Stack>
|
||||
{#if platformMap.has('Android')}<Button.Button
|
||||
size="xs">Continue</Button.Button
|
||||
>{:else}
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{/if}</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Card.Button>
|
||||
<Card.Button on:click={() => addPlatform(1)} padding="s">
|
||||
<Layout.Stack gap="xxl">
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
openPlatformWizard(1, platformMap.get('Flutter'));
|
||||
}}
|
||||
padding="s">
|
||||
<Layout.Stack
|
||||
gap={platformMap.has('Flutter') ? 's' : 'xxl'}
|
||||
height="100%"
|
||||
justifyContent="space-between">
|
||||
<img
|
||||
class="platform-image"
|
||||
src={$app.themeInUse === 'dark'
|
||||
? PlatformFlutterImgSourceDark
|
||||
: PlatformFlutterImgSource}
|
||||
alt="" />
|
||||
{#if platformMap.has('Flutter')}
|
||||
<Layout.Stack alignItems="flex-start">
|
||||
<Badge
|
||||
size="s"
|
||||
variant="secondary"
|
||||
content="In progress">
|
||||
<div
|
||||
slot="start"
|
||||
style:margin="-4px 4px 0 0">
|
||||
<ProgressCircle
|
||||
size="xs"
|
||||
showAnimation={false}
|
||||
backgroundStrokeColor="--progress-background-color"
|
||||
progress={33} />
|
||||
</div>
|
||||
</Badge>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="space-between">
|
||||
<Typography.Title size="s"
|
||||
>Flutter</Typography.Title>
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div></Layout.Stack>
|
||||
{#if platformMap.has('Flutter')}<Button.Button
|
||||
size="xs">Continue</Button.Button
|
||||
>{:else}
|
||||
<div class="arrow-icon">
|
||||
<Icon icon={IconArrowRight} size="s" />
|
||||
</div>
|
||||
{/if}</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Card.Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" gap="xxs" alignItems="center">
|
||||
<Typography.Text>Or connect</Typography.Text>
|
||||
<Link.Button variant="muted" on:click={createKey}
|
||||
>server side</Link.Button>
|
||||
<div style:padding-inline-start="8px">
|
||||
<AvatarGroup
|
||||
icons={[IconPython, IconNodeJs, IconPhp]}
|
||||
total={7}
|
||||
size="s" />
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack></Step.Item>
|
||||
<Step.Item state="next"
|
||||
@@ -166,7 +363,7 @@
|
||||
<Step.Item state="previous"
|
||||
><div>
|
||||
<Typography.Title color="--color-fgcolor-neutral-tertiary" size="s"
|
||||
>Add a platform</Typography.Title>
|
||||
>Connect your platform</Typography.Title>
|
||||
</div></Step.Item>
|
||||
<Step.Item state="current">
|
||||
<Layout.Stack
|
||||
@@ -326,15 +523,17 @@
|
||||
@use '@appwrite.io/pink-legacy/src/abstract/variables/devices';
|
||||
|
||||
:global(.theme-light) {
|
||||
--progress-background-color: var(--neutral-200);
|
||||
.web-image-dark,
|
||||
.server-image-dark {
|
||||
.reactnative-image-dark {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.theme-dark) {
|
||||
--progress-background-color: var(--neutral-600);
|
||||
.web-image-light,
|
||||
.server-image-light {
|
||||
.reactnative-image-light {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -361,11 +560,11 @@
|
||||
background-image: url('./assets/platform-web-dark.png');
|
||||
}
|
||||
|
||||
.server-image-light {
|
||||
background-image: url('./assets/platform-server.png');
|
||||
.reactnative-image-light {
|
||||
background-image: url('./assets/platform-reactnative.png');
|
||||
}
|
||||
.server-image-dark {
|
||||
background-image: url('./assets/platform-server-dark.png');
|
||||
.reactnative-image-dark {
|
||||
background-image: url('./assets/platform-reactnative-dark.png');
|
||||
}
|
||||
.database-card-image {
|
||||
background-size: cover;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import CreateApple from './createApple.svelte';
|
||||
import CreateFlutter from './createFlutter.svelte';
|
||||
import CreateReactNative from './createReactNative.svelte';
|
||||
import { versions } from './wizard/store';
|
||||
import { createPlatform, versions } from './wizard/store';
|
||||
|
||||
export enum Platform {
|
||||
Web,
|
||||
@@ -18,9 +18,28 @@
|
||||
|
||||
export async function addPlatform(type: Platform) {
|
||||
await versions.load();
|
||||
createPlatform.reset();
|
||||
wizard.start(platforms[type]);
|
||||
}
|
||||
|
||||
export async function continuePlatform(
|
||||
platform: Platform,
|
||||
name: string,
|
||||
key: string,
|
||||
type: string
|
||||
) {
|
||||
await versions.load();
|
||||
createPlatform.set({
|
||||
name: name,
|
||||
key: key,
|
||||
type: type
|
||||
});
|
||||
wizard.start(platforms[platform], null, 1, {
|
||||
isPlatformCreated: true,
|
||||
platform: type
|
||||
});
|
||||
}
|
||||
|
||||
const platforms = {
|
||||
[Platform.Flutter]: CreateFlutter,
|
||||
[Platform.Android]: CreateAndroid,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import { IconAndroid, IconAppwrite } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Card } from '$lib/components';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { onMount } from 'svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -78,8 +77,10 @@ const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
|
||||
onMount(() => {
|
||||
const unsubscribe = sdk.forConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes(`projects.${projectId}.ping`) && isPlatformCreated) {
|
||||
if (response.events.includes(`projects.${projectId}.ping`)) {
|
||||
connectionSuccessful = true;
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
invalidate(Dependencies.PROJECT);
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
@@ -234,7 +235,7 @@ const val APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
fullWidthMobile
|
||||
secondary
|
||||
disabled={isCreatingPlatform}
|
||||
href={`${base}/project-${projectId}/overview`}>
|
||||
href={location.pathname}>
|
||||
Go to dashboard
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import { IconApple, IconAppwrite } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Card } from '$lib/components';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { onMount } from 'svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -43,7 +42,7 @@
|
||||
APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject.client.config.endpoint}"
|
||||
`;
|
||||
|
||||
let platform: PlatformType = PlatformType.Appleios;
|
||||
export let platform: PlatformType = PlatformType.Appleios;
|
||||
|
||||
let platforms: { [key: string]: PlatformType } = {
|
||||
iOS: PlatformType.Appleios,
|
||||
@@ -89,8 +88,10 @@ APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject.client.config.endpoint}"
|
||||
|
||||
onMount(() => {
|
||||
const unsubscribe = sdk.forConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes(`projects.${projectId}.ping`) && isPlatformCreated) {
|
||||
if (response.events.includes(`projects.${projectId}.ping`)) {
|
||||
connectionSuccessful = true;
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
invalidate(Dependencies.PROJECT);
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
@@ -129,7 +130,7 @@ APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject.client.config.endpoint}"
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="My Apple app"
|
||||
placeholder="My Apple App"
|
||||
required
|
||||
bind:value={$createPlatform.name} />
|
||||
|
||||
@@ -259,7 +260,7 @@ APPWRITE_PUBLIC_ENDPOINT: "${sdk.forProject.client.config.endpoint}"
|
||||
fullWidthMobile
|
||||
secondary
|
||||
disabled={isCreatingPlatform}
|
||||
href={`${base}/project-${projectId}/overview`}>
|
||||
href={location.pathname}>
|
||||
Go to dashboard
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import { IconFlutter, IconAppwrite } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Card } from '$lib/components';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { onMount } from 'svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -42,7 +41,7 @@
|
||||
static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
`;
|
||||
|
||||
let platform: PlatformType = PlatformType.Flutterandroid;
|
||||
export let platform: PlatformType = PlatformType.Flutterandroid;
|
||||
|
||||
let platforms: { [key: string]: PlatformType } = {
|
||||
Android: PlatformType.Flutterandroid,
|
||||
@@ -124,6 +123,7 @@ static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.e
|
||||
trackEvent(Submit.PlatformCreate, {
|
||||
type: platform
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
@@ -145,8 +145,10 @@ static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.e
|
||||
|
||||
onMount(() => {
|
||||
const unsubscribe = sdk.forConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes(`projects.${projectId}.ping`) && isPlatformCreated) {
|
||||
if (response.events.includes(`projects.${projectId}.ping`)) {
|
||||
connectionSuccessful = true;
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
invalidate(Dependencies.PROJECT);
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
@@ -316,7 +318,7 @@ static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.e
|
||||
fullWidthMobile
|
||||
secondary
|
||||
disabled={isCreatingPlatform}
|
||||
href={`${base}/project-${projectId}/overview`}>
|
||||
href={location.pathname}>
|
||||
Go to dashboard
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import { IconReact, IconAppwrite } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Card } from '$lib/components';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { onMount } from 'svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -28,7 +27,7 @@
|
||||
import { LabelCard } from '$lib/components';
|
||||
|
||||
let showExitModal = false;
|
||||
let isPlatformCreated = false;
|
||||
export let isPlatformCreated = false;
|
||||
let isCreatingPlatform = false;
|
||||
let connectionSuccessful = false;
|
||||
const projectId = $page.params.project;
|
||||
@@ -42,7 +41,7 @@
|
||||
const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
`;
|
||||
|
||||
let platform: PlatformType = PlatformType.Reactnativeandroid;
|
||||
export let platform: PlatformType = PlatformType.Reactnativeandroid;
|
||||
|
||||
let platforms: { [key: string]: PlatformType } = {
|
||||
Android: PlatformType.Reactnativeandroid,
|
||||
@@ -78,7 +77,7 @@ const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
[PlatformType.Reactnativeios]: 'Bundle ID'
|
||||
};
|
||||
|
||||
async function createFlutterPlatform() {
|
||||
async function createReactNativePlatform() {
|
||||
try {
|
||||
isCreatingPlatform = true;
|
||||
await sdk.forConsole.projects.createPlatform(
|
||||
@@ -94,7 +93,6 @@ const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
trackEvent(Submit.PlatformCreate, {
|
||||
type: platform
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
@@ -116,8 +114,10 @@ const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
|
||||
onMount(() => {
|
||||
const unsubscribe = sdk.forConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes(`projects.${projectId}.ping`) && isPlatformCreated) {
|
||||
if (response.events.includes(`projects.${projectId}.ping`)) {
|
||||
connectionSuccessful = true;
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
invalidate(Dependencies.PROJECT);
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
@@ -130,7 +130,7 @@ const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
</script>
|
||||
|
||||
<Wizard title="Add React Native platform" bind:showExitModal confirmExit>
|
||||
<Form onSubmit={createFlutterPlatform}>
|
||||
<Form onSubmit={createReactNativePlatform}>
|
||||
<Layout.Stack gap="xxl">
|
||||
<!-- Step One -->
|
||||
<Layout.Stack gap="l" direction="row">
|
||||
@@ -284,7 +284,7 @@ const APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}";
|
||||
fullWidthMobile
|
||||
secondary
|
||||
disabled={isCreatingPlatform}
|
||||
href={`${base}/project-${projectId}/overview`}>
|
||||
href={location.pathname}>
|
||||
Go to dashboard
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user