saving progress based on review reccomendations

This commit is contained in:
mikesealey 2024-04-17 16:27:23 +01:00
parent 359355b58d
commit ad10679115
4 changed files with 12 additions and 14 deletions

View File

@ -6724,18 +6724,17 @@
"showEmptyState": false,
"draggable": false,
"info": "Side panels are hidden by default. They will only be revealed when triggered by the 'Open Side Panel' action.",
"sendEvents": true,
"settings": [
{
"type": "boolean",
"key": "clickOutsideToClose",
"label": "Click outside to close",
"defaultValue": true
"key": "ignoreClicksOutside",
"label": "Ignore clicks outside",
"defaultValue": false
},
{
"type": "event",
"key": "onSidePanelClose",
"label": "On side panel close"
"key": "onClose",
"label": "On close"
}
]
},

View File

@ -76,7 +76,7 @@
$: autoCloseSidePanel =
!$builderStore.inBuilder &&
$sidePanelStore.open &&
$sidePanelStore.clickOutsideToClose
$sidePanelStore.ignoreClicksOutside
$: screenId = $builderStore.inBuilder
? `${$builderStore.screen?._id}-screen`
: "screen"

View File

@ -6,7 +6,7 @@
getContext("sdk")
export let sidePanelClose
export let clickOutsideToClose
export let ignoreClicksOutside
// Automatically show and hide the side panel when inside the builder.
// For some unknown reason, svelte reactivity breaks if we reference the
@ -30,7 +30,7 @@
}
$: {
sidePanelStore.actions.setSidepanelState(clickOutsideToClose)
sidePanelStore.actions.setIgnoreClicksOutside(ignoreClicksOutside)
}
// Derive visibility

View File

@ -3,7 +3,7 @@ import { writable, derived } from "svelte/store"
export const createSidePanelStore = () => {
const initialState = {
contentId: null,
clickOutsideToClose: true,
ignoreClicksOutside: true,
}
const store = writable(initialState)
const derivedStore = derived(store, $store => {
@ -33,10 +33,9 @@ export const createSidePanelStore = () => {
}, 50)
}
const setSidepanelState = bool => {
clearTimeout(timeout)
const setIgnoreClicksOutside = bool => {
store.update(state => {
state.clickOutsideToClose = bool
state.ignoreClicksOutside = bool
return state
})
}
@ -45,7 +44,7 @@ export const createSidePanelStore = () => {
actions: {
open,
close,
setSidepanelState,
setIgnoreClicksOutside,
},
}
}