diff --git a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx index 93cf28dd4..5a5c30cfd 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx @@ -12,7 +12,6 @@ import {Button, Divider, Badge, Tooltip, Menu, Modal} from 'antd'; import { MobileFilled, BellOutlined, - FileExclamationOutlined, SettingOutlined, BugOutlined, ApiOutlined, @@ -29,9 +28,7 @@ import { } from 'flipper-plugin'; import SettingsSheet from '../chrome/SettingsSheet'; import WelcomeScreen from './WelcomeScreen'; -import {errorCounterAtom} from '../chrome/ConsoleLogs'; import {ToplevelProps} from './SandyApp'; -import {useValue} from 'flipper-plugin'; import config from '../fb-stubs/config'; import styled from '@emotion/styled'; import {setStaticView} from '../reducers/connections'; @@ -164,10 +161,6 @@ export const LeftRail = withTrackingScope(function LeftRail({ /> )} - @@ -347,24 +340,6 @@ function NotificationButton({ ); } -function DebugLogsButton({ - toplevelSelection, - setToplevelSelection, -}: ToplevelProps) { - const errorCount = useValue(errorCounterAtom); - return ( - } - title="Flipper Logs" - selected={toplevelSelection === 'flipperlogs'} - count={errorCount} - onClick={() => { - setToplevelSelection('flipperlogs'); - }} - /> - ); -} - 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 9099dd2e3..84fcb5bcd 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx @@ -7,7 +7,14 @@ * @format */ -import {Dialog, Layout, styled, theme, useValue} from 'flipper-plugin'; +import { + Dialog, + Layout, + styled, + theme, + useValue, + withTrackingScope, +} from 'flipper-plugin'; import React, {cloneElement, useCallback, useMemo, useState} from 'react'; import {useDispatch, useStore} from '../utils/useStore'; import config from '../fb-stubs/config'; @@ -29,14 +36,20 @@ import { WarningOutlined, } from '@ant-design/icons'; import {toggleLeftSidebarVisible} from '../reducers/application'; +import {ToplevelProps} from './SandyApp'; import PluginManager from '../chrome/plugin-manager/PluginManager'; import {showEmulatorLauncher} from './appinspect/LaunchEmulator'; import SetupDoctorScreen, {checkHasNewProblem} from './SetupDoctorScreen'; import {isProduction} from 'flipper-common'; import FpsGraph from '../chrome/FpsGraph'; import NetworkGraph from '../chrome/NetworkGraph'; +import {errorCounterAtom} from '../chrome/ConsoleLogs'; +import {css} from '@emotion/css'; -export function Navbar() { +export const Navbar = withTrackingScope(function Navbar({ + toplevelSelection, + setToplevelSelection, +}: ToplevelProps) { return ( ); }} /> - + @@ -78,7 +94,7 @@ export function Navbar() { ); -} +}); function LeftSidebarToggleButton() { const dispatch = useDispatch(); @@ -112,6 +128,24 @@ function LaunchEmulatorButton() { ); } +function DebugLogsButton({ + toplevelSelection, + setToplevelSelection, +}: ToplevelProps) { + const errorCount = useValue(errorCounterAtom); + return ( + { + setToplevelSelection('flipperlogs'); + }} + /> + ); +} + function SetupDoctorButton() { const [visible, setVisible] = useState(false); const result = useStore( @@ -132,11 +166,24 @@ function SetupDoctorButton() { ); } +const badgeDotClassname = css` + sup { + right: calc(50% - 14px); + margin-top: 8px; + } +`; +const badgeCountClassname = css` + sup { + right: calc(50% - 22px); + margin-top: 8px; + } +`; function NavbarButton({ icon: Icon, label, toggled = false, onClick, + count, }: { icon: typeof LoginOutlined; label: string; @@ -144,11 +191,10 @@ function NavbarButton({ // TODO remove optional onClick?: () => void; toggled?: boolean; - /** TODO red bubble in top right corner, notification like */ count?: number | true; }) { const color = toggled ? theme.primaryColor : theme.textColorActive; - return ( + const button = ( ); + + if (count !== undefined) { + return ( + + {button} + + ); + } else { + return button; + } } function LoginConnectivityButton() { diff --git a/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx b/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx index 971138c39..15d32dd9d 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx @@ -169,7 +169,10 @@ export function SandyApp() { - +