feat: remember UI state
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user