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

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

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

import BigGANNew from './views/biggan.new'
import BigGANShow from './views/biggan.show'
import BigGANResults from './views/biggan.results'
import BigGANLive from './views/biggan.live'

class router {
  componentWillMount(){
    actions.system.changeTool('biggan')
    document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #dfe, #def)'
  }
  componentWillReceiveProps(){
    actions.system.changeTool('biggan')
    document.body.style.backgroundImage = 'linear-gradient(' + (util.randint(40)+40) + 'deg, #dfe, #def)'
  }
  render(){
    return (
      <section>
        <Route exact path='/biggan/new/' component={BigGANNew} />
        <Route exact path='/biggan/datasets/' component={BigGANShow} />
        <Route exact path='/biggan/datasets/:id/' component={BigGANShow} />
        <Route exact path='/biggan/results/' component={BigGANResults} />
        <Route exact path='/biggan/live/' component={BigGANLive} />
      </section>
    )
  }
}

function links(){
  return [
    { url: '/biggan/new/', name: 'folders' },
    { url: '/biggan/datasets/', name: 'datasets' },
    { url: '/biggan/results/', name: 'results' },
    { url: '/biggan/live/', name: 'live' },
  ]
}

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