From e431caf0f96707549e161d07cb2cf76dec10836b Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Tue, 18 Jul 2023 03:52:34 -0700 Subject: [PATCH] notification button Reviewed By: elboman Differential Revision: D47437749 fbshipit-source-id: 6dd7ded014e79b23328f59994e053d4d48c4eb65 --- .../src/sandy-chrome/LeftRail.tsx | 28 ------------------ .../src/sandy-chrome/Navbar.tsx | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx index 52603da52..1bde7978d 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx @@ -11,7 +11,6 @@ import React, {cloneElement, useState, useCallback} from 'react'; import {Button, Divider, Badge, Tooltip, Menu, Modal} from 'antd'; import { MobileFilled, - BellOutlined, SettingOutlined, BugOutlined, ApiOutlined, @@ -31,8 +30,6 @@ import config from '../fb-stubs/config'; import styled from '@emotion/styled'; import {setStaticView} from '../reducers/connections'; import {SandyRatingButton} from '../chrome/RatingButton'; -import {filterNotifications} from './notification/notificationUtils'; -import {useMemoize} from 'flipper-plugin'; import UpdateIndicator from '../chrome/UpdateIndicator'; import constants from '../fb-stubs/constants'; import { @@ -148,10 +145,6 @@ export const LeftRail = withTrackingScope(function LeftRail({ setToplevelSelection('appinspect'); }} /> - {getRenderHostInstance().GK('flipper_connection_troubleshoot') && ( state.notifications); - const activeNotifications = useMemoize(filterNotifications, [ - notifications.activeNotifications, - notifications.blocklistedPlugins, - notifications.blocklistedCategories, - ]); - return ( - } - title="Notifications" - selected={toplevelSelection === 'notification'} - count={activeNotifications.length} - onClick={() => setToplevelSelection('notification')} - /> - ); -} - function ConnectionTroubleshootButton({ toplevelSelection, setToplevelSelection, diff --git a/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx b/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx index 34a5bbe11..f9a4c61e5 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx @@ -12,6 +12,7 @@ import { Layout, styled, theme, + useMemoize, useValue, withTrackingScope, } from 'flipper-plugin'; @@ -47,6 +48,7 @@ import {isProduction} from 'flipper-common'; import FpsGraph from '../chrome/FpsGraph'; import NetworkGraph from '../chrome/NetworkGraph'; import {errorCounterAtom} from '../chrome/ConsoleLogs'; +import {filterNotifications} from './notification/notificationUtils'; import {css} from '@emotion/css'; export const Navbar = withTrackingScope(function Navbar({ @@ -89,7 +91,10 @@ export const Navbar = withTrackingScope(function Navbar({ toplevelSelection={toplevelSelection} setToplevelSelection={setToplevelSelection} /> - + @@ -100,6 +105,27 @@ export const Navbar = withTrackingScope(function Navbar({ ); }); +function NotificationButton({ + toplevelSelection, + setToplevelSelection, +}: ToplevelProps) { + const notifications = useStore((state) => state.notifications); + const activeNotifications = useMemoize(filterNotifications, [ + notifications.activeNotifications, + notifications.blocklistedPlugins, + notifications.blocklistedCategories, + ]); + return ( + setToplevelSelection('notification')} + /> + ); +} + function LeftSidebarToggleButton() { const dispatch = useDispatch(); const mainMenuVisible = useStore( @@ -216,7 +242,6 @@ function NavbarButton({ }: { icon: (props: any) => any; label: string; - selected?: boolean; // TODO remove optional onClick?: () => void; toggled?: boolean;