Expose the screens and layouts from the screen store in the client library
This commit is contained in:
parent
b6c6dba721
commit
1ef2820b5d
|
@ -11,17 +11,20 @@ const createScreenStore = () => {
|
||||||
const store = derived(
|
const store = derived(
|
||||||
[config, routeStore, builderStore],
|
[config, routeStore, builderStore],
|
||||||
([$config, $routeStore, $builderStore]) => {
|
([$config, $routeStore, $builderStore]) => {
|
||||||
let activeLayout
|
let activeLayout, activeScreen
|
||||||
let activeScreen
|
let layouts, screens
|
||||||
if ($builderStore.inBuilder) {
|
if ($builderStore.inBuilder) {
|
||||||
// Use builder defined definitions if inside the builder preview
|
// Use builder defined definitions if inside the builder preview
|
||||||
activeLayout = $builderStore.layout
|
activeLayout = $builderStore.layout
|
||||||
activeScreen = $builderStore.screen
|
activeScreen = $builderStore.screen
|
||||||
|
layouts = [activeLayout]
|
||||||
|
screens = [activeScreen]
|
||||||
} else {
|
} else {
|
||||||
activeLayout = { props: { _component: "screenslot" } }
|
activeLayout = { props: { _component: "screenslot" } }
|
||||||
|
|
||||||
// Find the correct screen by matching the current route
|
// Find the correct screen by matching the current route
|
||||||
const { screens, layouts } = $config
|
screens = $config.screens
|
||||||
|
layouts = $config.layouts
|
||||||
if ($routeStore.activeRoute) {
|
if ($routeStore.activeRoute) {
|
||||||
activeScreen = screens.find(
|
activeScreen = screens.find(
|
||||||
screen => screen._id === $routeStore.activeRoute.screenId
|
screen => screen._id === $routeStore.activeRoute.screenId
|
||||||
|
@ -33,7 +36,7 @@ const createScreenStore = () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { activeLayout, activeScreen }
|
return { layouts, screens, activeLayout, activeScreen }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue