From 0de4832993d48d437554ef2afcd967bb4133c686 Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Tue, 26 Sep 2023 12:59:15 +0300 Subject: [PATCH] Create redux for leftSidebar --- src/redux/Sidebars/slice.ts | 35 +++++++++++++++++++++++++++++++++++ src/redux/store.ts | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 src/redux/Sidebars/slice.ts diff --git a/src/redux/Sidebars/slice.ts b/src/redux/Sidebars/slice.ts new file mode 100644 index 00000000..d660bd17 --- /dev/null +++ b/src/redux/Sidebars/slice.ts @@ -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; + diff --git a/src/redux/store.ts b/src/redux/store.ts index 592f40af..cc78c421 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -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, }, })