summaryrefslogtreecommitdiff
path: root/frontend/app.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-05-30 17:27:04 +0200
committerJules Laplace <julescarbon@gmail.com>2020-05-30 17:27:04 +0200
commit0890fdd951d021308550a0db2e7b6f2593512957 (patch)
treea0050b153242ccde662fc0a957a79fc7a7edc4b4 /frontend/app.js
initial site copied in
Diffstat (limited to 'frontend/app.js')
-rw-r--r--frontend/app.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/frontend/app.js b/frontend/app.js
new file mode 100644
index 0000000..38a50c6
--- /dev/null
+++ b/frontend/app.js
@@ -0,0 +1,41 @@
+import React, { Component } from 'react'
+import { ConnectedRouter } from 'connected-react-router'
+import { Route } from 'react-router'
+
+import { Header } from './common'
+
+import actions from './actions'
+
+import * as views from './views'
+
+const viewList = Object.keys(views).map(name => {
+ const view = views[name]
+ return (
+ <Route key={name} path={'/' + name} component={view} />
+ )
+})
+
+export default class App extends Component {
+ componentDidMount() {
+ // actions.modelzoo.index()
+ }
+ render() {
+ return (
+ <ConnectedRouter history={this.props.history}>
+ <div>
+ <Header />
+ <div className='app'>
+ <div className='body'>
+ {viewList}
+ <Route exact key='root' path='/' render={() => {
+ // redirect to search!!
+ setTimeout(() => this.props.history.push('/search/'), 10)
+ return null
+ }} />
+ </div>
+ </div>
+ </div>
+ </ConnectedRouter>
+ )
+ }
+}