diff --git a/desktop/app/src/App.tsx b/desktop/app/src/App.tsx index 36e552584..1ef351a4d 100644 --- a/desktop/app/src/App.tsx +++ b/desktop/app/src/App.tsx @@ -12,7 +12,6 @@ import {FlexColumn, FlexRow, styled} from 'flipper'; import {connect} from 'react-redux'; import TitleBar from './chrome/TitleBar'; import MainSidebar2 from './chrome/mainsidebar/MainSidebar2'; -import BugReporterDialog from './chrome/BugReporterDialog'; import ErrorBar from './chrome/ErrorBar'; import DoctorBar from './chrome/DoctorBar'; import ShareSheetExportUrl from './chrome/ShareSheetExportUrl'; @@ -26,7 +25,6 @@ import {ipcRenderer, remote} from 'electron'; import { ActiveSheet, ShareType, - ACTIVE_SHEET_BUG_REPORTER, ACTIVE_SHEET_PLUGINS, ACTIVE_SHEET_SHARE_DATA, ACTIVE_SHEET_SIGN_IN, @@ -41,7 +39,6 @@ import { ACTIVE_SHEET_CHANGELOG_RECENT_ONLY, } from './reducers/application'; import {Logger} from './fb-interfaces/Logger'; -import BugReporter from './fb-stubs/BugReporter'; import {State as Store} from './reducers/index'; import {StaticView, FlipperError} from './reducers/connections'; import PluginManager from './chrome/plugin-manager/PluginManager'; @@ -54,7 +51,6 @@ const version = remote.app.getVersion(); type OwnProps = { logger: Logger; - bugReporter: BugReporter; }; type StateFromProps = { @@ -99,13 +95,6 @@ export class App extends React.Component { getSheet = (onHide: () => any) => { const {activeSheet} = this.props; switch (activeSheet) { - case ACTIVE_SHEET_BUG_REPORTER: - return ( - - ); case ACTIVE_SHEET_PLUGINS: return ; case ACTIVE_SHEET_SIGN_IN: diff --git a/desktop/app/src/chrome/BugReporterDialog.tsx b/desktop/app/src/chrome/BugReporterDialog.tsx deleted file mode 100644 index 510cae0b0..000000000 --- a/desktop/app/src/chrome/BugReporterDialog.tsx +++ /dev/null @@ -1,345 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import BugReporter from '../fb-stubs/BugReporter'; -import {FlipperPlugin, FlipperDevicePlugin} from '../plugin'; -import React, {Fragment, Component} from 'react'; -import {connect} from 'react-redux'; -import { - Button, - colors, - Link, - Input, - FlexColumn, - FlexRow, - FlexCenter, - Textarea, - Text, - Glyph, - styled, -} from 'flipper'; -import {State as Store} from '../reducers'; -import LoadingIndicator from '../ui/components/LoadingIndicator'; -const Container = styled(FlexColumn)({ - padding: 10, - width: 400, - height: 300, -}); - -const CenteredContainer = styled(FlexColumn)<{size: number}>(({size}) => ({ - justifyContent: 'center', - alignItems: 'center', - width: size, - height: size, -})); - -const Icon = styled(Glyph)({ - marginRight: 8, - marginLeft: 3, -}); - -const Center = styled(Text)({ - textAlign: 'center', - lineHeight: '130%', - paddingLeft: 20, - paddingRight: 20, -}); - -const Title = styled.div({ - fontWeight: 500, - marginTop: 8, - marginLeft: 2, - marginBottom: 8, -}); - -const textareaStyle = { - margin: 0, - marginBottom: 10, -}; - -const TitleInput = styled(Input)({ - ...textareaStyle, - height: 30, -}); - -const DescriptionTextarea = styled(Textarea)({ - ...textareaStyle, - flexGrow: 1, -}); - -const SubmitButtonContainer = styled.div({ - marginLeft: 'auto', -}); - -const Footer = styled(FlexRow)({ - lineHeight: '24px', -}); - -const CloseDoneButton = styled(Button)({ - marginTop: 20, - marginLeft: 'auto !important', - marginRight: 'auto', -}); - -const InfoBox = styled(FlexRow)({ - marginBottom: 20, - lineHeight: '130%', -}); - -type State = { - description: string; - title: string; - submitting: boolean; - success: number | null | undefined; - error: string | null | undefined; -}; - -type OwnProps = { - bugReporter: BugReporter; - onHide: () => any; -}; - -type DispatchFromProps = {}; - -type StateFromProps = { - activePlugin: - | typeof FlipperPlugin - | typeof FlipperDevicePlugin - | null - | undefined; -}; - -type Props = OwnProps & StateFromProps & DispatchFromProps; -class BugReporterDialog extends Component { - state = { - description: '', - title: '', - submitting: false, - success: null, - error: null, - }; - - titleRef?: HTMLElement | null; - descriptionRef?: HTMLElement | null; - - onDescriptionChange = (e: React.ChangeEvent) => { - this.setState({description: e.target.value}); - }; - - onTitleChange = (e: React.ChangeEvent) => { - this.setState({title: e.target.value}); - }; - - onSubmit = () => { - // validate fields - const {title, description} = this.state; - if (!title) { - this.setState({ - error: 'Title required.', - }); - if (this.titleRef) { - this.titleRef.focus(); - } - return; - } - if (!description) { - this.setState({ - error: 'Description required.', - }); - if (this.descriptionRef) { - this.descriptionRef.focus(); - } - return; - } - - this.setState( - { - error: null, - submitting: true, - }, - () => { - // this will be called before the next repaint - requestAnimationFrame(() => { - // we have to call this again to ensure a repaint has actually happened - // as requestAnimationFrame is called BEFORE a repaint, not after which - // means we have to queue up twice to actually ensure a repaint has - // happened - requestAnimationFrame(() => { - this.props.bugReporter - .report(title, description) - .then((id: number) => { - this.setState({ - submitting: false, - success: id, - }); - }) - .catch((err) => { - this.setState({ - error: err.message, - submitting: false, - }); - }); - }); - }); - }, - ); - }; - - setTitleRef = (ref: HTMLElement | null) => { - this.titleRef = ref; - }; - - setDescriptionRef = (ref: HTMLElement | null) => { - this.descriptionRef = ref; - }; - - onCancel = () => { - if (this.state.submitting) { - this.props.bugReporter.abort(); - } - this.setState({ - error: null, - title: '', - description: '', - submitting: false, - }); - this.props.onHide(); - }; - - render() { - let content; - const {title, success, error, description, submitting} = this.state; - const {activePlugin} = this.props; - - if (success) { - content = ( - - -
- -
- Bug Report created - The bug report{' '} - - {success} - {' '} - was successfully created. Thank you for your help making Flipper - better! -
- - Close - -
-
- ); - } else { - if (submitting) { - content = ( - - - - - Submitting... - - -
- - - -
-
- ); - } else { - content = ( - - Report a bug in Flipper - - - - {activePlugin && activePlugin.bugs && ( - - - - If your bug is related to the{' '} - - {(activePlugin && activePlugin.title) || activePlugin.id}{' '} - plugin - - {activePlugin && activePlugin.bugs && activePlugin.bugs.url && ( - - , you might find useful information about it here:{' '} - - {activePlugin.bugs.url} - - - )} - {activePlugin && - activePlugin.bugs && - activePlugin.bugs.email && ( - - , you might also want contact{' '} - - {activePlugin.bugs.email} - - , the author/oncall of this plugin, directly - - )} - . - - - )} - -
- {error != null && {error}} - - - - -
-
- ); - } - } - return {content}; - } -} - -export default connect( - ({ - plugins: {devicePlugins, clientPlugins}, - connections: {selectedPlugin}, - }) => ({ - activePlugin: selectedPlugin - ? devicePlugins.get(selectedPlugin) || clientPlugins.get(selectedPlugin) - : null, - }), -)(BugReporterDialog); diff --git a/desktop/app/src/chrome/TitleBar.tsx b/desktop/app/src/chrome/TitleBar.tsx index 5e2c4c9ae..078202add 100644 --- a/desktop/app/src/chrome/TitleBar.tsx +++ b/desktop/app/src/chrome/TitleBar.tsx @@ -14,7 +14,6 @@ import { setActiveSheet, toggleLeftSidebarVisible, toggleRightSidebarVisible, - ACTIVE_SHEET_BUG_REPORTER, ACTIVE_SHEET_SETTINGS, ACTIVE_SHEET_DOCTOR, } from '../reducers/application'; @@ -192,14 +191,6 @@ class TitleBar extends React.Component { reportUsage('settings:opened:fromTitleBar'); }} /> - {config.bugReportButtonVisible && ( -