From 53dc3780fa1fb54dcddb44cc29db4f5562778eae Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Wed, 3 Jun 2020 16:19:04 +0100 Subject: [PATCH] Screen and page latest --- .../builder/src/builderStore/store/index.js | 10 ++++ .../ComponentPropertiesPanel.svelte | 52 +++++++++++++++---- .../userInterface/FrontendNavigatePane.svelte | 1 + .../userInterface/SettingsView.svelte | 4 +- .../userInterface/propertyCategories.js | 16 ++++-- .../userInterface/temporaryPanelStructure.js | 5 +- 6 files changed, 72 insertions(+), 16 deletions(-) diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index 9f91550bca..3572e4e344 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -69,6 +69,7 @@ export const getStore = () => { store.getPathToComponent = getPathToComponent(store) store.addTemplatedComponent = addTemplatedComponent(store) store.setMetadataProp = setMetadataProp(store) + store.editPageOrScreen = editPageOrScreen(store) return store } @@ -171,6 +172,15 @@ const createScreen = store => (screenName, route, layoutComponentName) => { }) } +const editPageOrScreen = store => (key, value) => { + store.update(state => { + state.currentPreviewItem[key] = value + _saveCurrentPreviewItem(state) + + return state + }) +} + const setCurrentScreen = store => screenName => { store.update(s => { const screen = getExactComponent(s.screens, screenName) diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index 60279aa9a1..62a3c91c3e 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -1,5 +1,6 @@ diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index 36b2ab9c75..76619867e3 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -9,7 +9,9 @@ export let componentInstance = {} export let onChange = () => {} - const propExistsOnComponentDef = prop => prop in componentDefinition.props + let pageScreenProps = ["name", "favicon", "description", "route"] + + const propExistsOnComponentDef = prop => pageScreenProps.includes(prop) || prop in componentDefinition.props function handleChange(key, data) { data.target ? onChange(key, data.target.value) : onChange(key, data) diff --git a/packages/builder/src/components/userInterface/propertyCategories.js b/packages/builder/src/components/userInterface/propertyCategories.js index 59458edd49..18572ea6ba 100644 --- a/packages/builder/src/components/userInterface/propertyCategories.js +++ b/packages/builder/src/components/userInterface/propertyCategories.js @@ -2,10 +2,18 @@ import Input from "../common/Input.svelte" import OptionSelect from "./OptionSelect.svelte" import InputGroup from "../common/Inputs/InputGroup.svelte" import FlatButtonGroup from "./FlatButtonGroup.svelte" -// import Colorpicker from "../common/Colorpicker.svelte" -/* - TODO: Allow for default values for all properties -*/ + + +export const screen = [ + { label: "Name", key: "name", control: Input }, + { label: "Description", key: "description", control: Input }, + { label: "Route", key: "route", control: Input }, +] + +export const page = [ + { label: "Name", key: "name", control: Input }, + { label: "Favicon", key: "favicon", control: Input }, +] export const layout = [ { diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index be9d874dea..9c0dfc1bd8 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -334,7 +334,10 @@ export default { "A component for handling the navigation within your app.", icon: "ri-navigation-fill", children: [], - properties: { design: { ...all } }, + properties: { + design: { ...all }, + settings: [{ label: "Logo URL", key: "logoUrl", control: Input }, ], + }, }, ], },