diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index 9043fb748f..89c10bb625 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -5,6 +5,7 @@ import Divider from "../Divider/Divider.svelte" import Icon from "../Icon/Icon.svelte" import Context from "../context" + import ProgressCircle from "../ProgressCircle/ProgressCircle.svelte" export let title = undefined export let size = "S" @@ -102,15 +103,22 @@ {/if} {#if showConfirmButton} - + + + {/if} {/if} @@ -169,4 +177,8 @@ .spectrum-Dialog-buttonGroup { padding-left: 0; } + + .confirm-wrap :global(.spectrum-Button-label) { + display: contents; + } diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 6ed5bf8244..623e30e73b 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -13,18 +13,20 @@ export let template + let creating = false + const values = writable({ name: "", url: null }) const validation = createValidationStore() $: validation.check($values) onMount(async () => { - $values.url = resolveAppUrl(template, $values.name, $values.url) $values.name = resolveAppName(template, $values.name) + nameToUrl($values.name) await setupValidation() }) $: appUrl = `${window.location.origin}${ - $values.url ? $values.url : `/${resolveAppUrl(template, $values.name)}` + $values.url ? $values.url : `${resolveAppUrl(template, $values.name)}` }` const resolveAppUrl = (template, name) => { @@ -39,7 +41,19 @@ if (template && !name) { return template.name } - return name.trim() + return name ? name.trim() : null + } + + const tidyUrl = url => { + if (url && !url.startsWith("/")) { + url = `/${url}` + } + $values.url = url === "" ? null : url + } + + const nameToUrl = appName => { + let resolvedUrl = resolveAppUrl(template, appName) + tidyUrl(resolvedUrl) } const setupValidation = async () => { @@ -52,6 +66,8 @@ } async function createNewApp() { + creating = true + try { // Create form data to create app let data = new FormData() @@ -86,17 +102,11 @@ await auth.setInitInfo({}) $goto(`/builder/app/${createdApp.instance._id}`) } catch (error) { + creating = false console.error(error) notifications.error("Error creating app") } } - - // auto add slash to url - $: { - if ($values.url && !$values.url.startsWith("/")) { - $values.url = `/${$values.url}` - } - } ($validation.touched.name = true)} + on:change={nameToUrl($values.name)} label="Name" - placeholder={$auth.user.firstName + placeholder={$auth.user?.firstName ? `${$auth.user.firstName}s app` : "My app"} /> ($validation.touched.url = true)} + on:change={tidyUrl($values.url)} label="URL" placeholder={$values.url ? $values.url : `/${resolveAppUrl(template, $values.name)}`} /> - {#if $values.name} -
- - {window.location.origin} - - {$values.url - ? $values.url - : `/${resolveAppUrl(template, $values.name)}`} + {#if $values.url && $values.url !== "" && !$validation.errors.url} +
+ {`${window.location.origin}${$values.url}`}
{/if}