diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 7c1602a454..e3e8c3515d 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -39,9 +39,11 @@ let submitting = false let valid = false + let wasShowingTemplates $: checkValidity($values, validator) - $: showTemplateSelection = !template?.fromFile && !template?.key + $: showTemplateSelection = + !template || (!template?.fromFile && !template?.key) onMount(async () => { await hostingStore.actions.fetchDeployedApps() @@ -145,15 +147,20 @@ size="L" onConfirm={() => { showTemplateSelection = false + wasShowingTemplates = true return false }} showCancelButton={false} showCloseIcon={false} > { + onSelect={(selected, { useImport } = {}) => { if (!selected) { + if (useImport) { + template = { fromFile: true } + } showTemplateSelection = false + wasShowingTemplates = true return } @@ -166,6 +173,8 @@ title={template?.fromFile ? "Import app" : "Create app"} confirmText={template?.fromFile ? "Import app" : "Create app"} onConfirm={createNewApp} + onCancel={wasShowingTemplates ? () => (template = null) : null} + cancelText={wasShowingTemplates ? "Back" : undefined} disabled={!valid} > {#if template?.fromFile} diff --git a/packages/builder/src/components/start/TemplateList.svelte b/packages/builder/src/components/start/TemplateList.svelte index d8e65062b5..2639f86404 100644 --- a/packages/builder/src/components/start/TemplateList.svelte +++ b/packages/builder/src/components/start/TemplateList.svelte @@ -7,7 +7,6 @@ async function fetchTemplates() { const response = await api.get("/api/templates?type=app") - console.log("Responded") return await response.json() } @@ -48,6 +47,19 @@ Start from scratch

BLANK

+
onSelect(null, { useImport: true })} + > +
+ +
+ Import app +

BLANK

+
{:catch err}

{err}

@@ -95,4 +107,8 @@ background: var(--spectrum-global-color-gray-50); margin-top: 20px; } + + .import { + background: var(--spectrum-global-color-gray-50); + } diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 01eaa8281e..319ef91d2e 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -84,12 +84,6 @@ } } - const initiateAppImport = () => { - template = { fromFile: true } - creationModal.show() - creatingApp = true - } - const stopAppCreation = () => { template = null creatingApp = false @@ -207,7 +201,6 @@ {#if cloud} {/if} -