New Onboarding Loading States (#9519)
* New Onboarding Loading States * Pr Feedback
This commit is contained in:
parent
cdc2159af6
commit
7a443f6a5d
|
@ -16,6 +16,7 @@
|
||||||
import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte"
|
import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte"
|
||||||
import createFromScratchScreen from "builderStore/store/screenTemplates/createFromScratchScreen"
|
import createFromScratchScreen from "builderStore/store/screenTemplates/createFromScratchScreen"
|
||||||
import { Roles } from "constants/backend"
|
import { Roles } from "constants/backend"
|
||||||
|
import Spinner from "components/common/Spinner.svelte"
|
||||||
|
|
||||||
let name = "My first app"
|
let name = "My first app"
|
||||||
let url = "my-first-app"
|
let url = "my-first-app"
|
||||||
|
@ -25,12 +26,15 @@
|
||||||
let plusIntegrations = {}
|
let plusIntegrations = {}
|
||||||
let integrationsLoading = true
|
let integrationsLoading = true
|
||||||
$: getIntegrations()
|
$: getIntegrations()
|
||||||
|
let creationLoading = false
|
||||||
|
|
||||||
let uploadModal
|
let uploadModal
|
||||||
|
|
||||||
const createApp = async useSampleData => {
|
const createApp = async useSampleData => {
|
||||||
|
creationLoading = true
|
||||||
// Create form data to create app
|
// Create form data to create app
|
||||||
// This is form based and not JSON
|
// This is form based and not JSON
|
||||||
|
try {
|
||||||
let data = new FormData()
|
let data = new FormData()
|
||||||
data.append("name", name.trim())
|
data.append("name", name.trim())
|
||||||
data.append("url", url.trim())
|
data.append("url", url.trim())
|
||||||
|
@ -58,6 +62,10 @@
|
||||||
await store.actions.screens.save(defaultScreenTemplate)
|
await store.actions.screens.save(defaultScreenTemplate)
|
||||||
|
|
||||||
appId = createdApp.instance._id
|
appId = createdApp.instance._id
|
||||||
|
} catch (e) {
|
||||||
|
creationLoading = false
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getIntegrations = async () => {
|
const getIntegrations = async () => {
|
||||||
|
@ -102,6 +110,7 @@
|
||||||
goToApp()
|
goToApp()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
creationLoading = false
|
||||||
notifications.error("There was a problem creating your app")
|
notifications.error("There was a problem creating your app")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,8 +127,10 @@
|
||||||
<SplitPage>
|
<SplitPage>
|
||||||
{#if stage === "name"}
|
{#if stage === "name"}
|
||||||
<NamePanel bind:name bind:url onNext={() => (stage = "data")} />
|
<NamePanel bind:name bind:url onNext={() => (stage = "data")} />
|
||||||
{:else if integrationsLoading}
|
{:else if integrationsLoading || creationLoading}
|
||||||
<p>loading...</p>
|
<div class="spinner">
|
||||||
|
<Spinner />
|
||||||
|
</div>
|
||||||
{:else if stage === "data"}
|
{:else if stage === "data"}
|
||||||
<DataPanel onBack={() => (stage = "name")}>
|
<DataPanel onBack={() => (stage = "name")}>
|
||||||
<div class="dataButton">
|
<div class="dataButton">
|
||||||
|
@ -175,6 +186,13 @@
|
||||||
</SplitPage>
|
</SplitPage>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.spinner {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
.dataButton {
|
.dataButton {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue