diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index f70e5f4d47..e857689eba 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -85,15 +85,12 @@ export const getFrontendStore = () => { screens: { select: screenId => { store.update(state => { - const screens = get(allScreens) - let selectedScreen = screens.find(screen => screen._id === screenId) - if (!selectedScreen) { - selectedScreen = screens[0] - } + const screen = get(allScreens).find(screen => screen._id === screenId) + if (!screen) return state state.currentFrontEndType = FrontendTypes.SCREEN state.currentAssetId = selectedScreen._id state.currentView = "detail" - state.selectedComponentId = selectedScreen.props._id + state.selectedComponentId = screen.props?._id return state }) }, @@ -143,6 +140,9 @@ export const getFrontendStore = () => { `/api/screens/${screenToDelete._id}/${screenToDelete._rev}` ) ) + if (screenToDelete._id === state.currentAssetId) { + state.currentAssetId = "" + } } return state }) @@ -165,10 +165,11 @@ export const getFrontendStore = () => { select: layoutId => { store.update(state => { const layout = store.actions.layouts.find(layoutId) + if (!layout) return state.currentFrontEndType = FrontendTypes.LAYOUT state.currentView = "detail" state.currentAssetId = layout._id - state.selectedComponentId = layout.props._id + state.selectedComponentId = layout.props?._id return state }) }, diff --git a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js index 1e699dad95..74f9b55fc8 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js @@ -18,7 +18,7 @@ export default function(tables) { }) } -export const newRowUrl = table => sanitizeUrl(`/${table.name}/new`) +export const newRowUrl = table => sanitizeUrl(`/${table.name}/new/row`) export const NEW_ROW_TEMPLATE = "NEW_ROW_TEMPLATE" function generateTitleContainer(table) { diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte index 0b0cb44fa7..1e7a64b0c0 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/ScreenDropdownMenu.svelte @@ -15,8 +15,15 @@ $: screen = $allScreens.find(screen => screen._id === screenId) const deleteScreen = () => { - store.actions.screens.delete(screen) - store.actions.routing.fetch() + try { + store.actions.screens.delete(screen) + store.actions.routing.fetch() + confirmDeleteDialog.hide() + $goto("../") + notifier.success("Deleted screen successfully.") + } catch (err) { + notifier.danger("Error deleting screen") + } } diff --git a/packages/builder/src/components/userInterface/DesignView.svelte b/packages/builder/src/components/userInterface/DesignView.svelte index cbb532fcae..66ec1a2676 100644 --- a/packages/builder/src/components/userInterface/DesignView.svelte +++ b/packages/builder/src/components/userInterface/DesignView.svelte @@ -12,8 +12,6 @@ let propGroup = null let currentGroup - const getProperties = name => panelDefinition[name] - function onChange(category) { selectedCategory = category } @@ -38,7 +36,7 @@ {#each propertyGroupNames as groupName} import { onMount } from "svelte" import FlatButton from "./FlatButton.svelte" + export let buttonProps = [] export let isMultiSelect = false export let value = [] diff --git a/packages/builder/src/components/userInterface/LayoutsList.svelte b/packages/builder/src/components/userInterface/LayoutsList.svelte deleted file mode 100644 index 9ba562f81c..0000000000 --- a/packages/builder/src/components/userInterface/LayoutsList.svelte +++ /dev/null @@ -1,64 +0,0 @@ - - -
- {#each layouts as { title, id }} - - {/each} -
- - diff --git a/packages/builder/src/components/userInterface/PropertyControl.svelte b/packages/builder/src/components/userInterface/PropertyControl.svelte index fa19d9cfd6..44e98ad7d9 100644 --- a/packages/builder/src/components/userInterface/PropertyControl.svelte +++ b/packages/builder/src/components/userInterface/PropertyControl.svelte @@ -22,16 +22,14 @@ export let onChange = () => {} let temporaryBindableValue = value + let bindableProperties = [] + let anchor + let dropdown function handleClose() { handleChange(key, temporaryBindableValue) } - let bindableProperties = [] - - let anchor - let dropdown - function getBindableProperties() { // Get all bindableProperties bindableProperties = fetchBindableProperties({ @@ -77,7 +75,7 @@ : temp } - //Incase the component has a different value key name + // Incase the component has a different value key name const handlevalueKey = value => props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() } @@ -94,7 +92,7 @@ {...props} name={key} /> - {#if bindable && control === Input && !key.startsWith('_')} + {#if bindable && !key.startsWith('_') && control === Input}
- {#if showImage}{/if} + use:styleable={$component.styles} + style="--cardWidth: {cardWidth}"> + {#if showImage}{/if}

{heading}

{description}

- {linkText} + {linkText}
@@ -75,7 +74,7 @@ a { margin: 0.5rem 0; text-decoration: none; - color: var(--color); + color: var(--linkColor); font-weight: 600; } diff --git a/packages/standard-components/src/CardHorizontal.svelte b/packages/standard-components/src/CardHorizontal.svelte index df47097180..f0741fd7de 100644 --- a/packages/standard-components/src/CardHorizontal.svelte +++ b/packages/standard-components/src/CardHorizontal.svelte @@ -1,6 +1,5 @@
- {#if showImage}{/if} + style="--cardWidth: {cardWidth}"> + {#if showImage}{/if}

{heading}

{description}

-
@@ -97,7 +88,7 @@ a { margin: 0.5rem 0 0 0; text-decoration: none; - color: var(--color); + color: var(--linkColor); font-weight: 600; font-size: 0.85rem; margin: 0;