From 6886a312c5dbfa07905ca3124d0a23d610dcfe10 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Mon, 14 Aug 2023 13:31:12 +0100 Subject: [PATCH 01/50] New Left Panel for Design --- packages/builder/src/builderStore/index.js | 6 + .../src/builderStore/store/frontend.js | 6 +- .../NewScreen}/CreateScreenModal.svelte | 0 .../design/NewScreen}/DatasourceModal.svelte | 0 .../design/NewScreen}/ScreenRoleModal.svelte | 0 .../design/NewScreen}/blank.png | Bin .../components/design/NewScreen/index.svelte | 105 +++++++ .../design/NewScreen}/table.png | Bin .../design/[screenId]/_fallback.svelte | 5 - .../design/[screenId]/_layout.svelte | 86 +----- .../_components/AppPanel.svelte | 46 +--- .../_components/AppPreview.svelte | 55 +--- .../ComponentInfoSection.svelte | 0 .../ComponentSettingsPanel.svelte | 0 .../ComponentSettingsSection.svelte | 0 .../ConditionalUIDrawer.svelte | 0 .../ConditionalUISection.svelte | 0 .../CustomStylesSection.svelte | 0 .../DesignSection.svelte | 0 .../StyleSection.svelte | 0 .../componentStyles.js | 0 .../_components/DevicePreviewSelect.svelte | 0 .../Components}/ComponentDropdownMenu.svelte | 0 .../Components}/ComponentKeyHandler.svelte | 17 +- .../Components}/ComponentScrollWrapper.svelte | 19 +- .../Components}/ComponentTree.svelte | 0 .../Components}/DNDPositionIndicator.svelte | 0 .../Components}/ScreenslotDropdownMenu.svelte | 0 .../Components}/dndStore.js | 0 .../LeftPanel/Components/index.svelte | 156 +++++++++++ .../LeftPanel/Screens/DropdownMenu.svelte} | 0 .../LeftPanel/Screens}/RoleIndicator.svelte | 8 +- .../LeftPanel/Screens/index.svelte | 233 ++++++++++++++++ .../_components/LeftPanel/index.svelte | 24 ++ .../_components/Navigation/index.svelte | 260 ++++++++++++++++++ .../_components/Screen/SettingsPanel.svelte} | 0 .../navigation/ComponentListPanel.svelte | 90 ------ .../components/[componentId]/_layout.svelte | 56 +++- .../design/[screenId]/components/index.svelte | 12 +- .../design/[screenId]/index.svelte | 5 +- .../_components/LayoutDropdownMenu.svelte | 41 --- .../_components/LayoutListPanel.svelte | 29 -- .../_components/LayoutSettingsPanel.svelte | 53 ---- .../layouts/[layoutId]/_layout.svelte | 20 -- .../layouts/[layoutId]/index.svelte | 7 - .../design/[screenId]/layouts/_layout.svelte | 12 - .../design/[screenId]/layouts/index.svelte | 12 - .../NavigationInfoPanel/CustomizePane.svelte | 176 ------------ .../NavigationInfoPanel/SettingsPane.svelte | 31 --- .../NavigationInfoPanel/index.svelte | 10 - .../_components/NavigationLinksDrawer.svelte | 130 --------- .../_components/NavigationLinksEditor.svelte | 34 --- .../NavigationSettingsPanel.svelte | 110 -------- .../design/[screenId]/navigation/index.svelte | 7 - .../_components/ScreenListPanel.svelte | 75 ----- .../design/[screenId]/screens/index.svelte | 12 - .../theme/_components/AppThemeSelect.svelte | 64 ----- .../_components/ButtonRoundnessSelect.svelte | 38 --- .../theme/_components/ThemeInfoPanel.svelte | 12 - .../_components/ThemeSettingsPanel.svelte | 55 ---- .../design/[screenId]/theme/index.svelte | 7 - .../app/[application]/design/index.svelte | 2 +- .../app/[application]/design/new.svelte | 103 +------ .../client/src/components/Component.svelte | 10 +- packages/client/src/components/Screen.svelte | 2 +- .../client/src/components/app/Layout.svelte | 11 +- .../src/components/preview/SettingsBar.svelte | 6 +- 67 files changed, 916 insertions(+), 1342 deletions(-) rename packages/builder/src/{pages/builder/app/[application]/design/_components => components/design/NewScreen}/CreateScreenModal.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/design/_components => components/design/NewScreen}/DatasourceModal.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/design/_components => components/design/NewScreen}/ScreenRoleModal.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/design => components/design/NewScreen}/blank.png (100%) create mode 100644 packages/builder/src/components/design/NewScreen/index.svelte rename packages/builder/src/{pages/builder/app/[application]/design => components/design/NewScreen}/table.png (100%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components/[componentId]}/_components/AppPanel.svelte (52%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components/[componentId]}/_components/AppPreview.svelte (86%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/ComponentInfoSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/ComponentSettingsPanel.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/ComponentSettingsSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/ConditionalUIDrawer.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/ConditionalUISection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/CustomStylesSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/DesignSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/StyleSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{settings => Component}/componentStyles.js (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components/[componentId]}/_components/DevicePreviewSelect.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/ComponentDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/ComponentKeyHandler.svelte (91%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/ComponentScrollWrapper.svelte (84%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/ComponentTree.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/DNDPositionIndicator.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/ScreenslotDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/{navigation => LeftPanel/Components}/dndStore.js (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Components/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{screens/_components/ScreenDropdownMenu.svelte => components/[componentId]/_components/LeftPanel/Screens/DropdownMenu.svelte} (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{screens/_components => components/[componentId]/_components/LeftPanel/Screens}/RoleIndicator.svelte (87%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{screens/_components/ScreenSettingsPanel.svelte => components/[componentId]/_components/Screen/SettingsPanel.svelte} (100%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/CustomizePane.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/SettingsPane.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/AppThemeSelect.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/ButtonRoundnessSelect.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/ThemeInfoPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/ThemeSettingsPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/index.svelte 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 @@ + + +
+ +
+ Start from scratch or create screens from your data +
+ +
+
createScreenModal.show("blank")}> +
+ +
+
+ Blank screen + Add an empty blank screen +
+
+ +
createScreenModal.show("table")}> +
+ +
+
+ Table + View, edit and delete rows on a table +
+
+
+
+
+ + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/table.png b/packages/builder/src/components/design/NewScreen/table.png similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/table.png rename to packages/builder/src/components/design/NewScreen/table.png diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte deleted file mode 100644 index 00165e4ee9..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte index 8bc0dcc3e5..77510951b1 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte @@ -1,11 +1,8 @@ -
-
- - $goto("./screens")} - /> - $goto("./components")} - /> - $goto("./theme")} - /> - $goto("./navigation")} - /> - {#if $store.layouts?.length} - $goto("./layouts")} - /> - {/if} - -
- -
- {#if $selectedScreen} - - - {/if} -
-
- - + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/AppPanel.svelte similarity index 52% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/AppPanel.svelte index 785b221239..379cebca37 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/AppPanel.svelte @@ -1,9 +1,7 @@ @@ -11,22 +9,11 @@
- +
+ Screens +
+
+ +
+
+ +
+
+
+ {#each filteredScreens as screen (screen._id)} + store.actions.screens.select(screen._id)} + rightAlignIcon + showTooltip + selectedBy={$userSelectedResourceMap[screen._id]} + > + + + + {/each} +
+ {#if !filteredScreens?.length} + + + There aren't any screens matching the current filters + + + {/if} +
+ +
+ (newScreen = false)} /> +
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte new file mode 100644 index 0000000000..3f521b23c7 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte @@ -0,0 +1,24 @@ + + +
+ +
+ +
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte new file mode 100644 index 0000000000..f442e3a275 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte @@ -0,0 +1,260 @@ + + +
+
+
+ +
+ Navigation +
+
+
+
+ General +
+
+ + Show nav on this screen +
+
+
+
+
+ Customize +
+
+
+ + These settings apply to all screens +
+
+ +
+
+ +
+ + update("navigation", "Top")} + /> + update("navigation", "Left")} + /> + + + {#if $store.navigation.navigation === "Top"} +
+ +
+ update("sticky", e.detail)} + /> +
+ +
+ update("logoUrl", e.detail)} + updateOnChange={false} + /> + {/if} +
+ +
+ update("hideTitle", !e.detail)} + /> + {#if !$store.navigation.hideTitle} +
+ +
+ update("title", e.detail)} + updateOnChange={false} + /> + {/if} +
+ +
+ update("navBackground", e.detail)} + /> +
+ +
+ update("navTextColor", e.detail)} + /> +
+
+
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Screen/SettingsPanel.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Screen/SettingsPanel.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte deleted file mode 100644 index 9513753d76..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte +++ /dev/null @@ -1,90 +0,0 @@ - - - -
- -
- -
    -
  • - { - $store.selectedComponentId = $selectedScreen?.props._id - }} - id={`component-${$selectedScreen?.props._id}`} - selectedBy={$userSelectedResourceMap[$selectedScreen?.props._id]} - > - - - - - - {#if $dndStore.dragging && $dndStore.valid} - - {#if $dndStore.dropPosition !== DropPosition.INSIDE} - - {/if} - {/if} -
  • -
-
-
- - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte index 860258c940..1dcf40a3c5 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte @@ -1,14 +1,19 @@ - - - +
+
+ {#if $selectedScreen} + + + {#if routeComponentId === "screen"} + + {:else if routeComponentId === "navigation"} + + {:else} + + {/if} + + {/if} +
+
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte index f8c4cc0868..9361415cb7 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte @@ -1,18 +1,8 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte index f5e3806bd6..496467c546 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte @@ -1,5 +1,8 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte deleted file mode 100644 index cba68f899d..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte +++ /dev/null @@ -1,41 +0,0 @@ - - - -
- -
- Delete -
- - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte deleted file mode 100644 index cc895317fd..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - - -
- {#each $store.layouts as layout (layout._id)} - store.actions.layouts.select(layout._id)} - > - - - {/each} -
-
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte deleted file mode 100644 index bfc2f94f43..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - Custom layouts are being deprecated. They will be removed in a future - release. - - - You can save the content of this layout by pressing the button below. - - - This will copy all components inside your layout, which you can then paste - into a screen. - - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte deleted file mode 100644 index c82fefab3e..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte deleted file mode 100644 index 4d39403bc3..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte deleted file mode 100644 index 1333c6afe3..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte deleted file mode 100644 index 09d45f8fde..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/CustomizePane.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/CustomizePane.svelte deleted file mode 100644 index 05108b1736..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/CustomizePane.svelte +++ /dev/null @@ -1,176 +0,0 @@ - - - -
-
- - CHANGES WILL APPLY TO ALL SCREENS -
- - Your navigation is configured for all the screens within your app. - -
- -
-
- -
- - update("navigation", "Top")} - /> - update("navigation", "Left")} - /> - - - {#if $store.navigation.navigation === "Top"} -
- -
- update("sticky", e.detail)} - /> -
- -
- update("logoUrl", e.detail)} - updateOnChange={false} - /> - {/if} -
- -
- update("hideTitle", !e.detail)} - /> - {#if !$store.navigation.hideTitle} -
- -
- update("title", e.detail)} - updateOnChange={false} - /> - {/if} -
- -
- update("navBackground", e.detail)} - /> -
- -
- update("navTextColor", e.detail)} - /> -
-
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/SettingsPane.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/SettingsPane.svelte deleted file mode 100644 index d3ce720994..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/SettingsPane.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - - -
- - Show nav on this screen -
-
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/index.svelte deleted file mode 100644 index 6ce5405f93..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/index.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte deleted file mode 100644 index 5ffccc5800..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte +++ /dev/null @@ -1,130 +0,0 @@ - - - -
- - {#if links?.length} - - {/if} -
- -
-
-
-
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte deleted file mode 100644 index 895c82495d..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - Configure the links in your navigation bar. - - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte deleted file mode 100644 index c6d43984b2..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - update("navigation", "Top")} - /> - update("navigation", "Left")} - /> - - - {#if $store.navigation.navigation === "Top"} - update("sticky", e.detail)} - /> - update("logoUrl", e.detail)} - placeholder="Add logo URL" - updateOnChange={false} - /> - {/if} - - - update("hideTitle", !e.detail)} - /> - {#if !$store.navigation.hideTitle} - update("title", e.detail)} - placeholder="Add title" - updateOnChange={false} - /> - {/if} - - - - update("navBackground", e.detail)} - /> - - - - update("navTextColor", e.detail)} - /> - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte deleted file mode 100644 index 2331d8b285..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte deleted file mode 100644 index 6362af3073..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - (searchString = e.detail)} - /> - + + + removeLink(link.id)} + /> +
+ {/each} +
+ {/if} +
+ +
+ +
+ + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksEditor.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksEditor.svelte new file mode 100644 index 0000000000..9ab6681273 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksEditor.svelte @@ -0,0 +1,34 @@ + + + + + + Configure the links in your navigation bar. + + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte index 6da744a44a..16baa3bfff 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte @@ -1,4 +1,5 @@ - + Configure the links in your navigation bar. From 0ea81f98d6fd317367b60e76d9ac14f8f602a9bc Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 22 Aug 2023 16:29:40 +0100 Subject: [PATCH 24/50] Update panel headings to match new designs --- packages/builder/src/components/design/Panel.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/design/Panel.svelte b/packages/builder/src/components/design/Panel.svelte index 3968292ba9..db8d9b9096 100644 --- a/packages/builder/src/components/design/Panel.svelte +++ b/packages/builder/src/components/design/Panel.svelte @@ -1,5 +1,5 @@
-
+
Components
@@ -116,15 +116,16 @@ } .header { - padding: 15px 12px; + height: 50px; + box-sizing: border-box; + padding: var(--spacing-l); display: flex; align-items: center; border-bottom: 2px solid transparent; - transition: border-bottom 300ms; + transition: border-bottom 130ms ease-out; } - - .headerScrolling { - border-bottom: 2px solid var(--grey-2); + .header.scrolling { + border-bottom: var(--border-light); } .components :global(.nav-item) { From a07f343f839323f9149ebc01cc5ec6388f86bdb0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 22 Aug 2023 16:45:37 +0100 Subject: [PATCH 27/50] Fix component scroll offsets not working --- .../Components/ComponentScrollWrapper.svelte | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Components/ComponentScrollWrapper.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Components/ComponentScrollWrapper.svelte index 226aff88ab..484b56f21c 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Components/ComponentScrollWrapper.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Components/ComponentScrollWrapper.svelte @@ -16,7 +16,7 @@ let newOffsets = {} // Calculate left offset - const offsetX = bounds.left + bounds.width + scrollLeft - 36 + const offsetX = bounds.left + bounds.width + scrollLeft + 16 if (offsetX > sidebarWidth) { newOffsets.left = offsetX - sidebarWidth } else { @@ -79,19 +79,4 @@ overflow: auto; height: 0; } - - div::-webkit-scrollbar-track { - background: var(--background-alt); - } - - div::-webkit-scrollbar { - width: 18px; - } - - div::-webkit-scrollbar-thumb { - background-color: var(--grey-3); - border-radius: 20px; - border: 1px solid var(--background-alt); - border-width: 5px 5px; - } From a4a639c2ba98e088a8cc4a0e1fba496ac440f155 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 22 Aug 2023 16:49:04 +0100 Subject: [PATCH 28/50] Update screen list size slightly --- .../[componentId]/_components/LeftPanel/Screens/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte index a3762b81ed..c11e933624 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte @@ -135,7 +135,7 @@ } .screens { - height: 212px; + height: 210px; display: flex; flex-direction: column; transition: height 300ms ease-out; From d0414812cf6f90e6be635b2d7feeff972f28015b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 22 Aug 2023 17:51:47 +0100 Subject: [PATCH 29/50] Adjust design section page layouts to stop remounting left nav on screen change --- .../app/[application]/design/[screenId]/_layout.svelte | 2 ++ .../[componentId]/_components/LeftPanel/index.svelte | 9 ++++++--- .../[screenId]/components/[componentId]/_layout.svelte | 10 ---------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte index 9bc1806349..8471cc03ed 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte @@ -4,6 +4,7 @@ import { syncURLToState } from "helpers/urlStateSync" import { store } from "builderStore" import { onDestroy } from "svelte" + import LeftPanel from "./components/[componentId]/_components/LeftPanel/index.svelte" $: screenId = $store.selectedScreenId $: store.actions.websocket.selectResource(screenId) @@ -23,6 +24,7 @@
+
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte index 86c0df8cac..c1fe15f625 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte @@ -1,25 +1,28 @@
- + {#if $selectedScreen} + + {/if}
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte index 807109326a..51c3c64321 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte @@ -1,5 +1,4 @@ -
- -
{#if routeComponentId === "screen"} {:else if routeComponentId === "navigation"} @@ -58,9 +54,3 @@ {/if} - - From a83e987dcdeeb81d968fb93dcb6d38d665782f3b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 22 Aug 2023 18:55:36 +0100 Subject: [PATCH 30/50] Stop preview jumping when scrolling to components, and improve scrolling behaviour --- packages/client/src/components/Component.svelte | 2 +- packages/client/src/components/app/Layout.svelte | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 31f3cc3db6..94e7587010 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -475,7 +475,7 @@ node.style.scrollMargin = "100px" node.scrollIntoView({ behavior: "smooth", - block: "start", + block: "nearest", inline: "start", }) } diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index b7aff4047a..5207892e42 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -73,18 +73,20 @@ ) $: autoCloseSidePanel = !$builderStore.inBuilder && $sidePanelStore.open - // Scroll navigation into view if selected + // Scroll navigation into view if selected. + // Memoize into a primitive to avoid spamming this whenever builder store + // changes. + $: selected = + $builderStore.inBuilder && + $builderStore.selectedComponentId === "navigation" $: { - if ( - $builderStore.inBuilder && - $builderStore.selectedComponentId === "navigation" - ) { + if (selected) { const node = document.getElementsByClassName("nav-wrapper")?.[0] if (node) { node.style.scrollMargin = "100px" node.scrollIntoView({ behavior: "smooth", - block: "start", + block: "nearest", inline: "start", }) } From a54c5b7222edc4b5cc75f6ec901f2eacd99ddcb6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 23 Aug 2023 10:27:56 +0100 Subject: [PATCH 31/50] Add resizable screen/component sections and remove redundant /components route --- .../src/builderStore/store/frontend.js | 2 +- .../Component/ComponentInfoSection.svelte | 0 .../Component/ComponentSettingsPanel.svelte | 0 .../Component/ComponentSettingsSection.svelte | 0 .../Component/ConditionalUIDrawer.svelte | 0 .../Component/ConditionalUISection.svelte | 0 .../Component/CustomStylesSection.svelte | 0 .../Component/DesignSection.svelte | 0 .../_components/Component/StyleSection.svelte | 0 .../_components/Component/componentStyles.js | 0 .../_components/Navigation/LinksDrawer.svelte | 0 .../_components/Navigation/LinksEditor.svelte | 0 .../_components/Navigation/index.svelte | 0 .../_components/Screen/SettingsPanel.svelte | 0 .../[componentId]/_layout.svelte | 0 .../[screenId]/[componentId]/index.svelte | 1 + .../new/_components/NewComponentPanel.svelte | 2 +- .../new/_components/componentStructure.json | 0 .../[componentId]/new/index.svelte | 0 .../[screenId]/_components/AppPanel.svelte | 4 +- .../[screenId]/_components/AppPreview.svelte | 8 +- .../ComponentDropdownMenu.svelte | 0 .../ComponentList}/ComponentKeyHandler.svelte | 0 .../ComponentScrollWrapper.svelte | 0 .../ComponentList}/ComponentTree.svelte | 0 .../DNDPositionIndicator.svelte | 0 .../ScreenslotDropdownMenu.svelte | 0 .../ComponentList}/dndStore.js | 0 .../ComponentList}/index.svelte | 10 +- .../[screenId]/_components/LeftPanel.svelte | 24 ++++ .../ScreenList}/DropdownMenu.svelte | 0 .../ScreenList}/RoleIndicator.svelte | 0 .../ScreenList}/index.svelte | 106 +++++++++++++----- .../design/[screenId]/_layout.svelte | 2 +- .../_components/LeftPanel/index.svelte | 28 ----- .../components/[componentId]/index.svelte | 4 - .../design/[screenId]/components/index.svelte | 8 -- .../design/[screenId]/index.svelte | 5 +- .../app/[application]/design/index.svelte | 2 +- 39 files changed, 117 insertions(+), 89 deletions(-) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/ComponentInfoSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/ComponentSettingsPanel.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/ComponentSettingsSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/ConditionalUIDrawer.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/ConditionalUISection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/CustomStylesSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/DesignSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/StyleSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Component/componentStyles.js (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Navigation/LinksDrawer.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Navigation/LinksEditor.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Navigation/index.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_components/Screen/SettingsPanel.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/_layout.svelte (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/new/_components/NewComponentPanel.svelte (99%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/new/_components/componentStructure.json (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components => }/[componentId]/new/index.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/ComponentDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/ComponentKeyHandler.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/ComponentScrollWrapper.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/ComponentTree.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/DNDPositionIndicator.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/ScreenslotDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/dndStore.js (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Components => _components/ComponentList}/index.svelte (96%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Screens => _components/ScreenList}/DropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Screens => _components/ScreenList}/RoleIndicator.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{components/[componentId]/_components/LeftPanel/Screens => _components/ScreenList}/index.svelte (70%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 164fda4440..46b4bab6c0 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -225,7 +225,7 @@ export const getFrontendStore = () => { // Select new screen store.update(state => { state.selectedScreenId = screen._id - state.selectedComponentId = screen.props?._id + state.selectedComponentId = "screen" return state }) }, diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentInfoSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentInfoSection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentInfoSection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentSettingsPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentSettingsSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ComponentSettingsSection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ConditionalUIDrawer.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ConditionalUIDrawer.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ConditionalUIDrawer.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ConditionalUIDrawer.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ConditionalUISection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ConditionalUISection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/ConditionalUISection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ConditionalUISection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/CustomStylesSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/CustomStylesSection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/CustomStylesSection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/CustomStylesSection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/DesignSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/DesignSection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/StyleSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/StyleSection.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/StyleSection.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/StyleSection.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/componentStyles.js b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/componentStyles.js similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Component/componentStyles.js rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/componentStyles.js diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksDrawer.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksDrawer.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksDrawer.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksDrawer.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksEditor.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksEditor.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/LinksEditor.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksEditor.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Navigation/index.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Screen/SettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/SettingsPanel.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/Screen/SettingsPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/SettingsPanel.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte new file mode 100644 index 0000000000..0ff63d1ead --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte @@ -0,0 +1 @@ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte similarity index 99% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte index 7dca5b792b..4500723027 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte @@ -1,6 +1,6 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte new file mode 100644 index 0000000000..32150ef921 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte @@ -0,0 +1,24 @@ + + +
+ + {#if $isActive("./:componentId")} + + {/if} +
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/DropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/DropdownMenu.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/DropdownMenu.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/DropdownMenu.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/RoleIndicator.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/RoleIndicator.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/RoleIndicator.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/RoleIndicator.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte similarity index 70% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte index c11e933624..9324b2073d 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/Screens/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte @@ -9,29 +9,42 @@ let newScreen = false let search = false + let resizing = false let searchValue = "" let searchInput let screensContainer let scrolling = false + let height = "210px" + let previousHeight = null + let dragOffset $: filteredScreens = getFilteredScreens($sortedScreens, searchValue) + const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) + const openSearch = async () => { search = true await tick() searchInput.focus() screensContainer.scroll({ top: 0, behavior: "smooth" }) + previousHeight = height + height = "calc(100% + 1px)" } - const closeSearch = () => { + const closeSearch = async () => { + if (previousHeight) { + // Restore previous height and wait for animation + height = previousHeight + previousHeight = null + await sleep(300) + } search = false searchValue = "" } const getFilteredScreens = (screens, search) => { return screens.filter(screen => { - const searchMatch = !search || screen.routing.route.includes(search) - return searchMatch + return !search || screen.routing.route.includes(search) }) } @@ -54,17 +67,33 @@ } const handleScroll = e => { - if (e.target.scrollTop === 0) { - scrolling = false - } else { - scrolling = true + scrolling = e.target.scrollTop !== 0 + } + + const startResizing = e => { + resizing = true + dragOffset = parseInt(height) - e.clientY + document.addEventListener("mousemove", resize) + document.addEventListener("mouseup", stopResizing) + } + + const resize = e => { + const newHeight = Math.max(0, e.clientY + dragOffset) + if (newHeight == null || isNaN(newHeight)) { + return } + height = `${newHeight}px` + } + + const stopResizing = () => { + resizing = false + document.removeEventListener("mousemove", resize) } -
-
+
+
{/if}
+ +
@@ -129,20 +160,24 @@ z-index: 2; background-color: var(--background); } - .newScreenVisible { display: initial; } .screens { - height: 210px; display: flex; flex-direction: column; - transition: height 300ms ease-out; + min-height: 147px; + max-height: calc(100% - 147px); + position: relative; } - - .screenSearch { - height: 100%; + .screens.search { + transition: height 300ms ease-out; + max-height: none; + } + .screens.resizing { + user-select: none; + cursor: row-resize; } .header { @@ -154,11 +189,10 @@ display: flex; align-items: center; border-bottom: 2px solid transparent; - transition: border-bottom 300ms ease-out; + transition: border-bottom 130ms ease-out; } - - .headerScrolling { - border-bottom: 2px solid var(--grey-2); + .header.scrolling { + border-bottom: var(--border-light); } .input { @@ -178,8 +212,7 @@ .input::placeholder { color: var(--spectrum-global-color-gray-600); } - - .screenSearch input { + .screens.search input { display: block; } @@ -197,6 +230,9 @@ overflow: auto; flex-grow: 1; } + .screens.resizing .content { + pointer-events: none; + } .screens :global(.nav-item) { padding-right: 8px !important; @@ -208,7 +244,6 @@ margin-right: 10px; opacity: 1; } - .searchButton:hover { color: var(--ink); } @@ -223,15 +258,14 @@ cursor: pointer; transition: transform 300ms ease-out; } + .addButton:hover { + color: var(--ink); + } .closeButton { transform: rotate(45deg); } - .addButton:hover { - color: var(--ink); - } - .icon { margin-left: 4px; margin-right: 4px; @@ -240,4 +274,24 @@ .no-results { color: var(--spectrum-global-color-gray-600); } + + .divider { + position: absolute; + bottom: 0; + transform: translateY(50%); + height: 16px; + width: 100%; + } + .divider:after { + content: ""; + position: absolute; + background: var(--spectrum-global-color-gray-200); + height: 2px; + width: 100%; + top: 50%; + transform: translateY(-50%); + } + .divider:hover { + cursor: row-resize; + } diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte index 8471cc03ed..61514270e6 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte @@ -4,7 +4,7 @@ import { syncURLToState } from "helpers/urlStateSync" import { store } from "builderStore" import { onDestroy } from "svelte" - import LeftPanel from "./components/[componentId]/_components/LeftPanel/index.svelte" + import LeftPanel from "./_components/LeftPanel.svelte" $: screenId = $store.selectedScreenId $: store.actions.websocket.selectResource(screenId) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte deleted file mode 100644 index c1fe15f625..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/LeftPanel/index.svelte +++ /dev/null @@ -1,28 +0,0 @@ - - -
- -
- {#if $selectedScreen} - - {/if} -
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte deleted file mode 100644 index 9b5d05fe57..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte deleted file mode 100644 index 9361415cb7..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte index 496467c546..c3951eab5d 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte @@ -1,8 +1,5 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/index.svelte index 470c81b88c..79d264d120 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/index.svelte @@ -4,7 +4,7 @@ $: { if ($frontendStore.screens.length > 0) { - $redirect(`./${$frontendStore.screens[0]._id}/components/screen`) + $redirect(`./${$frontendStore.screens[0]._id}/screen`) } else { $redirect("./new") } From d486a89ee786b0312de5e5031b8401f1c90632a1 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 23 Aug 2023 10:32:24 +0100 Subject: [PATCH 32/50] Clean all URLs by default in URL state sync --- packages/builder/src/helpers/urlStateSync.js | 4 ++++ .../design/[screenId]/[componentId]/_layout.svelte | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/helpers/urlStateSync.js b/packages/builder/src/helpers/urlStateSync.js index c4c48fb3fb..04c639b3ec 100644 --- a/packages/builder/src/helpers/urlStateSync.js +++ b/packages/builder/src/helpers/urlStateSync.js @@ -65,6 +65,10 @@ export const syncURLToState = options => { params = res.params } } + // Clean URL + if (url?.endsWith("/index")) { + url = url.replace("/index", "") + } log("Navigating to", url, "with params", params) cachedGoto(url, params) } diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte index 51c3c64321..932a3d360a 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte @@ -13,12 +13,8 @@ $: params = routify.params $: routeComponentId = $params.componentId - const cleanUrl = url => { - // Strip trailing slashes - if (url?.endsWith("/index")) { - url = url.replace("/index", "") - } - // Hide new component panel whenever component ID changes + // Hide new component panel whenever component ID changes + const closeNewComponentPanel = url => { if (url?.endsWith("/new")) { url = url.replace("/new", "") } @@ -40,7 +36,7 @@ fallbackUrl: "../", store, routify, - beforeNavigate: cleanUrl, + beforeNavigate: closeNewComponentPanel, }) onDestroy(stopSyncing) From f72f3f88f7a8dff5749d4e2156c900af7114b02e Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 23 Aug 2023 10:49:48 +0100 Subject: [PATCH 33/50] Improve UX when resizing screen/component lists --- packages/builder/src/builderStore/index.js | 4 +- .../_components/ScreenList/index.svelte | 49 +++++++++++++++---- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 3cd387fe95..dfb8609e65 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -4,7 +4,7 @@ import { getTemporalStore } from "./store/temporal" import { getThemeStore } from "./store/theme" import { getUserStore } from "./store/users" import { getDeploymentStore } from "./store/deployments" -import { derived } from "svelte/store" +import { derived, writable } from "svelte/store" import { findComponent, findComponentPath } from "./componentUtils" import { RoleUtils } from "@budibase/frontend-core" import { createHistoryStore } from "builderStore/store/history" @@ -147,3 +147,5 @@ export const userSelectedResourceMap = derived(userStore, $userStore => { export const isOnlyUser = derived(userStore, $userStore => { return $userStore.length < 2 }) + +export const screensHeight = writable("210px") diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte index 9324b2073d..0ecc9b76bf 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte @@ -1,20 +1,25 @@ -
+
-
+
screensHeight.set("210px")} + />
From 607a36e2e4822bb91f30578d61196a8a1c1a14b6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 23 Aug 2023 11:03:00 +0100 Subject: [PATCH 34/50] Improve route handling when creating new components and screens --- .../design/NewScreen/CreateScreenModal.svelte | 3 ++- packages/builder/src/helpers/urlStateSync.js | 9 +++++---- .../[screenId]/_components/LeftPanel.svelte | 4 ++-- .../_components/ScreenList/index.svelte | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte b/packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte index 3ca3e6b419..300906eaf6 100644 --- a/packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte +++ b/packages/builder/src/components/design/NewScreen/CreateScreenModal.svelte @@ -67,7 +67,8 @@ } } - $goto(`./${screenId}`) + // Select and go to new screen + store.actions.screens.select(screenId) } catch (error) { console.log(error) notifications.error("Error creating screens") diff --git a/packages/builder/src/helpers/urlStateSync.js b/packages/builder/src/helpers/urlStateSync.js index 04c639b3ec..2408dde2f1 100644 --- a/packages/builder/src/helpers/urlStateSync.js +++ b/packages/builder/src/helpers/urlStateSync.js @@ -56,6 +56,11 @@ export const syncURLToState = options => { // Navigate to a certain URL const gotoUrl = (url, params) => { + // Clean URL + if (url?.endsWith("/index")) { + url = url.replace("/index", "") + } + // Allow custom URL handling if (beforeNavigate) { const res = beforeNavigate(url, params) if (res?.url) { @@ -65,10 +70,6 @@ export const syncURLToState = options => { params = res.params } } - // Clean URL - if (url?.endsWith("/index")) { - url = url.replace("/index", "") - } log("Navigating to", url, "with params", params) cachedGoto(url, params) } diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte index 32150ef921..977d0ff0a9 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte @@ -1,12 +1,12 @@
- {#if $isActive("./:componentId")} + {#if $selectedScreen} {/if}
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte index 0ecc9b76bf..b4a97fbf09 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte @@ -11,6 +11,7 @@ import DropdownMenu from "./DropdownMenu.svelte" import NewScreen from "components/design/NewScreen/index.svelte" import { onMount, tick } from "svelte" + import { beforeUrlChange } from "@roxi/routify" let newScreen = false let search = false @@ -25,6 +26,14 @@ $: filteredScreens = getFilteredScreens($sortedScreens, searchValue) + // Close new screen when URL changes + $beforeUrlChange(() => { + if (newScreen) { + newScreen = false + } + return true + }) + const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) const openSearch = async () => { @@ -176,7 +185,12 @@
- (newScreen = false)} /> + { + console.log("close") + newScreen = false + }} + />