-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp UI
- Loading branch information
Antoine-Melki
authored and
Antoine-Melki
committed
Aug 20, 2017
1 parent
f502483
commit c228685
Showing
12 changed files
with
214 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import JSONPretty from 'react-json-pretty'; | ||
import axios from 'axios'; | ||
import 'react-json-pretty/JSONPretty.adventure_time.styl'; | ||
|
||
export default class Json extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.loadState = this.loadState.bind(this); | ||
this.isStateValid = this.isStateValid.bind(this); | ||
} | ||
|
||
loadState() { | ||
const _this = this; | ||
const fileName = this.props.match.params["0"]; | ||
axios.get('/' + fileName).then(res => { | ||
_this.setState(res.data); | ||
}); | ||
|
||
} | ||
|
||
componentDidMount() { | ||
this.loadState(); | ||
} | ||
|
||
isStateValid() { | ||
return this.state; | ||
} | ||
|
||
render() { | ||
if (this.isStateValid()) { | ||
return <JSONPretty style={{textAlign: 'left', padding: 10}} id="json-pretty" json={this.state}/>; | ||
} else { | ||
return <div>no json</div>; | ||
} | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom' | ||
import {App, NoMatch,} from './app'; | ||
import { Router, Route, browserHistory } from 'react-router' | ||
import Json from './json'; | ||
import { BrowserRouter, Route, Switch } from 'react-router-dom' | ||
|
||
render(( | ||
<Router history={browserHistory}> | ||
<Route path="/" component={App}> | ||
<Route path="/node/*" component={App}/> | ||
<Route path="*" component={NoMatch}/> | ||
</Route> | ||
</Router> | ||
<BrowserRouter> | ||
<Switch> | ||
<Route exact path="/" component={App}/> | ||
<Route path="/node/*" component={App}/> | ||
<Route path="/json/*" component={Json}/> | ||
<Route component={NoMatch}/> | ||
</Switch> | ||
</BrowserRouter> | ||
), document.getElementById('root')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.