From fb250230e0586e0d68e0b605f080b4590a66bbaf Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Thu, 11 Apr 2024 15:10:59 +0300 Subject: [PATCH] feat(left-sidebar): add dot icon with memoization --- .../General/LeftSidebar/LeftSidebar.tsx | 89 +++++++++++-------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/src/components/General/LeftSidebar/LeftSidebar.tsx b/src/components/General/LeftSidebar/LeftSidebar.tsx index 4e0ceff3..f376c2b5 100644 --- a/src/components/General/LeftSidebar/LeftSidebar.tsx +++ b/src/components/General/LeftSidebar/LeftSidebar.tsx @@ -7,9 +7,11 @@ import { CommunitiesIcon, ActivityCenterIcon, SettingsIcon, + NotificationsUnreadIcon, } from '@status-im/icons' import { Stack, YStack } from 'tamagui' import { Tooltip } from '@status-im/components' +import { useMemo } from 'react' import LeftSidebarIconButton from './LeftSidebarIconButton' import { @@ -19,46 +21,55 @@ import { VALIDATOR_MANAGEMENT, } from '../../../constants' -export const LEFT_SIDEBAR_ICONS = [ - { - path: DASHBOARD, - tooltip: 'Dashboard', - icon: , - }, - { - path: VALIDATOR_MANAGEMENT, - tooltip: 'Validator Management', - icon: , - }, - { - path: '/advanced-analytics', - tooltip: 'Advanced Analytics', - icon: , - }, - { - path: DEVICE_HEALTH_CHECK, - tooltip: 'Device Health Check', - icon: , - }, - { path: LOGS, tooltip: 'Logs', icon: }, - { - path: '/community', - tooltip: 'Community', - icon: , - }, - { - path: '/notifications', - tooltip: 'Notifications', - icon: , - }, - { - path: '/settings', - tooltip: 'Settings', - icon: , - }, -] - const LeftSidebar = () => { + const isNotification = true + + const LEFT_SIDEBAR_ICONS = useMemo( + () => [ + { + path: DASHBOARD, + tooltip: 'Dashboard', + icon: , + }, + { + path: VALIDATOR_MANAGEMENT, + tooltip: 'Validator Management', + icon: , + }, + { + path: '/advanced-analytics', + tooltip: 'Advanced Analytics', + icon: , + }, + { + path: DEVICE_HEALTH_CHECK, + tooltip: 'Device Health Check', + icon: , + }, + { path: LOGS, tooltip: 'Logs', icon: }, + { + path: '/community', + tooltip: 'Community', + icon: , + }, + { + path: '/notifications', + tooltip: 'Notifications', + icon: isNotification ? ( + + ) : ( + + ), + }, + { + path: '/settings', + tooltip: 'Settings', + icon: , + }, + ], + [isNotification], + ) + return (