feat: remember UI state

This commit is contained in:
zerosoul
2022-03-28 20:42:22 +08:00
parent f039668d4f
commit 28bc1cfbcd
7 changed files with 87 additions and 0 deletions
+9
View File
@@ -3,6 +3,7 @@ import { createSlice } from "@reduxjs/toolkit";
const initialState = {
online: true,
ready: false,
inputMode: "text",
menuExpand: false,
setting: false,
channelSetting: null,
@@ -11,6 +12,9 @@ const uiSlice = createSlice({
name: "ui",
initialState,
reducers: {
fullfillUI(state, action) {
return { ...initialState, ...action.payload };
},
setReady(state) {
state.ready = true;
},
@@ -20,6 +24,9 @@ const uiSlice = createSlice({
toggleMenuExpand(state) {
state.menuExpand = !state.menuExpand;
},
updateInputMode(state, action) {
state.inputMode = action.payload;
},
toggleSetting(state) {
state.setting = !state.setting;
},
@@ -31,8 +38,10 @@ const uiSlice = createSlice({
},
});
export const {
fullfillUI,
setReady,
updateOnline,
updateInputMode,
toggleSetting,
toggleMenuExpand,
toggleChannelSetting,