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
|
import { h, Component } from 'preact'
import { Route, Link } from 'react-router-dom'
import actions from '../../actions'
import util from '../../util'
import Pix2WavNew from './views/pix2wav.new'
import Pix2WavShow from './views/pix2wav.show'
import Pix2WavLive from './views/pix2wav.live'
class router {
componentWillMount(){
actions.system.changeTool('pix2wav')
document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #bdf, #def)'
}
componentWillReceiveProps(){
actions.system.changeTool('pix2wav')
document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #bdf, #def)'
}
render(){
return (
<section>
<Route exact path='/pix2wav/new/' component={Pix2WavNew} />
<Route exact path='/pix2wav/datasets/' component={Pix2WavShow} />
<Route exact path='/pix2wav/datasets/:id/' component={Pix2WavShow} />
<Route exact path='/pix2wav/live/' component={Pix2WavLive} />
</section>
)
}
}
function links(){
return [
{ url: '/pix2wav/new/', name: 'new' },
{ url: '/pix2wav/datasets/', name: 'datasets' },
{ url: '/pix2wav/live/', name: 'live' },
]
}
export default {
name: 'pix2wav',
router, links,
}
|