From 877791970a18c893126f994fd91c159d0fe259ad Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 25 Apr 2022 19:59:30 +0100 Subject: [PATCH] Add screen settings panel --- packages/builder/src/builderStore/index.js | 9 +- .../src/components/common/NavItem.svelte | 2 +- .../NavigationPanel/NavigationPanel.svelte | 6 +- .../ScreenSettingsSection.svelte | 17 +- .../design/SettingsPanel/SettingsPanel.svelte | 2 +- .../_old/[assetType]/[asset]/_fallback.svelte | 0 .../design}/_old/[assetType]/_layout.svelte | 0 .../design}/_old/[assetType]/index.svelte | 0 .../design/screens/[screenId].svelte | 82 +--------- .../_components/ScreenNavigationPanel.svelte | 72 +++++++++ .../_components/ScreenSettingsPanel.svelte | 146 ++++++++++++++++++ 11 files changed, 230 insertions(+), 106 deletions(-) rename packages/builder/src/{pages/builder/app/[application]/design/screens => components/design}/_old/[assetType]/[asset]/_fallback.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/design/screens => components/design}/_old/[assetType]/_layout.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/design/screens => components/design}/_old/[assetType]/index.svelte (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/screens/_components/ScreenNavigationPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/screens/_components/ScreenSettingsPanel.svelte diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 3fb8eb7ab6..9d7c3ca128 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -13,14 +13,7 @@ export const selectedScreen = derived(store, $store => { return $store.screens.find(screen => screen._id === $store.selectedScreenId) }) -export const currentAsset = derived(store, $store => { - const type = $store.currentFrontEndType - if (type === FrontendTypes.SCREEN) { - } else if (type === FrontendTypes.LAYOUT) { - return $store.layouts.find(layout => layout._id === $store.selectedLayoutId) - } - return null -}) +export const currentAsset = selectedScreen export const selectedComponent = derived( [store, currentAsset], diff --git a/packages/builder/src/components/common/NavItem.svelte b/packages/builder/src/components/common/NavItem.svelte index a7649ca5dc..2601640ca7 100644 --- a/packages/builder/src/components/common/NavItem.svelte +++ b/packages/builder/src/components/common/NavItem.svelte @@ -46,7 +46,7 @@ class:border class:selected class:withActions - style={`padding-left: ${14 + indentLevel * 14}px`} + style={`padding-left: calc(var(--spacing-l) + ${indentLevel * 14}px)`} {draggable} on:dragend on:dragstart diff --git a/packages/builder/src/components/design/NavigationPanel/NavigationPanel.svelte b/packages/builder/src/components/design/NavigationPanel/NavigationPanel.svelte index 09dab3003c..04c0d93618 100644 --- a/packages/builder/src/components/design/NavigationPanel/NavigationPanel.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NavigationPanel.svelte @@ -31,7 +31,7 @@ align-items: stretch; } .header { - height: 55px; + height: 48px; display: flex; flex-direction: row; justify-content: space-between; @@ -51,8 +51,8 @@ white-space: nowrap; } .add-button { - flex: 0 0 32px; - height: 32px; + flex: 0 0 30px; + height: 30px; display: grid; place-items: center; border-radius: 4px; diff --git a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte index 3abeabc8d3..c8371e66ab 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte @@ -108,19 +108,4 @@ ] -{#if $store.currentView !== "component" && $currentAsset && $store.currentFrontEndType === FrontendTypes.SCREEN} - - {#each screenSettings as def (`${componentInstance._id}-${def.key}`)} - setAssetProps(def.key, val, def.parser, def.validate)} - {bindings} - props={{ error: errors[def.key] }} - /> - {/each} - -{/if} +{#if $store.currentView !== "component" && $currentAsset && $store.currentFrontEndType === FrontendTypes.SCREEN}{/if} diff --git a/packages/builder/src/components/design/SettingsPanel/SettingsPanel.svelte b/packages/builder/src/components/design/SettingsPanel/SettingsPanel.svelte index 3006130f8b..d5c217c4e7 100644 --- a/packages/builder/src/components/design/SettingsPanel/SettingsPanel.svelte +++ b/packages/builder/src/components/design/SettingsPanel/SettingsPanel.svelte @@ -30,7 +30,7 @@ align-items: stretch; } .header { - height: 55px; + height: 50px; display: flex; flex-direction: row; justify-content: flex-start; diff --git a/packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/[asset]/_fallback.svelte b/packages/builder/src/components/design/_old/[assetType]/[asset]/_fallback.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/[asset]/_fallback.svelte rename to packages/builder/src/components/design/_old/[assetType]/[asset]/_fallback.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/_layout.svelte b/packages/builder/src/components/design/_old/[assetType]/_layout.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/_layout.svelte rename to packages/builder/src/components/design/_old/[assetType]/_layout.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/index.svelte b/packages/builder/src/components/design/_old/[assetType]/index.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/screens/_old/[assetType]/index.svelte rename to packages/builder/src/components/design/_old/[assetType]/index.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/screens/[screenId].svelte b/packages/builder/src/pages/builder/app/[application]/design/screens/[screenId].svelte index a56978404b..f88314521f 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/screens/[screenId].svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/screens/[screenId].svelte @@ -1,45 +1,11 @@ - - - (searchString = e.detail)} - /> - role.name} + getOptionValue={role => role._id} + options={[{ name: "All screens", _id: "all" }, ...$roles]} + /> + + {#each filteredScreens as screen (screen._id)} + ($store.selectedScreenId = screen._id)} + color={getRoleColor(screen.routing.roleId)} + > + + + {/each} + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/screens/_components/ScreenSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/screens/_components/ScreenSettingsPanel.svelte new file mode 100644 index 0000000000..573d629183 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/screens/_components/ScreenSettingsPanel.svelte @@ -0,0 +1,146 @@ + + + + + {#each screenSettings as def (def.key)} + setAssetProps(def.key, val, def.parser, def.validate)} + props={{ ...def.props, error: errors[def.key] }} + /> + {/each} + + +