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,
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');
}}
/>
<DevicePicker />
<AppSelector />
<StatusMessage />
<NavbarScreenshotButton />
<NavbarScreenRecordButton />
<LaunchEmulatorButton />
@@ -495,10 +497,6 @@ export function NavbarButton({
}
}
function DevicePicker() {
return <AppSelector />;
}
function LoginConnectivityButton() {
const loggedIn = useValue(currentUser());
const user = useStore((state) => state.user);

View File

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