Setup of the bug creation screen

Summary: This diff sets up the create form for the new support request project. The current screen is very basic. I will be iterating through it in the upcoming diffs.

Reviewed By: passy

Differential Revision: D18327464

fbshipit-source-id: af01fc10f68a135f32f0ae98551986852019e8aa
This commit is contained in:
Pritesh Nandgaonkar
2019-11-06 10:44:11 -08:00
committed by Facebook Github Bot
parent 2ae2352972
commit 994546b24a
5 changed files with 92 additions and 19 deletions

View File

@@ -15,12 +15,15 @@ import {
ACTIVE_SHEET_PLUGINS, ACTIVE_SHEET_PLUGINS,
ACTIVE_SHEET_SETTINGS, ACTIVE_SHEET_SETTINGS,
} from './reducers/application'; } from './reducers/application';
import {setStaticView} from './reducers/connections';
import SupportRequestFormV2 from './fb-stubs/SupportRequestFormV2';
import {Store} from './reducers/'; import {Store} from './reducers/';
import electron, {MenuItemConstructorOptions} from 'electron'; import electron, {MenuItemConstructorOptions} from 'electron';
import {notNull} from './utils/typeUtils'; import {notNull} from './utils/typeUtils';
import constants from './fb-stubs/constants'; import constants from './fb-stubs/constants';
import os from 'os'; import os from 'os';
import path from 'path'; import path from 'path';
import GK from './fb-stubs/GK';
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste'; export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help'; export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
@@ -221,28 +224,44 @@ function getTemplate(
}, },
}); });
} }
const fileSubmenu: MenuItemConstructorOptions[] = [
{
label: 'Preferences',
accelerator: 'Cmd+,',
click: () => store.dispatch(setActiveSheet(ACTIVE_SHEET_SETTINGS)),
},
{
label: 'Import Flipper File...',
accelerator: 'CommandOrControl+O',
click: function() {
showOpenDialog(store);
},
},
{
label: 'Export',
submenu: exportSubmenu,
},
];
if (GK.get('support_requests_v2')) {
const supportRequestSubmenu = [
{
label: 'Create...',
click: function() {
// Dispatch an action to open the export screen of Support Request form
store.dispatch(setStaticView(SupportRequestFormV2));
},
},
];
fileSubmenu.push({
label: 'Support Requests',
submenu: supportRequestSubmenu,
});
}
const template: MenuItemConstructorOptions[] = [ const template: MenuItemConstructorOptions[] = [
{ {
label: 'File', label: 'File',
submenu: [ submenu: fileSubmenu,
{
label: 'Preferences',
accelerator: 'Cmd+,',
click: () => store.dispatch(setActiveSheet(ACTIVE_SHEET_SETTINGS)),
},
{
label: 'Import Flipper File...',
accelerator: 'CommandOrControl+O',
click: function() {
showOpenDialog(store);
},
},
{
label: 'Export',
submenu: exportSubmenu,
},
],
}, },
{ {
label: 'Edit', label: 'Edit',

View File

@@ -0,0 +1,17 @@
/**
* 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 React, {Component} from 'react';
import {Text} from '../ui';
export default class extends Component<void, void> {
render() {
return <Text>Build your support request creation form.</Text>;
}
}

View File

@@ -20,11 +20,13 @@ const WelcomeScreen = isHeadless()
? require('../chrome/WelcomeScreenHeadless').default ? require('../chrome/WelcomeScreenHeadless').default
: require('../chrome/WelcomeScreen').default; : require('../chrome/WelcomeScreen').default;
import SupportRequestForm from '../fb-stubs/SupportRequestFormManager'; import SupportRequestForm from '../fb-stubs/SupportRequestFormManager';
import SupportRequestFormV2 from '../fb-stubs/SupportRequestFormV2';
export type StaticView = export type StaticView =
| null | null
| typeof WelcomeScreen | typeof WelcomeScreen
| typeof SupportRequestForm; | typeof SupportRequestForm
| typeof SupportRequestFormV2;
export type FlipperError = { export type FlipperError = {
occurrences?: number; occurrences?: number;

View File

@@ -0,0 +1,34 @@
/**
* 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 styled from 'react-emotion';
import {colors} from './colors';
export const multilineStyle = {
border: `1px solid ${colors.light15}`,
borderRadius: 4,
font: 'inherit',
fontSize: '1em',
height: '28px',
lineHeight: '28px',
marginRight: 5,
'&:disabled': {
backgroundColor: '#ddd',
borderColor: '#ccc',
cursor: 'not-allowed',
},
};
const MultiLineInput = styled('textarea')({
...multilineStyle,
padding: '0 10px',
});
export default MultiLineInput;

View File

@@ -70,6 +70,7 @@ export {default as TabsContainer} from './components/TabsContainer';
// inputs // inputs
export {default as Input} from './components/Input'; export {default as Input} from './components/Input';
export {default as MultiLineInput} from './components/MultiLineInput';
export {default as Textarea} from './components/Textarea'; export {default as Textarea} from './components/Textarea';
export {default as Select} from './components/Select'; export {default as Select} from './components/Select';
export {default as Checkbox} from './components/Checkbox'; export {default as Checkbox} from './components/Checkbox';