From c38b9a8c103b0b9df3719bfb703418d020b6a7b9 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Thu, 11 Apr 2024 10:15:19 +0300 Subject: [PATCH] fix(left-sidebar): simplify by removing redux --- .../General/LeftSidebar/LeftSidebar.tsx | 16 ++--- .../LeftSidebarIconButton.stories.tsx | 6 +- .../LeftSidebar/LeftSidebarIconButton.tsx | 20 +++---- src/redux/LeftSidebar/slice.ts | 59 ------------------- src/redux/store.ts | 2 - 5 files changed, 17 insertions(+), 86 deletions(-) delete mode 100644 src/redux/LeftSidebar/slice.ts diff --git a/src/components/General/LeftSidebar/LeftSidebar.tsx b/src/components/General/LeftSidebar/LeftSidebar.tsx index b3901ee9..5879013f 100644 --- a/src/components/General/LeftSidebar/LeftSidebar.tsx +++ b/src/components/General/LeftSidebar/LeftSidebar.tsx @@ -9,12 +9,10 @@ import { SettingsIcon, } from '@status-im/icons' import { Stack, YStack } from 'tamagui' -import { useSelector } from 'react-redux' import { Tooltip } from '@status-im/components' import LeftSidebarIconButton from './LeftSidebarIconButton' -import { SidebarButton } from '../../../redux/LeftSidebar/slice' -import { RootState } from '../../../redux/store' +import { LEFT_SIDEBAR_ICONS } from '../../../constants' const iconMap = { '/dashboard': , @@ -28,8 +26,6 @@ const iconMap = { } const LeftSidebar = () => { - const buttons = useSelector((state: RootState) => state.leftSidebar.buttons) - return ( { border: '1px solid #F0F2F5', }} > - {buttons.map((button: SidebarButton) => ( - + {LEFT_SIDEBAR_ICONS.map(icon => ( + diff --git a/src/components/General/LeftSidebar/LeftSidebarIconButton.stories.tsx b/src/components/General/LeftSidebar/LeftSidebarIconButton.stories.tsx index 9df5d747..cf32483c 100644 --- a/src/components/General/LeftSidebar/LeftSidebarIconButton.stories.tsx +++ b/src/components/General/LeftSidebar/LeftSidebarIconButton.stories.tsx @@ -20,17 +20,15 @@ type Story = StoryObj export const Default: Story = { args: { iconEl: , - isDotOn: false, isDisabled: false, path: 'dashboard', }, } -export const DotOn: Story = { +export const Disabled: Story = { args: { iconEl: , - isDotOn: true, - isDisabled: false, + isDisabled: true, path: 'dashboard', }, } diff --git a/src/components/General/LeftSidebar/LeftSidebarIconButton.tsx b/src/components/General/LeftSidebar/LeftSidebarIconButton.tsx index 12d32830..cdbdcfe4 100644 --- a/src/components/General/LeftSidebar/LeftSidebarIconButton.tsx +++ b/src/components/General/LeftSidebar/LeftSidebarIconButton.tsx @@ -1,20 +1,20 @@ -import { IconButton } from '@status-im/components' +import { IconAvatarProps, IconButton } from '@status-im/components' import { Stack } from 'tamagui' import { Link } from 'react-router-dom' type IconButtonWithDotProps = { - iconEl: any - isDotOn: boolean - isDisabled?: boolean + iconEl: IconAvatarProps['icon'] path: string } -const LeftSidebarIconButton = ({ - iconEl, - isDotOn, - isDisabled, - path, -}: IconButtonWithDotProps) => { +const LeftSidebarIconButton = ({ iconEl, path }: IconButtonWithDotProps) => { + const isDotOn = path === '/notifications' + const isDisabled = + path === '/advanced-analytics' || + path === '/community' || + path === '/notifications' || + path === '/settings' + return (