diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 2ca8057b48..3cd387fe95 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -61,6 +61,12 @@ export const selectedLayout = derived(store, $store => { export const selectedComponent = derived( [store, selectedScreen], ([$store, $selectedScreen]) => { + if ( + $selectedScreen && + ["navigation", "screen"].includes($store.selectedComponentId) + ) { + return findComponent($selectedScreen?.props, $selectedScreen?.props._id) + } if (!$selectedScreen || !$store.selectedComponentId) { return null } diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index f312a58e97..038fb661b9 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -769,9 +769,13 @@ export const getFrontendStore = () => { else { await store.actions.screens.patch(screen => { // Find the selected component + let selectedComponentId = state.selectedComponentId + if (["navigation", "screen"].includes(selectedComponentId)) { + selectedComponentId = screen?.props._id + } const currentComponent = findComponent( screen.props, - state.selectedComponentId + selectedComponentId ) if (!currentComponent) { return false diff --git a/packages/builder/src/pages/builder/app/[application]/design/_components/CreateScreenModal.svelte b/packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/_components/CreateScreenModal.svelte rename to packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/_components/DatasourceModal.svelte b/packages/builder/src/components/design/NewScreen/DatasourceModal.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/_components/DatasourceModal.svelte rename to packages/builder/src/components/design/NewScreen/DatasourceModal.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/_components/ScreenRoleModal.svelte b/packages/builder/src/components/design/NewScreen/ScreenRoleModal.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/_components/ScreenRoleModal.svelte rename to packages/builder/src/components/design/NewScreen/ScreenRoleModal.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/blank.png b/packages/builder/src/components/design/NewScreen/blank.png similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/blank.png rename to packages/builder/src/components/design/NewScreen/blank.png diff --git a/packages/builder/src/components/design/NewScreen/index.svelte b/packages/builder/src/components/design/NewScreen/index.svelte new file mode 100644 index 0000000000..b504940ca7 --- /dev/null +++ b/packages/builder/src/components/design/NewScreen/index.svelte @@ -0,0 +1,105 @@ + + +