Skip to content

Code viewer #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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%;
}