Skip to content

Commit 0d79ca8

Browse files
committed
Move uast checkbox to the modal title
Signed-off-by: Carlos Martín <[email protected]>
1 parent ecfb791 commit 0d79ca8

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

frontend/src/components/CodeViewer.js

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ import UASTViewer, { Editor, withUASTEditor } from 'uast-viewer';
66
import api from '../api';
77
import './CodeViewer.less';
88

9-
function EditorPane({
10-
languages,
11-
language,
12-
showUast,
13-
handleLangChange,
14-
handleShowUastChange,
15-
editorProps
16-
}) {
9+
function EditorPane({ languages, language, handleLangChange, editorProps }) {
1710
return (
1811
<div className="editor-pane">
1912
Language:{' '}
@@ -25,14 +18,6 @@ function EditorPane({
2518
</option>
2619
))}
2720
</select>
28-
<label>
29-
<input
30-
type="checkbox"
31-
checked={showUast}
32-
onChange={handleShowUastChange}
33-
disabled={!language}
34-
/>UAST
35-
</label>
3621
<Editor {...editorProps} theme="default" />
3722
</div>
3823
);
@@ -46,28 +31,22 @@ EditorPane.propTypes = {
4631
})
4732
).isRequired,
4833
language: PropTypes.string,
49-
showUast: PropTypes.bool,
5034
handleLangChange: PropTypes.func.isRequired,
51-
handleShowUastChange: PropTypes.func.isRequired,
5235
editorProps: PropTypes.object
5336
};
5437

5538
function EditorUASTSpitPane({
5639
languages,
5740
editorProps,
5841
uastViewerProps,
59-
showUast,
60-
handleLangChange,
61-
handleShowUastChange
42+
handleLangChange
6243
}) {
6344
return (
6445
<SplitPane split="vertical" defaultSize={250} minSize={175}>
6546
<EditorPane
6647
languages={languages}
6748
language={editorProps.languageMode}
68-
showUast={showUast}
6949
handleLangChange={handleLangChange}
70-
handleShowUastChange={handleShowUastChange}
7150
editorProps={editorProps}
7251
/>
7352
{uastViewerProps.uast ? <UASTViewer {...uastViewerProps} /> : <div />}
@@ -79,9 +58,7 @@ EditorUASTSpitPane.propTypes = {
7958
languages: EditorPane.propTypes.languages,
8059
editorProps: PropTypes.object,
8160
uastViewerProps: PropTypes.object,
82-
showUast: PropTypes.bool,
83-
handleLangChange: PropTypes.func.isRequired,
84-
handleShowUastChange: PropTypes.func.isRequired
61+
handleLangChange: PropTypes.func.isRequired
8562
};
8663

8764
const EditorWithUAST = withUASTEditor(EditorUASTSpitPane);
@@ -166,7 +143,17 @@ class CodeViewer extends Component {
166143
return (
167144
<Modal show={showModal} onHide={onHide} bsSize="large">
168145
<Modal.Header closeButton>
169-
<Modal.Title>CODE</Modal.Title>
146+
<Modal.Title>
147+
CODE
148+
<label>
149+
<input
150+
type="checkbox"
151+
checked={showUast}
152+
onChange={this.handleShowUastChange}
153+
disabled={!language}
154+
/>UAST
155+
</label>
156+
</Modal.Title>
170157
</Modal.Header>
171158
<Modal.Body>
172159
{showUast ? (

0 commit comments

Comments
 (0)