summaryrefslogtreecommitdiff
path: root/app/client/modules/pix2pixhd/index.js
blob: cbd3136e68ecd096820461a03241e2bd262f9ec4 (plain)
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
50
import { h, Component } from 'preact'
import { Route, Link } from 'react-router-dom'

import actions from '../../actions'

import util from '../../util'

import Pix2PixHDNew from './views/pix2pixhd.new'
import Pix2PixHDShow from './views/pix2pixhd.show'
import Pix2PixHDResults from './views/pix2pixhd.results'
import Pix2PixHDTrain from './views/pix2pixhd.train'
import Pix2PixHDLive from './views/pix2pixhd.live'

class router {
  componentWillMount(){
    actions.system.changeTool('pix2pixhd')
    document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #def, #dfe)'
  }
  componentWillReceiveProps(){
    actions.system.changeTool('pix2pixhd')
    document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #def, #dfe)'
  }
  render(){
    return (
      <section>
        <Route exact path='/pix2pixhd/new/' component={Pix2PixHDNew} />
        <Route exact path='/pix2pixhd/sequences/' component={Pix2PixHDShow} />
        <Route exact path='/pix2pixhd/sequences/:id/' component={Pix2PixHDShow} />
        <Route exact path='/pix2pixhd/train/' component={Pix2PixHDTrain} />
        <Route exact path='/pix2pixhd/results/' component={Pix2PixHDResults} />
        <Route exact path='/pix2pixhd/live/' component={Pix2PixHDLive} />
      </section>
    )
  }
}

function links(){
  return [
    { url: '/pix2pixhd/new/', name: 'folders' },
    { url: '/pix2pixhd/sequences/', name: 'sequences' },
    { url: '/pix2pixhd/train/', name: 'checkpoints' },
    { url: '/pix2pixhd/results/', name: 'results' },
    { url: '/pix2pixhd/live/', name: 'live' },
  ]
}

export default {
  name: 'pix2pixhd',
  router, links,
}