Make support form and plugin manager accessible

Summary:
This diff makes the plugin manager and support form accessible from Sandy.

Actually converting them is TODO in T78698507 / T78698498

Reviewed By: cekkaewnumchai

Differential Revision: D24620558

fbshipit-source-id: c689d95b638b77ad504915a117e909cf0d88b841
This commit is contained in:
Michel Weststrate
2020-10-30 04:20:00 -07:00
committed by Facebook GitHub Bot
parent 3484f321af
commit aef3672235

View File

@@ -24,6 +24,8 @@ import {
import {SidebarLeft, SidebarRight} from './SandyIcons';
import {useDispatch, useStore} from '../utils/useStore';
import {
ACTIVE_SHEET_PLUGINS,
setActiveSheet,
toggleLeftSidebarVisible,
toggleRightSidebarVisible,
} from '../reducers/application';
@@ -40,6 +42,10 @@ import config from '../fb-stubs/config';
import styled from '@emotion/styled';
import {showEmulatorLauncher} from './appinspect/LaunchEmulator';
import {useStore as useReduxStore} from 'react-redux';
import SupportRequestFormV2 from '../fb-stubs/SupportRequestFormV2';
import {setStaticView} from '../reducers/connections';
import {getInstance} from '../fb-stubs/Logger';
import {isStaticViewActive} from '../chrome/mainsidebar/sidebarUtils';
const LeftRailButtonElem = styled(Button)<{kind?: 'small'}>(({kind}) => ({
width: kind === 'small' ? 32 : 36,
@@ -107,6 +113,7 @@ export function LeftRail({
toplevelSelection,
setToplevelSelection,
}: ToplevelProps) {
const dispatch = useDispatch();
return (
<Layout.Container borderRight padv={12} width={48}>
<Layout.Bottom>
@@ -119,7 +126,13 @@ export function LeftRail({
setToplevelSelection('appinspect');
}}
/>
<LeftRailButton icon={<AppstoreOutlined />} title="Plugin Manager" />
<LeftRailButton
icon={<AppstoreOutlined />}
title="Plugin Manager"
onClick={() => {
dispatch(setActiveSheet(ACTIVE_SHEET_PLUGINS));
}}
/>
<NotificationButton
toplevelSelection={toplevelSelection}
setToplevelSelection={setToplevelSelection}
@@ -135,11 +148,7 @@ export function LeftRail({
<SetupDoctorButton />
<WelcomeScreenButton />
<ShowSettingsButton />
<LeftRailButton
icon={<BugOutlined />}
small
title="Feedback / Bug Reporter"
/>
<SupportFormButton />
<RightSidebarToggleButton />
<LeftSidebarToggleButton />
{config.showLogin && <LoginButton />}
@@ -282,6 +291,27 @@ function ShowSettingsButton() {
);
}
function SupportFormButton() {
const dispatch = useDispatch();
const staticView = useStore((state) => state.connections.staticView);
// const isVisible =
return (
<LeftRailButton
icon={<BugOutlined />}
small
title="Feedback / Bug Reporter"
selected={isStaticViewActive(staticView, SupportRequestFormV2)}
onClick={() => {
getInstance().track('usage', 'support-form-source', {
source: 'sidebar',
group: undefined,
});
dispatch(setStaticView(SupportRequestFormV2));
}}
/>
);
}
function WelcomeScreenButton() {
const settings = useStore((state) => state.settingsState);
const {showWelcomeAtStartup} = settings;