diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte index 2d2d6072a..0c7e35f46 100644 --- a/src/lib/components/navbar.svelte +++ b/src/lib/components/navbar.svelte @@ -1,3 +1,13 @@ + + @@ -101,6 +112,14 @@ {logo.alt} + {#if selectedProject && selectedProject.pingCount === 0} +
+ Connect +
+ {/if}
diff --git a/src/lib/helpers/platform.ts b/src/lib/helpers/platform.ts index 98920c7c6..33662adb7 100644 --- a/src/lib/helpers/platform.ts +++ b/src/lib/helpers/platform.ts @@ -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 }; +}; diff --git a/src/lib/layout/shell.svelte b/src/lib/layout/shell.svelte index 476edf9db..4e9c2f0d7 100644 --- a/src/lib/layout/shell.svelte +++ b/src/lib/layout/shell.svelte @@ -1,6 +1,7 @@
- {#if !hasPlatforms} + {#if platforms.length === 0 || pingCount === 0}
@@ -46,7 +84,7 @@ Add a platform + size="s">Connect your platform
Start building with your preferred web, mobile, and @@ -59,95 +97,254 @@ - addPlatform(0)} padding="s" - > { + openPlatformWizard(0, platformMap.get('Web')); + }} + padding="s" + >
+ {#if platformMap.has('Web')} + + +
+ +
+
+
+ {/if} Web -
- -
+ {#if platformMap.has('Web')}Continue{:else} +
+ +
+ {/if}
-
-
+ { + openPlatformWizard(4, platformMap.get('React Native')); + }} + padding="s" + > +
+
+
+
+ {#if platformMap.has('React Native')} + + +
+ +
+
+
+ {/if} - Server -
- -
+ React Native + {#if platformMap.has('React Native')}Continue{:else} +
+ +
+ {/if}
- addPlatform(3)} padding="s"> - + { + openPlatformWizard(3, platformMap.get('Apple')); + }} + padding="s"> + + {#if platformMap.has('Apple')} + + +
+ +
+
+
+ {/if} Apple -
- -
+ {#if platformMap.has('Apple')}Continue{:else} +
+ +
+ {/if}
- addPlatform(2)} padding="s"> - + { + openPlatformWizard(2, platformMap.get('Android')); + }} + padding="s"> + + {#if platformMap.has('Android')} + + +
+ +
+
+
+ {/if} Android -
- -
+ {#if platformMap.has('Android')}Continue{:else} +
+ +
+ {/if}
- addPlatform(1)} padding="s"> - + { + openPlatformWizard(1, platformMap.get('Flutter')); + }} + padding="s"> + + {#if platformMap.has('Flutter')} + + +
+ +
+
+
+ {/if} Flutter -
- -
+ {#if platformMap.has('Flutter')}Continue{:else} +
+ +
+ {/if}
+ + Or connect + server side +
+ +
+
Add a platform + >Connect your platform
{ 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 {/if} diff --git a/src/routes/(console)/project-[project]/overview/platforms/createApple.svelte b/src/routes/(console)/project-[project]/overview/platforms/createApple.svelte index cb3db0bd0..3987e15f1 100644 --- a/src/routes/(console)/project-[project]/overview/platforms/createApple.svelte +++ b/src/routes/(console)/project-[project]/overview/platforms/createApple.svelte @@ -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}" @@ -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 {/if} diff --git a/src/routes/(console)/project-[project]/overview/platforms/createFlutter.svelte b/src/routes/(console)/project-[project]/overview/platforms/createFlutter.svelte index afb9a9893..b693aa4ec 100644 --- a/src/routes/(console)/project-[project]/overview/platforms/createFlutter.svelte +++ b/src/routes/(console)/project-[project]/overview/platforms/createFlutter.svelte @@ -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 {/if} diff --git a/src/routes/(console)/project-[project]/overview/platforms/createReactNative.svelte b/src/routes/(console)/project-[project]/overview/platforms/createReactNative.svelte index a7fee3fa1..df67f95bf 100644 --- a/src/routes/(console)/project-[project]/overview/platforms/createReactNative.svelte +++ b/src/routes/(console)/project-[project]/overview/platforms/createReactNative.svelte @@ -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}"; -
+ @@ -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 {/if}