refactor wizard into its own file
This commit is contained in:
parent
3b74481708
commit
f3cddaaf08
|
@ -13,6 +13,8 @@
|
||||||
import NewLayoutModal from "components/design/NavigationPanel/NewLayoutModal.svelte"
|
import NewLayoutModal from "components/design/NavigationPanel/NewLayoutModal.svelte"
|
||||||
import { Icon, Modal, Select, Search, Tabs, Tab } from "@budibase/bbui"
|
import { Icon, Modal, Select, Search, Tabs, Tab } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let showModal
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
title: "Screens",
|
title: "Screens",
|
||||||
|
@ -24,7 +26,7 @@
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export let modal
|
let modal
|
||||||
$: selected = tabs.find(t => t.key === $params.assetType)?.title || "Screens"
|
$: selected = tabs.find(t => t.key === $params.assetType)?.title || "Screens"
|
||||||
|
|
||||||
const navigate = ({ detail }) => {
|
const navigate = ({ detail }) => {
|
||||||
|
@ -98,7 +100,7 @@
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<div class="add-button">
|
<div class="add-button">
|
||||||
<Icon hoverable name="AddCircle" on:click={modal.show} />
|
<Icon hoverable name="AddCircle" on:click={showModal()} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
let selectedNav
|
let selectedNav
|
||||||
let createdScreens = []
|
let createdScreens = []
|
||||||
$: {
|
$: {
|
||||||
selectedScreens.forEach(screen => {
|
selectedScreens?.forEach(screen => {
|
||||||
createdScreens = [...createdScreens, screen.create()]
|
createdScreens = [...createdScreens, screen.create()]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$: blankSelected = selectedScreens.find(x => x.id === "createFromScratch")
|
$: blankSelected = selectedScreens.length === 1
|
||||||
|
|
||||||
const save = async screens => {
|
const save = async screens => {
|
||||||
for (let screen of screens) {
|
for (let screen of screens) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
export let selectedScreens = []
|
export let selectedScreens = []
|
||||||
|
|
||||||
const blankScreen = "createFromScratch"
|
const blankScreen = "createFromScratch"
|
||||||
$: blankSelected = selectedScreens.find(x => x.id === blankScreen)
|
$: blankSelected = selectedScreens.length === 1
|
||||||
$: autoSelected = selectedScreens.length > 0 && !blankSelected
|
$: autoSelected = selectedScreens.length > 0 && !blankSelected
|
||||||
|
|
||||||
$: templates = getTemplates($store, $tables.list)
|
$: templates = getTemplates($store, $tables.list)
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
screen => !screen.name.includes(table.name)
|
screen => !screen.name.includes(table.name)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const templates = getTemplates($store, $tables.list).filter(template =>
|
const templates = templates.filter(template =>
|
||||||
template.name.includes(table.name)
|
template.name.includes(table.name)
|
||||||
)
|
)
|
||||||
selectedScreens = [...templates, ...selectedScreens]
|
selectedScreens = [...templates, ...selectedScreens]
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
Autogenerated screens come with CRUD functionality.</Body
|
Autogenerated screens come with CRUD functionality.</Body
|
||||||
>
|
>
|
||||||
|
|
||||||
<Layout noPadding>
|
<Layout noPadding gap="S">
|
||||||
<Detail size="S">Blank screen</Detail>
|
<Detail size="S">Blank screen</Detail>
|
||||||
<div
|
<div
|
||||||
class="item"
|
class="item"
|
||||||
|
@ -90,7 +90,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding-left: 10px;
|
|
||||||
letter-spacing: 0px;
|
letter-spacing: 0px;
|
||||||
color: #2c2c2c;
|
color: #2c2c2c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
size="M"
|
size="M"
|
||||||
title={"Enter Details"}
|
title={"Enter details"}
|
||||||
confirmText={"Continue"}
|
confirmText={"Continue"}
|
||||||
onCancel={() => modal.show()}
|
onCancel={() => modal.show()}
|
||||||
onConfirm={() => navigationSelectionModal.show()}
|
onConfirm={() => navigationSelectionModal.show()}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<script>
|
||||||
|
import NavigationSelectionModal from "components/design/NavigationPanel/NavigationSelectionModal.svelte"
|
||||||
|
import ScreenNameModal from "components/design/NavigationPanel/ScreenNameModal.svelte"
|
||||||
|
import NewScreenModal from "components/design/NavigationPanel/NewScreenModal.svelte"
|
||||||
|
import { Modal } from "@budibase/bbui"
|
||||||
|
|
||||||
|
let modal
|
||||||
|
let navigationSelectionModal
|
||||||
|
let screenNameModal
|
||||||
|
let screenName = ""
|
||||||
|
let url = ""
|
||||||
|
let selectedScreens = []
|
||||||
|
|
||||||
|
export function showModal() {
|
||||||
|
modal.show()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal bind:this={modal}>
|
||||||
|
<NewScreenModal
|
||||||
|
{screenNameModal}
|
||||||
|
{navigationSelectionModal}
|
||||||
|
bind:selectedScreens
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal bind:this={screenNameModal}>
|
||||||
|
<ScreenNameModal
|
||||||
|
bind:screenName
|
||||||
|
bind:url
|
||||||
|
{modal}
|
||||||
|
{navigationSelectionModal}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
<Modal bind:this={navigationSelectionModal}>
|
||||||
|
<NavigationSelectionModal
|
||||||
|
bind:url
|
||||||
|
bind:screenName
|
||||||
|
{modal}
|
||||||
|
bind:selectedScreens
|
||||||
|
{screenNameModal}
|
||||||
|
/>
|
||||||
|
</Modal>
|
|
@ -5,7 +5,7 @@
|
||||||
selectedComponent,
|
selectedComponent,
|
||||||
allScreens,
|
allScreens,
|
||||||
} from "builderStore"
|
} from "builderStore"
|
||||||
import { Detail, Layout, Button, Modal, Icon } from "@budibase/bbui"
|
import { Detail, Layout, Button, Icon } from "@budibase/bbui"
|
||||||
|
|
||||||
import CurrentItemPreview from "components/design/AppPreview"
|
import CurrentItemPreview from "components/design/AppPreview"
|
||||||
import PropertiesPanel from "components/design/PropertiesPanel/PropertiesPanel.svelte"
|
import PropertiesPanel from "components/design/PropertiesPanel/PropertiesPanel.svelte"
|
||||||
|
@ -18,10 +18,8 @@
|
||||||
import AppThemeSelect from "components/design/AppPreview/AppThemeSelect.svelte"
|
import AppThemeSelect from "components/design/AppPreview/AppThemeSelect.svelte"
|
||||||
import ThemeEditor from "components/design/AppPreview/ThemeEditor.svelte"
|
import ThemeEditor from "components/design/AppPreview/ThemeEditor.svelte"
|
||||||
import DevicePreviewSelect from "components/design/AppPreview/DevicePreviewSelect.svelte"
|
import DevicePreviewSelect from "components/design/AppPreview/DevicePreviewSelect.svelte"
|
||||||
import NavigationSelectionModal from "components/design/NavigationPanel/NavigationSelectionModal.svelte"
|
|
||||||
import ScreenNameModal from "components/design/NavigationPanel/ScreenNameModal.svelte"
|
|
||||||
import NewScreenModal from "components/design/NavigationPanel/NewScreenModal.svelte"
|
|
||||||
import Logo from "assets/bb-space-man.svg"
|
import Logo from "assets/bb-space-man.svg"
|
||||||
|
import ScreenWizard from "components/design/NavigationPanel/ScreenWizard.svelte"
|
||||||
|
|
||||||
// Cache previous values so we don't update the URL more than necessary
|
// Cache previous values so we don't update the URL more than necessary
|
||||||
let previousType
|
let previousType
|
||||||
|
@ -30,12 +28,7 @@
|
||||||
let hydrationComplete = false
|
let hydrationComplete = false
|
||||||
|
|
||||||
// Manage the layout modal flow from here
|
// Manage the layout modal flow from here
|
||||||
let modal
|
let showModal
|
||||||
let navigationSelectionModal
|
|
||||||
let screenNameModal
|
|
||||||
let screenName = ""
|
|
||||||
let url = ""
|
|
||||||
let selectedScreens = []
|
|
||||||
|
|
||||||
// Hydrate state from URL params
|
// Hydrate state from URL params
|
||||||
$: hydrateStateFromURL($params, $leftover)
|
$: hydrateStateFromURL($params, $leftover)
|
||||||
|
@ -159,7 +152,7 @@
|
||||||
<!-- routify:options index=1 -->
|
<!-- routify:options index=1 -->
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="ui-nav">
|
<div class="ui-nav">
|
||||||
<FrontendNavigatePane {modal} />
|
<FrontendNavigatePane {showModal} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="preview-pane">
|
<div class="preview-pane">
|
||||||
|
@ -188,7 +181,7 @@
|
||||||
<div class="new-screen-text">
|
<div class="new-screen-text">
|
||||||
<Detail size="M">Let's add some life to this screen</Detail>
|
<Detail size="M">Let's add some life to this screen</Detail>
|
||||||
</div>
|
</div>
|
||||||
<Button on:click={() => modal.show()} size="M" cta>
|
<Button on:click={() => showModal()} size="M" cta>
|
||||||
<div class="new-screen-button">
|
<div class="new-screen-button">
|
||||||
<div class="background-icon" style="color: white;">
|
<div class="background-icon" style="color: white;">
|
||||||
<Icon name="Add" />
|
<Icon name="Add" />
|
||||||
|
@ -210,31 +203,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
<Modal bind:this={modal}>
|
|
||||||
<NewScreenModal
|
|
||||||
{screenNameModal}
|
|
||||||
{navigationSelectionModal}
|
|
||||||
bind:selectedScreens
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<Modal bind:this={screenNameModal}>
|
<ScreenWizard bind:showModal />
|
||||||
<ScreenNameModal
|
|
||||||
bind:screenName
|
|
||||||
bind:url
|
|
||||||
{modal}
|
|
||||||
{navigationSelectionModal}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
<Modal bind:this={navigationSelectionModal}>
|
|
||||||
<NavigationSelectionModal
|
|
||||||
bind:url
|
|
||||||
bind:screenName
|
|
||||||
{modal}
|
|
||||||
bind:selectedScreens
|
|
||||||
{screenNameModal}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
|
|
Loading…
Reference in New Issue