showing multiple sheets

Summary:
The sheet was only used for the bug-reporter before and we had an explicit boolean flag in the redux store to keep track if the bug reporter is shown.

Changing this it an `activeSheet` property, which allows us to show arbitrary sheets, while making sure to only show one at a time.

Reviewed By: jknoxville

Differential Revision: D13516985

fbshipit-source-id: 3e83f719e2b61d0b2229268ebfdc910123b403d2
This commit is contained in:
Daniel Büchele
2018-12-20 06:07:55 -08:00
committed by Facebook Github Bot
parent 6827515329
commit fa9b85b065
5 changed files with 98 additions and 74 deletions

View File

@@ -5,6 +5,8 @@
* @format
*/
import type {ActiveSheet} from '../reducers/application';
import {
colors,
Button,
@@ -12,15 +14,13 @@ import {
FlexRow,
Component,
Spacer,
GK,
styled,
} from 'flipper';
import {connect} from 'react-redux';
import {
toggleBugDialogVisible,
setActiveSheet,
toggleLeftSidebarVisible,
toggleRightSidebarVisible,
togglePluginManagerVisible,
} from '../reducers/application.js';
import DevicesButton from './DevicesButton.js';
import ScreenCaptureButtons from './ScreenCaptureButtons.js';
@@ -52,11 +52,9 @@ type Props = {|
leftSidebarVisible: boolean,
rightSidebarVisible: boolean,
rightSidebarAvailable: boolean,
pluginManagerVisible: boolean,
toggleBugDialogVisible: (visible?: boolean) => void,
toggleLeftSidebarVisible: (visible?: boolean) => void,
toggleRightSidebarVisible: (visible?: boolean) => void,
togglePluginManagerVisible: (visible?: boolean) => void,
setActiveSheet: (sheet: ActiveSheet) => void,
|};
class TitleBar extends Component<Props> {
@@ -70,20 +68,11 @@ class TitleBar extends Component<Props> {
{config.bugReportButtonVisible && (
<Button
compact={true}
onClick={() => this.props.toggleBugDialogVisible()}
onClick={() => this.props.setActiveSheet('BUG_REPORTER')}
title="Report Bug"
icon="bug"
/>
)}
{GK.get('sonar_dynamic_plugins') && (
<Button
compact={true}
onClick={() => this.props.toggleBugDialogVisible()}
selected={this.props.pluginManagerVisible}
title="Plugin Manager"
icon="apps"
/>
)}
<ButtonGroup>
<Button
compact={true}
@@ -127,9 +116,8 @@ export default connect(
pluginManagerVisible,
}),
{
toggleBugDialogVisible,
setActiveSheet,
toggleLeftSidebarVisible,
toggleRightSidebarVisible,
togglePluginManagerVisible,
},
)(TitleBar);