-
Notifications
You must be signed in to change notification settings - Fork 723
/
Copy pathcommands.tsx
87 lines (80 loc) · 2.71 KB
/
commands.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import * as React from 'react';
import { Button, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import { observer } from 'mobx-react';
import { GistActionButton } from './commands-action-button';
import { AddressBar } from './commands-address-bar';
import { BisectHandler } from './commands-bisect';
import { Runner } from './commands-runner';
import { VersionChooser } from './commands-version-chooser';
import { AppState } from '../state';
interface CommandsProps {
appState: AppState;
}
/**
* The command bar, containing all the buttons doing
* all the things
*/
export const Commands = observer(
class Commands extends React.Component<CommandsProps> {
constructor(props: CommandsProps) {
super(props);
}
private handleDoubleClick = (e: React.MouseEvent<HTMLDivElement>) => {
// Only maximize if the toolbar itself is clicked (ignore for buttons, input, etc)
if (e.currentTarget === e.target) {
window.ElectronFiddle.macTitlebarClicked();
}
};
public render() {
const { appState } = this.props;
const { isBisectCommandShowing, title, isSettingsShowing } = appState;
return (
<div
className={classNames(
'commands',
{ 'is-mac': window.ElectronFiddle.platform === 'darwin' },
{ 'tabbing-hidden': isSettingsShowing },
)}
onDoubleClick={this.handleDoubleClick}
>
<div>
<ControlGroup fill={true} vertical={false}>
<Button
icon="cog"
title="Setting"
onClick={appState.toggleSettings}
/>
</ControlGroup>
<ControlGroup fill={true} vertical={false}>
<VersionChooser appState={appState} />
</ControlGroup>
<ControlGroup fill={true} vertical={false}>
<Runner appState={appState} />
</ControlGroup>
{isBisectCommandShowing && (
<ControlGroup fill={true} vertical={false}>
<BisectHandler appState={appState} />
</ControlGroup>
)}
<ControlGroup fill={true} vertical={false}>
<Button
active={appState.isConsoleShowing}
icon="console"
text="Console"
onClick={appState.toggleConsole}
/>
</ControlGroup>
</div>
{window.ElectronFiddle.platform === 'darwin' ? (
<div className="title">{title}</div>
) : undefined}
<div>
<AddressBar appState={appState} />
<GistActionButton appState={appState} />
</div>
</div>
);
}
},
);