Skip to content

Commit 11b0169

Browse files
authored
Merge pull request #62 from smacker/code_editor
Code viewer
2 parents 360c032 + e856016 commit 11b0169

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

frontend/src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
22
import { Helmet } from 'react-helmet';
33
import { Grid, Row, Col, Modal } from 'react-bootstrap';
44
import SplitPane from 'react-split-pane';
5-
import UASTViewer, { transformer } from 'uast-viewer';
5+
import UASTViewer, { Editor, transformer } from 'uast-viewer';
66
import 'uast-viewer/dist/default-theme.css';
77
import Sidebar from './components/Sidebar';
88
import QueryBox from './components/QueryBox';
@@ -119,7 +119,7 @@ FROM ( SELECT MONTH(committer_when) as month,
119119
this.setState({
120120
showModal: true,
121121
modalTitle: 'Source code',
122-
modalContent: <pre>{code}</pre>
122+
modalContent: <Editor code={code} />
123123
});
124124
}
125125

@@ -128,7 +128,7 @@ FROM ( SELECT MONTH(committer_when) as month,
128128
showModal: true,
129129
modalTitle: 'UAST',
130130
modalContent:
131-
// currently github returns only 1 item, UAST of the file
131+
// currently gitbase returns only 1 item, UAST of the file
132132
// but just in case if there is more or less we show it without viewer
133133
uast.length === 1 ? (
134134
<UASTViewer uast={transformer(uast[0])} />

frontend/src/App.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ body {
6969
// make modal window "fullscreen"
7070
// margins are hard-coded in bootstrap, so it's hard-coded here too
7171
.modal-body {
72-
max-height: ~'calc(100vh - 80px)';
72+
height: ~'calc(100vh - 80px)';
7373
overflow-y: auto;
7474
}
7575

@@ -78,3 +78,8 @@ body {
7878
max-height: ~'calc(100vh - 120px)';
7979
}
8080
}
81+
82+
.uast-editor,
83+
.react-codemirror2 {
84+
height: 100%;
85+
}

0 commit comments

Comments
 (0)