diff --git a/packages/builder/src/builderStore/getNewComponentName.js b/packages/builder/src/builderStore/getNewComponentName.js index 1c156fd9f5..5937eb8823 100644 --- a/packages/builder/src/builderStore/getNewComponentName.js +++ b/packages/builder/src/builderStore/getNewComponentName.js @@ -2,6 +2,7 @@ import { walkProps } from "./storeUtils" import { get_capitalised_name } from "../helpers" import { get } from "svelte/store" import { allScreens } from "builderStore" +import { FrontendTypes } from "../constants" export default function(component, state) { const capitalised = get_capitalised_name( @@ -25,7 +26,7 @@ export default function(component, state) { } // if viewing screen, check current screen for duplicate - if (state.currentFrontEndType === "screen") { + if (state.currentFrontEndType === FrontendTypes.SCREEN) { findMatches(state.currentPreviewItem.props) } else { // viewing a layout - need to find against all screens diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 0475a5c301..91559b585d 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -15,15 +15,15 @@ export const currentAsset = derived(store, $store => { const layout = $store.layouts ? $store.layouts.find(layout => layout._id === $store.currentAssetId) : null - if (layout) { - return layout - } + + if (layout) return layout + const screen = $store.screens ? $store.screens.find(screen => screen._id === $store.currentAssetId) : null - if (screen) { - return screen - } + + if (screen) return screen + return null }) diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte index 347ce00ed2..b8568cae99 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte @@ -22,12 +22,7 @@ const path = store.actions.components.findRoute(component) // Go to correct URL - $goto(`./${$store.currentFrontEndType}s/${$store.currentAssetId}/${path}`) - // if (layout) { - // $goto(`./layouts/${path}`) - // } else { - // $goto(`./screens/${$currentAsset.id}/${path}`) - // } + $goto(`./${$store.currentAssetId}/${path}`) } const dragstart = component => e => { diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/LayoutDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/LayoutDropdownMenu.svelte index 1767cae54c..79a66e0af4 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/LayoutDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/LayoutDropdownMenu.svelte @@ -42,14 +42,14 @@ - confirmDeleteDialog.show()} /> editLayoutNameModal.show()} /> + confirmDeleteDialog.show()} /> diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte index cac25c303e..e304ed6d86 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte @@ -19,7 +19,7 @@ const changeScreen = screenId => { // select the route store.actions.screens.select(screenId) - $goto(`./screens/${screenId}`) + $goto(`./screen/${screenId}`) } diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index 009596e0f3..eb610f1397 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -1,5 +1,6 @@ diff --git a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte index e3abc42c25..8c634e22f4 100644 --- a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte @@ -1,7 +1,8 @@ @@ -27,13 +27,13 @@ icon="ri-layout-3-line" text={layout.name} withArrow - selected={$store.currentComponentInfo?._id === layout.props._id} + selected={$store.currentComponentInfo?._id === layout.props?._id} opened={$store.currentAssetId === layout._id} on:click={selectLayout}> -{#if $store.currentAssetId === layout._id && layout.props._children} +{#if $store.currentAssetId === layout._id && layout.props?._children} -
- -
+ diff --git a/packages/builder/src/components/userInterface/NewScreenModal.svelte b/packages/builder/src/components/userInterface/NewScreenModal.svelte index 6c95987591..05a18adb7f 100644 --- a/packages/builder/src/components/userInterface/NewScreenModal.svelte +++ b/packages/builder/src/components/userInterface/NewScreenModal.svelte @@ -85,7 +85,7 @@ }) } - $goto(`./screens/${createdScreen._id}`) + $goto(`./screen/${createdScreen._id}`) } const routeNameExists = route => { diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index 551d8044bd..e3eed43121 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -1,5 +1,6 @@ - +