diff --git a/src/routes/(public)/template-[template]/+layout.svelte b/src/routes/(public)/template-[template]/+layout.svelte new file mode 100644 index 000000000..22b13ab62 --- /dev/null +++ b/src/routes/(public)/template-[template]/+layout.svelte @@ -0,0 +1,59 @@ + + +
+
+ +
+ +
+ + diff --git a/src/routes/(public)/template-[template]/+page.svelte b/src/routes/(public)/template-[template]/+page.svelte index f8fdf1488..fad173d37 100644 --- a/src/routes/(public)/template-[template]/+page.svelte +++ b/src/routes/(public)/template-[template]/+page.svelte @@ -1,32 +1,23 @@ Deploy {data.template.name} - Appwrite -
-
- - - - - Deploy {data.product} - - - - {#if isSiteTemplate(data.template, data.product)} - {@const framework = data.template.frameworks[0]} - Screenshot - - - - {data.template.name} - - - {data.template.tagline} - - - {@const frameworkIcon = getFrameworkIcon(framework.key)} - - {#if frameworkIcon} - - {/if} - - {framework.name} - - +
+ + + + + Deploy {data.product} + + + + {#if isSiteTemplate(data.template, data.product)} + {@const framework = data.template.frameworks[0]} + Screenshot + + + + {data.template.name} + + + {data.template.tagline} + - {/if} - - + {@const frameworkIcon = getFrameworkIcon(framework.key)} + + {#if frameworkIcon} + + {/if} + + {framework.name} + + + + {/if} + + - {#if data.account} - ({ - label: o.name, - value: o.$id - }))} - bind:value={selectedOrg.$id} /> + {#if data.account} +
+ + ({ + label: o.name, + value: o.$id + }))} + bind:value={selectedOrg} /> - - - {:else} - - Sign in to deploy a site from GitHub. - + {#key selectedOrg} + {#if projects?.total} + ({ + label: p.name, + value: p.$id + }))} + bind:value={selectedProject} /> + {/if} + {/key} + + + {#if selectedProject !== null} +
+ +
+ {/if} +
+
+
+ {:else} + + Sign in to deploy a site from GitHub. + - - - {/if} - + + + {/if} - -
- + +
- - diff --git a/src/routes/(public)/template-[template]/+page.ts b/src/routes/(public)/template-[template]/+page.ts index ff58b0e0b..78abd2c37 100644 --- a/src/routes/(public)/template-[template]/+page.ts +++ b/src/routes/(public)/template-[template]/+page.ts @@ -1,7 +1,7 @@ import { sdk } from '$lib/stores/sdk.js'; -import { isCloud } from '$lib/system.js'; +// import { isCloud } from '$lib/system.js'; import type { Models } from '@appwrite.io/console'; -import { redirect } from '@sveltejs/kit'; +// import { redirect } from '@sveltejs/kit'; import { error } from '@sveltejs/kit'; export const load = async ({ parent, url, params }) => { @@ -28,13 +28,11 @@ export const load = async ({ parent, url, params }) => { error(404, 'Type is not valid'); } - if (account) - return { - account, - template: template, - product, - organizations: account?.$id - ? await sdk.forConsole.billing.listOrganization() - : undefined - }; + return { + account, + template: template, + product, + // organizations: account?.$id ? await sdk.forConsole.billing.listOrganization() : undefined + organizations: account?.$id ? await sdk.forConsole.teams.list() : undefined + }; }; diff --git a/src/routes/(public)/template-[template]/redirect-[organization]/+page.svelte b/src/routes/(public)/template-[template]/redirect-[organization]/+page.svelte new file mode 100644 index 000000000..303022979 --- /dev/null +++ b/src/routes/(public)/template-[template]/redirect-[organization]/+page.svelte @@ -0,0 +1,23 @@ + + + + Redirecting - Appwrite + + + + + + Redirecting... + + Please wait while we redirect you + diff --git a/src/routes/(public)/template-[template]/redirect-[organization]/+page.ts b/src/routes/(public)/template-[template]/redirect-[organization]/+page.ts new file mode 100644 index 000000000..f0d46186d --- /dev/null +++ b/src/routes/(public)/template-[template]/redirect-[organization]/+page.ts @@ -0,0 +1,14 @@ +import { sdk } from '$lib/stores/sdk.js'; + +export const load = async ({ params, url }) => { + // const { account } = await parent(); + const prefs = await sdk.forConsole.account.getPrefs(); + if (prefs.organization !== params.organization) { + const newPrefs = { ...prefs, organization: params.organization }; + sdk.forConsole.account.updatePrefs(newPrefs); + } + return { + organization: await sdk.forConsole.teams.get(params.organization), + route: url.searchParams.get('route') + }; +};