Close side panel whenever screen changes
This commit is contained in:
parent
ce9feed5f2
commit
64828e3b06
|
@ -1,4 +1,5 @@
|
||||||
import { writable, derived } from "svelte/store"
|
import { writable, derived } from "svelte/store"
|
||||||
|
import { screenStore } from "./screens.js"
|
||||||
|
|
||||||
export const createSidePanelStore = () => {
|
export const createSidePanelStore = () => {
|
||||||
const initialState = {
|
const initialState = {
|
||||||
|
@ -35,3 +36,11 @@ export const createSidePanelStore = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sidePanelStore = createSidePanelStore()
|
export const sidePanelStore = createSidePanelStore()
|
||||||
|
|
||||||
|
// Close side panel every time we change screen
|
||||||
|
const activeScreenId = derived(screenStore, $screenStore => {
|
||||||
|
return $screenStore?.activeScreen?._id
|
||||||
|
})
|
||||||
|
activeScreenId.subscribe(() => {
|
||||||
|
sidePanelStore.actions.close()
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue