Make sure JS Web launcher is accessible from launcher dialog
Summary: Addresses https://fb.workplace.com/groups/748354712423318/permalink/1038486449965346/ Reviewed By: timur-valiev Differential Revision: D25533227 fbshipit-source-id: 7e961df301a6dbf99c158612c7c5d80191082697
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1cad57d750
commit
a1a53391d5
@@ -23,6 +23,8 @@ import {State as Store} from '../reducers';
|
||||
import {launchJsEmulator} from '../utils/js-client-server-utils/serverUtils';
|
||||
import {updateSettings, Action} from '../reducers/settings';
|
||||
import {Settings} from '../reducers/settings';
|
||||
import {Collapse, Form, Input as AntInput} from 'antd';
|
||||
import {Html5Outlined} from '@ant-design/icons';
|
||||
|
||||
const Container = styled(FlexColumn)({
|
||||
padding: 20,
|
||||
@@ -48,6 +50,7 @@ const TitleInput = styled(Input)({
|
||||
|
||||
type OwnProps = {
|
||||
onHide: () => void;
|
||||
useSandy?: boolean;
|
||||
};
|
||||
|
||||
type StateFromProps = {
|
||||
@@ -93,7 +96,24 @@ class JSEmulatorLauncherSheet extends Component<Props, State> {
|
||||
|
||||
render() {
|
||||
const {url, height, width} = this.state;
|
||||
return (
|
||||
return this.props.useSandy ? (
|
||||
<Form labelCol={{span: 4}}>
|
||||
<Form.Item label="Url">
|
||||
<AntInput value={url} onChange={this.onUrlChange} />
|
||||
</Form.Item>
|
||||
<Form.Item label="Height">
|
||||
<AntInput value={height} onChange={this.onHeightChange} />
|
||||
</Form.Item>
|
||||
<Form.Item label="Width">
|
||||
<AntInput value={width} onChange={this.onWidthChange} />
|
||||
</Form.Item>
|
||||
<Form.Item wrapperCol={{offset: 4}}>
|
||||
<Button onClick={this.applyChanges} type="primary">
|
||||
Launch
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
) : (
|
||||
<Container>
|
||||
<Title>Launch Web App</Title>
|
||||
<Label>Url</Label>
|
||||
@@ -118,9 +138,24 @@ class JSEmulatorLauncherSheet extends Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
||||
const Launcher = connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
|
||||
({settingsState}) => ({
|
||||
settings: settingsState,
|
||||
}),
|
||||
{updateSettings},
|
||||
)(JSEmulatorLauncherSheet);
|
||||
|
||||
export default Launcher;
|
||||
|
||||
export function JSEmulatorLauncherSheetSandy({onClose}: {onClose(): void}) {
|
||||
return (
|
||||
<Collapse>
|
||||
<Collapse.Panel
|
||||
extra={<Html5Outlined />}
|
||||
header="Launch JS Web App"
|
||||
key="launch-js-web-app">
|
||||
<Launcher onHide={onClose} useSandy />
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
getSimulators,
|
||||
IOSDeviceParams,
|
||||
} from '../../dispatcher/iOSDevice';
|
||||
import GK from '../../fb-stubs/GK';
|
||||
import {JSEmulatorLauncherSheetSandy} from '../../chrome/JSEmulatorLauncherSheet';
|
||||
|
||||
export function showEmulatorLauncher(store: Store) {
|
||||
renderReactRoot((unmount) => (
|
||||
@@ -94,6 +96,15 @@ export const LaunchEmulatorDialog = withTrackingScope(
|
||||
</Button>
|
||||
)),
|
||||
];
|
||||
// Launch JS emulator
|
||||
if (GK.get('flipper_js_client_emulator')) {
|
||||
items.push(
|
||||
<JSEmulatorLauncherSheetSandy
|
||||
key="js-emulator-launcher"
|
||||
onClose={onClose}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user