mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: remember scratchpad panel visibility
This commit is contained in:
1 parent
9f9ab1320b
commit
ed8ae6ba69
6 files changed
+41
-21
No files matched your search
@@ -6,11 +6,11 @@ export default function reducer(state = {
|
||||
size: '50%',
|
||||
},
|
||||
pretest: {
|
||||
visible: false,
|
||||
visible: localStorage.getItem('scratchpad/pretest') === 'true',
|
||||
size: 200,
|
||||
},
|
||||
records: {
|
||||
visible: UiContext.canViewRecord,
|
||||
visible: UiContext.canViewRecord && localStorage.getItem('scratchpad/records') === 'true',
|
||||
size: 200,
|
||||
isLoading: false,
|
||||
},
|
||||
@@ -29,6 +29,7 @@ export default function reducer(state = {
|
||||
}
|
||||
case 'SCRATCHPAD_UI_SET_VISIBILITY': {
|
||||
const { uiElement, visibility } = action.payload;
|
||||
localStorage.setItem(`scratchpad/${uiElement}`, visibility.toString());
|
||||
return {
|
||||
...state,
|
||||
[uiElement]: {
|
||||
@@ -39,6 +40,7 @@ export default function reducer(state = {
|
||||
}
|
||||
case 'SCRATCHPAD_UI_TOGGLE_VISIBILITY': {
|
||||
const { uiElement } = action.payload;
|
||||
localStorage.setItem(`scratchpad/${uiElement}`, (!state[uiElement].visible).toString());
|
||||
return {
|
||||
...state,
|
||||
[uiElement]: {
|
||||
|
||||
Reference in new issue
Block a user