From cf3455f126679d4208de574a6ba055d7b0c3c2c3 Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Tue, 18 Jul 2023 03:52:34 -0700 Subject: [PATCH] move app status message to navbar Summary: Don't mind busy navbar, flipper debugger buttons will be moved into a menu down the stack Reviewed By: elboman Differential Revision: D47469851 fbshipit-source-id: b29367810287d77106a56a5b1ae4aec49188e8fc --- .../src/sandy-chrome/Navbar.tsx | 8 +++--- .../sandy-chrome/appinspect/AppInspect.tsx | 27 +++++++++++++------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx b/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx index 0b5067b8b..42c222cb4 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/Navbar.tsx @@ -80,6 +80,7 @@ import { NavbarScreenRecordButton, NavbarScreenshotButton, } from '../chrome/ScreenCaptureButtons'; +import {StatusMessage} from './appinspect/AppInspect'; export const Navbar = withTrackingScope(function Navbar({ toplevelSelection, @@ -106,7 +107,8 @@ export const Navbar = withTrackingScope(function Navbar({ setToplevelSelection('appinspect'); }} /> - + + @@ -495,10 +497,6 @@ export function NavbarButton({ } } -function DevicePicker() { - return ; -} - function LoginConnectivityButton() { const loggedIn = useValue(currentUser()); const user = useStore((state) => state.user); diff --git a/desktop/flipper-ui-core/src/sandy-chrome/appinspect/AppInspect.tsx b/desktop/flipper-ui-core/src/sandy-chrome/appinspect/AppInspect.tsx index fbb43bc83..686cdc06d 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/appinspect/AppInspect.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/appinspect/AppInspect.tsx @@ -44,7 +44,6 @@ export function AppInspect() { const activeDevice = useSelector(getActiveDevice); const isDeviceConnected = useValue(activeDevice?.connected, false); const isAppConnected = useValue(client?.connected, false); - const hasSelectableDevices = useSelector(connections.hasSelectableDevices); return ( @@ -54,13 +53,6 @@ export function AppInspect() { App Inspect - {renderStatusMessage( - isDeviceConnected, - activeDevice, - client, - isAppConnected, - hasSelectableDevices, - )} {isDeviceConnected && isAppConnected && } {isDeviceConnected && activeDevice && ( @@ -91,6 +83,25 @@ const Toolbar = styled(Layout.Horizontal)({ }, }); +export function StatusMessage() { + const client = useSelector(getActiveClient); + const activeDevice = useSelector(getActiveDevice); + const isDeviceConnected = useValue(activeDevice?.connected, false); + const isAppConnected = useValue(client?.connected, false); + const hasSelectableDevices = useSelector(connections.hasSelectableDevices); + return ( + <> + {renderStatusMessage( + isDeviceConnected, + activeDevice, + client, + isAppConnected, + hasSelectableDevices, + )} + + ); +} + function renderStatusMessage( isDeviceConnected: boolean, activeDevice: BaseDevice | null,