Create redux for leftSidebar

This commit is contained in:
Hristo Nedelkov 2023-09-26 12:59:15 +03:00
parent 5f7a2d6885
commit 0de4832993
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,35 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface SidebarButton {
id: string;
isDotOn: boolean;
isSelected: boolean;
isDisabled?: boolean;
}
interface LeftSidebarState {
buttons: SidebarButton[];
}
const initialState: LeftSidebarState = {
buttons: [
{ id: 'dashboard', isDotOn: false, isSelected: true },
{ id: 'speed', isDotOn: false, isSelected: false },
{ id: 'chart', isDotOn: false, isSelected: false, isDisabled: true },
{ id: 'heart', isDotOn: false, isSelected: false },
{ id: 'codeBlock', isDotOn: false, isSelected: false },
{ id: 'communities', isDotOn: false, isSelected: false },
{ id: 'activityCenter', isDotOn: true, isSelected: false },
{ id: 'settings', isDotOn: false, isSelected: false },
],
};
const leftSidebarSlice = createSlice({
name: 'leftSidebar',
initialState,
reducers: {
},
});
export const { toggleButtonSelection, toggleDot } = leftSidebarSlice.actions;

View File

@ -4,6 +4,7 @@ import pinnedMessageReducer from './PinnedMessage/slice'
import execClientReducer from './ValidatorOnboarding/ValidatorSetup/slice'
import themeReducer from './theme/slice'
import keyGenerationReducer from './ValidatorOnboarding/KeyGeneration/slice'
import leftSidebarReducer from './Sidebars/slice'
const store = configureStore({
reducer: {
@ -12,6 +13,7 @@ const store = configureStore({
execClient: execClientReducer,
theme: themeReducer,
keyGeneration: keyGenerationReducer,
leftSidebar: leftSidebarReducer,
},
})