diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 286e44d868..285e4607a3 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -42,7 +42,6 @@ const INITIAL_FRONTEND_STATE = { messagePassing: false, continueIfAction: false, }, - currentFrontEndType: "none", errors: [], hasAppPackage: false, libraries: null, @@ -191,7 +190,6 @@ export const getFrontendStore = () => { screens.find(screen => screen._id === screenId) || screens[0] if (!screen) return state - state.currentFrontEndType = FrontendTypes.SCREEN state.selectedScreenId = screen._id state.currentView = "detail" state.selectedComponentId = screen.props?._id @@ -287,13 +285,8 @@ export const getFrontendStore = () => { }, preview: { saveSelected: async () => { - const state = get(store) const selectedAsset = get(currentAsset) - if (state.currentFrontEndType !== FrontendTypes.LAYOUT) { - return await store.actions.screens.save(selectedAsset) - } else { - return await store.actions.layouts.save(selectedAsset) - } + return await store.actions.screens.save(selectedAsset) }, setDevice: device => { store.update(state => { @@ -308,8 +301,6 @@ export const getFrontendStore = () => { const layout = store.actions.layouts.find(layoutId) || get(store).layouts[0] if (!layout) return - state.currentFrontEndType = FrontendTypes.LAYOUT - state.currentView = "detail" state.selectedLayoutId = layout._id state.selectedComponentId = layout.props?._id return state diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 38ad9b73b7..b4dbf715a4 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -19,6 +19,7 @@ import ErrorSVG from "@budibase/frontend-core/assets/error.svg?raw" import { findComponent, findComponentPath } from "builderStore/componentUtils" import { isActive, goto } from "@roxi/routify" + import { Screen } from "builderStore/store/screenTemplates/utils/Screen" let iframe let layout @@ -42,14 +43,22 @@ $store.clientLibPath ) + const placeholderScreen = new Screen() + .name("Screen Placeholder") + .route("/") + .component("@budibase/standard-components/screenslot") + .instanceName("Content Placeholder") + .normalStyle({ flex: "1 1 auto" }) + .json() + // Extract data to pass to the iframe $: { - screen = $selectedScreen - // If viewing legacy layouts, always show the custom layout if ($isActive("./layouts")) { + screen = placeholderScreen layout = $selectedLayout } else { + screen = $selectedScreen layout = $store.layouts.find(layout => layout._id === screen?.layoutId) } } @@ -63,7 +72,6 @@ layout, screen, selectedComponentId, - previewType: $store.currentFrontEndType, theme: $store.theme, customTheme: $store.customTheme, previewDevice: $store.previewDevice, diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/iframeTemplate.js b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/iframeTemplate.js index 3555194263..def32dd45f 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/iframeTemplate.js +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/iframeTemplate.js @@ -61,7 +61,6 @@ export default ` selectedComponentId, layout, screen, - previewType, appId, theme, customTheme, @@ -76,7 +75,6 @@ export default ` window["##BUDIBASE_PREVIEW_SCREEN##"] = screen window["##BUDIBASE_SELECTED_COMPONENT_ID##"] = selectedComponentId window["##BUDIBASE_PREVIEW_ID##"] = Math.random() - window["##BUDIBASE_PREVIEW_TYPE##"] = previewType window["##BUDIBASE_PREVIEW_THEME##"] = theme window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"] = customTheme window["##BUDIBASE_PREVIEW_DEVICE##"] = previewDevice diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 347df9aab8..8d73afb24a 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -156,7 +156,7 @@