Refactorings for page and settings props

This commit is contained in:
Conor_Mack 2020-06-09 10:59:15 +01:00
parent b136eaea17
commit dd0eec0592
3 changed files with 6 additions and 14 deletions

View File

@ -295,6 +295,7 @@ const setCurrentPage = store => pageName => {
state.currentFrontEndType = "page" state.currentFrontEndType = "page"
state.currentPageName = pageName state.currentPageName = pageName
state.currentView = "detail"
state.screens = Array.isArray(current_screens) state.screens = Array.isArray(current_screens)
? current_screens ? current_screens
: Object.values(current_screens) : Object.values(current_screens)
@ -455,6 +456,7 @@ const setScreenType = store => type => {
state.currentComponentInfo = pageOrScreen ? pageOrScreen.props : null state.currentComponentInfo = pageOrScreen ? pageOrScreen.props : null
state.currentPreviewItem = pageOrScreen state.currentPreviewItem = pageOrScreen
state.currentView = "detail"
return state return state
}) })
} }

View File

@ -58,25 +58,16 @@
} }
} }
let componentInstance = {} $: componentInstance = $store.currentView !== "component" ? {...$store.currentPreviewItem, ...$store.currentComponentInfo} : $store.currentComponentInfo
$: {
if(($store.currentFrontEndType === "screen" || $store.currentFrontEndType === "page") && $store.currentView !== "component") {
componentInstance = {...$store.currentPreviewItem, ...$store.currentComponentInfo}
}else {
componentInstance = $store.currentComponentInfo
}
}
const onStyleChanged = store.setComponentStyle const onStyleChanged = store.setComponentStyle
function onPropChanged(key, value) { function onPropChanged(key, value) {
if($store.currentFrontEndType === "page") { if($store.currentView !== "component") {
store.editPageOrScreen(key, value) store.editPageOrScreen(key, value)
}else if($store.currentFrontEndType === "screen" && $store.currentView !== "component") { return
store.editPageOrScreen(key, value)
}else {
store.setComponentProp(key, value)
} }
store.setComponentProp(key, value)
} }
function walkProps(component, action) { function walkProps(component, action) {

View File

@ -9,7 +9,6 @@
newScreenPicker.show() newScreenPicker.show()
} }
$: console.log("STORE SCREENS", $store.screens)
let newScreenPicker let newScreenPicker
</script> </script>