doctor button
Reviewed By: lblasa Differential Revision: D47435889 fbshipit-source-id: ff3eef79f50f3b63ada46c6d8349860906e28715
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5647b9a4b8
commit
a5c109f762
@@ -7,14 +7,13 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {cloneElement, useState, useCallback, useMemo} from 'react';
|
import React, {cloneElement, useState, useCallback} from 'react';
|
||||||
import {Button, Divider, Badge, Tooltip, Menu, Modal} from 'antd';
|
import {Button, Divider, Badge, Tooltip, Menu, Modal} from 'antd';
|
||||||
import {
|
import {
|
||||||
MobileFilled,
|
MobileFilled,
|
||||||
BellOutlined,
|
BellOutlined,
|
||||||
FileExclamationOutlined,
|
FileExclamationOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
MedicineBoxOutlined,
|
|
||||||
BugOutlined,
|
BugOutlined,
|
||||||
ApiOutlined,
|
ApiOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
@@ -28,7 +27,6 @@ import {
|
|||||||
useTrackedCallback,
|
useTrackedCallback,
|
||||||
NUX,
|
NUX,
|
||||||
} from 'flipper-plugin';
|
} from 'flipper-plugin';
|
||||||
import SetupDoctorScreen, {checkHasNewProblem} from './SetupDoctorScreen';
|
|
||||||
import SettingsSheet from '../chrome/SettingsSheet';
|
import SettingsSheet from '../chrome/SettingsSheet';
|
||||||
import WelcomeScreen from './WelcomeScreen';
|
import WelcomeScreen from './WelcomeScreen';
|
||||||
import {errorCounterAtom} from '../chrome/ConsoleLogs';
|
import {errorCounterAtom} from '../chrome/ConsoleLogs';
|
||||||
@@ -183,7 +181,6 @@ export const LeftRail = withTrackingScope(function LeftRail({
|
|||||||
)}
|
)}
|
||||||
<UpdateIndicator />
|
<UpdateIndicator />
|
||||||
<SandyRatingButton />
|
<SandyRatingButton />
|
||||||
<SetupDoctorButton />
|
|
||||||
<RightSidebarToggleButton />
|
<RightSidebarToggleButton />
|
||||||
<ExportEverythingEverywhereAllAtOnceButton />
|
<ExportEverythingEverywhereAllAtOnceButton />
|
||||||
<ExtrasMenu />
|
<ExtrasMenu />
|
||||||
@@ -528,24 +525,3 @@ function ExportEverythingEverywhereAllAtOnceButton() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetupDoctorButton() {
|
|
||||||
const [visible, setVisible] = useState(false);
|
|
||||||
const result = useStore(
|
|
||||||
(state) => state.healthchecks.healthcheckReport.result,
|
|
||||||
);
|
|
||||||
const hasNewProblem = useMemo(() => checkHasNewProblem(result), [result]);
|
|
||||||
const onClose = useCallback(() => setVisible(false), []);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<LeftRailButton
|
|
||||||
icon={<MedicineBoxOutlined />}
|
|
||||||
small
|
|
||||||
title="Setup Doctor"
|
|
||||||
count={hasNewProblem ? true : undefined}
|
|
||||||
onClick={() => setVisible(true)}
|
|
||||||
/>
|
|
||||||
<SetupDoctorScreen visible={visible} onClose={onClose} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {Dialog, Layout, styled, theme, useValue} from 'flipper-plugin';
|
import {Dialog, Layout, styled, theme, useValue} from 'flipper-plugin';
|
||||||
import React, {cloneElement, useCallback, useState} from 'react';
|
import React, {cloneElement, useCallback, useMemo, useState} from 'react';
|
||||||
import {useDispatch, useStore} from '../utils/useStore';
|
import {useDispatch, useStore} from '../utils/useStore';
|
||||||
import config from '../fb-stubs/config';
|
import config from '../fb-stubs/config';
|
||||||
import {isConnected, currentUser, logoutUser} from '../fb-stubs/user';
|
import {isConnected, currentUser, logoutUser} from '../fb-stubs/user';
|
||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
import {toggleLeftSidebarVisible} from '../reducers/application';
|
import {toggleLeftSidebarVisible} from '../reducers/application';
|
||||||
import PluginManager from '../chrome/plugin-manager/PluginManager';
|
import PluginManager from '../chrome/plugin-manager/PluginManager';
|
||||||
import {showEmulatorLauncher} from './appinspect/LaunchEmulator';
|
import {showEmulatorLauncher} from './appinspect/LaunchEmulator';
|
||||||
|
import SetupDoctorScreen, {checkHasNewProblem} from './SetupDoctorScreen';
|
||||||
|
|
||||||
export function Navbar() {
|
export function Navbar() {
|
||||||
return (
|
return (
|
||||||
@@ -61,7 +62,7 @@ export function Navbar() {
|
|||||||
/>
|
/>
|
||||||
<NavbarButton label="Logs" icon={FileExclamationOutlined} />
|
<NavbarButton label="Logs" icon={FileExclamationOutlined} />
|
||||||
<NavbarButton label="Alerts" icon={BellOutlined} />
|
<NavbarButton label="Alerts" icon={BellOutlined} />
|
||||||
<NavbarButton label="Doctor" icon={MedicineBoxOutlined} />
|
<SetupDoctorButton />
|
||||||
<NavbarButton label="Help" icon={QuestionCircleOutlined} />
|
<NavbarButton label="Help" icon={QuestionCircleOutlined} />
|
||||||
<NavbarButton label="More" icon={EllipsisOutlined} />
|
<NavbarButton label="More" icon={EllipsisOutlined} />
|
||||||
{config.showLogin && <LoginConnectivityButton />}
|
{config.showLogin && <LoginConnectivityButton />}
|
||||||
@@ -102,6 +103,26 @@ function LaunchEmulatorButton() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SetupDoctorButton() {
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
const result = useStore(
|
||||||
|
(state) => state.healthchecks.healthcheckReport.result,
|
||||||
|
);
|
||||||
|
const hasNewProblem = useMemo(() => checkHasNewProblem(result), [result]);
|
||||||
|
const onClose = useCallback(() => setVisible(false), []);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<NavbarButton
|
||||||
|
icon={MedicineBoxOutlined}
|
||||||
|
label="Setup Doctor"
|
||||||
|
count={hasNewProblem ? true : undefined}
|
||||||
|
onClick={() => setVisible(true)}
|
||||||
|
/>
|
||||||
|
<SetupDoctorScreen visible={visible} onClose={onClose} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function NavbarButton({
|
function NavbarButton({
|
||||||
icon: Icon,
|
icon: Icon,
|
||||||
label,
|
label,
|
||||||
@@ -114,6 +135,8 @@ function NavbarButton({
|
|||||||
// TODO remove optional
|
// TODO remove optional
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
toggled?: boolean;
|
toggled?: boolean;
|
||||||
|
/** red bubble in top right corner, notification like */
|
||||||
|
count?: number | true;
|
||||||
}) {
|
}) {
|
||||||
const color = toggled ? theme.primaryColor : theme.textColorActive;
|
const color = toggled ? theme.primaryColor : theme.textColorActive;
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user