ui: remember scratchpad panel visibility

This commit is contained in:
undefined committed 2021-09-10 23:01:04 +08:00
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]: {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.20.0",
"version": "4.20.1",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",