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
This commit is contained in:
Anton Kastritskiy
2023-07-18 03:52:34 -07:00
committed by Facebook GitHub Bot
parent e755931642
commit cf3455f126
2 changed files with 22 additions and 13 deletions

View File

@@ -80,6 +80,7 @@ import {
NavbarScreenRecordButton, NavbarScreenRecordButton,
NavbarScreenshotButton, NavbarScreenshotButton,
} from '../chrome/ScreenCaptureButtons'; } from '../chrome/ScreenCaptureButtons';
import {StatusMessage} from './appinspect/AppInspect';
export const Navbar = withTrackingScope(function Navbar({ export const Navbar = withTrackingScope(function Navbar({
toplevelSelection, toplevelSelection,
@@ -106,7 +107,8 @@ export const Navbar = withTrackingScope(function Navbar({
setToplevelSelection('appinspect'); setToplevelSelection('appinspect');
}} }}
/> />
<DevicePicker /> <AppSelector />
<StatusMessage />
<NavbarScreenshotButton /> <NavbarScreenshotButton />
<NavbarScreenRecordButton /> <NavbarScreenRecordButton />
<LaunchEmulatorButton /> <LaunchEmulatorButton />
@@ -495,10 +497,6 @@ export function NavbarButton({
} }
} }
function DevicePicker() {
return <AppSelector />;
}
function LoginConnectivityButton() { function LoginConnectivityButton() {
const loggedIn = useValue(currentUser()); const loggedIn = useValue(currentUser());
const user = useStore((state) => state.user); const user = useStore((state) => state.user);

View File

@@ -44,7 +44,6 @@ export function AppInspect() {
const activeDevice = useSelector(getActiveDevice); const activeDevice = useSelector(getActiveDevice);
const isDeviceConnected = useValue(activeDevice?.connected, false); const isDeviceConnected = useValue(activeDevice?.connected, false);
const isAppConnected = useValue(client?.connected, false); const isAppConnected = useValue(client?.connected, false);
const hasSelectableDevices = useSelector(connections.hasSelectableDevices);
return ( return (
<LeftSidebar> <LeftSidebar>
@@ -54,13 +53,6 @@ export function AppInspect() {
App Inspect App Inspect
</SidebarTitle> </SidebarTitle>
<Layout.Container padv="small" padh="medium" gap={theme.space.large}> <Layout.Container padv="small" padh="medium" gap={theme.space.large}>
{renderStatusMessage(
isDeviceConnected,
activeDevice,
client,
isAppConnected,
hasSelectableDevices,
)}
{isDeviceConnected && isAppConnected && <BookmarkSection />} {isDeviceConnected && isAppConnected && <BookmarkSection />}
{isDeviceConnected && activeDevice && ( {isDeviceConnected && activeDevice && (
<Toolbar gap> <Toolbar gap>
@@ -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( function renderStatusMessage(
isDeviceConnected: boolean, isDeviceConnected: boolean,
activeDevice: BaseDevice | null, activeDevice: BaseDevice | null,