Skip to content
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
33 changes: 20 additions & 13 deletions josh-ui/src/DiffViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type DiffViewerProps = {
type State = {
content_a?: string
content_b?: string
summary: string
client: GraphQLClient
}

Expand All @@ -37,6 +38,7 @@ export class DiffViewer extends React.Component<DiffViewerProps, State> {
state = {
content_a: undefined,
content_b: undefined,
summary: "",
client: new GraphQLClient(`${getServer()}/~/graphql/${this.props.repo}`, {
mode: 'cors',
errorPolicy: 'all'
Expand Down Expand Up @@ -64,26 +66,31 @@ export class DiffViewer extends React.Component<DiffViewerProps, State> {

this.setState({
content_a: content_a,
content_b: content_b
content_b: content_b,
summary: data.summary,
})
})
}

render() {
if (this.state.content_a !== undefined
&& this.state.content_b !== undefined) {
return <DiffEditor
modified={this.state.content_b}
original={this.state.content_a}
language={mapLanguage(this.props.path)}
height='80vh'
theme='vs-dark'
options={{
readOnly: true,
domReadOnly: true,
cursorBlinking: 'solid',
}}
/>
return <div>
<div>{this.state.summary}</div>
<div>{this.props.path}</div>
<DiffEditor
modified={this.state.content_b}
original={this.state.content_a}
language={mapLanguage(this.props.path)}
height='80vh'
theme='vs-dark'
options={{
readOnly: true,
domReadOnly: true,
cursorBlinking: 'solid',
}}
/>
</div>
} else
{
return <div>Loading...</div>
Expand Down
1 change: 1 addition & 0 deletions josh-ui/src/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ query($rev: String!, $filter: String!, $path: String!) {
export const QUERY_FILE_DIFF = gql`
query($rev: String!, $filter: String!, $path: String!) {
rev(at:$rev, filter:$filter) {
summary
history(limit: 2) {
file(path:$path) {
text
Expand Down