1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import { h, Component } from 'preact'
import { Route, Link } from 'react-router-dom'
import actions from '../../actions'
import util from '../../util'
import SampleRNNNew from './views/samplernn.new'
import SampleRNNShow from './views/samplernn.show'
import SampleRNNImport from './views/samplernn.import'
import SampleRNNResults from './views/samplernn.results'
import SampleRNNGraph from './views/samplernn.graph'
class router {
componentWillMount(){
actions.system.changeTool('samplernn')
document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #eef, #fef)'
}
componentWillReceiveProps(){
actions.system.changeTool('samplernn')
document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #eef, #fef)'
}
render(){
return (
<section>
<Route exact path='/samplernn/new' component={SampleRNNNew} />
<Route exact path='/samplernn/datasets' component={SampleRNNShow} />
<Route exact path='/samplernn/datasets/:id' component={SampleRNNShow} />
<Route exact path='/samplernn/import' component={SampleRNNImport} />
<Route exact path='/samplernn/results' component={SampleRNNResults} />
<Route exact path='/samplernn/graph' component={SampleRNNGraph} />
</section>
)
}
}
function links(){
return [
{ url: '/samplernn/new/', name: 'new' },
{ url: '/samplernn/datasets/', name: 'datasets' },
{ url: '/samplernn/graph/', name: 'graph' },
{ url: '/samplernn/results/', name: 'results' },
]
}
export default {
name: 'samplernn',
router, links,
}
|