Skip to content

Commit

Permalink
Merge pull request #62 from smacker/code_editor
Browse files Browse the repository at this point in the history
Code viewer
  • Loading branch information
smacker authored Jun 7, 2018
2 parents 360c032 + e856016 commit 11b0169
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Helmet } from 'react-helmet';
import { Grid, Row, Col, Modal } from 'react-bootstrap';
import SplitPane from 'react-split-pane';
import UASTViewer, { transformer } from 'uast-viewer';
import UASTViewer, { Editor, transformer } from 'uast-viewer';
import 'uast-viewer/dist/default-theme.css';
import Sidebar from './components/Sidebar';
import QueryBox from './components/QueryBox';
Expand Down Expand Up @@ -119,7 +119,7 @@ FROM ( SELECT MONTH(committer_when) as month,
this.setState({
showModal: true,
modalTitle: 'Source code',
modalContent: <pre>{code}</pre>
modalContent: <Editor code={code} />
});
}

Expand All @@ -128,7 +128,7 @@ FROM ( SELECT MONTH(committer_when) as month,
showModal: true,
modalTitle: 'UAST',
modalContent:
// currently github returns only 1 item, UAST of the file
// currently gitbase returns only 1 item, UAST of the file
// but just in case if there is more or less we show it without viewer
uast.length === 1 ? (
<UASTViewer uast={transformer(uast[0])} />
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/App.less
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ body {
// make modal window "fullscreen"
// margins are hard-coded in bootstrap, so it's hard-coded here too
.modal-body {
max-height: ~'calc(100vh - 80px)';
height: ~'calc(100vh - 80px)';
overflow-y: auto;
}

Expand All @@ -78,3 +78,8 @@ body {
max-height: ~'calc(100vh - 120px)';
}
}

.uast-editor,
.react-codemirror2 {
height: 100%;
}

0 comments on commit 11b0169

Please sign in to comment.