diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/common/header.component.js | 31 | ||||
| -rw-r--r-- | app/client/modules/pix2pix/pix2pix.actions.js | 4 | ||||
| -rw-r--r-- | app/client/system/system.reducer.js | 2 |
3 files changed, 26 insertions, 11 deletions
diff --git a/app/client/common/header.component.js b/app/client/common/header.component.js index 85e1895..11eb761 100644 --- a/app/client/common/header.component.js +++ b/app/client/common/header.component.js @@ -7,19 +7,26 @@ import * as systemActions from '../system/system.actions' import modules from '../modules' +function NavLink(props){ + if (! props.to) { + return <span>{props.children}</span> + } + let children = props.to === props.location.pathname ? <b>{props.children}</b> : props.children + return ( + <span><Link to={props.to}>{children}</Link></span> + ) +} + function Header(props){ - const { site, app, fps, playing, actions, location } = props + const { site, app, fps, playing, actions, location, history } = props const tool_list = Object.keys(modules).map((name, i) => { const label = name.replace(/_/, " ") return <option value={name} key={i}>{label}</option> }) const tool = modules[app.tool] const links = tool.links().map((link,i) => { - let name = link.url === location.pathname ? <b>{link.name}</b> : link.name return ( - <span key={i}> - {link.url ? <Link to={link.url}>{name}</Link> : name} - </span> + <NavLink key={i} location={location} to={link.url}>{link.name}</NavLink> ) }) return ( @@ -27,12 +34,20 @@ function Header(props){ {playing && <span>{fps} fps</span>} <span>{links}</span> <span> - <select onChange={e => actions.changeTool(e.target.value)} value={app.tool}> + <select onChange={e => { + let path = window.location.pathname.split("/") + path.shift() + console.log(path) + if (path[0] in modules && path[1]) { + history.push('/' + e.target.value + '/' + path[1] + '/') + } + actions.changeTool(e.target.value, true) + }} value={app.tool}> {tool_list} </select> </span> - <span><Link to="/system">system</Link></span> - <span><Link to="/dashboard">dashboard</Link></span> + <NavLink location={location} to="/system">system</NavLink> + <NavLink location={location} to="/dashboard">dashboard</NavLink> <b>{site.name} cortex</b> </header> ) diff --git a/app/client/modules/pix2pix/pix2pix.actions.js b/app/client/modules/pix2pix/pix2pix.actions.js index 2359ebf..50cceb6 100644 --- a/app/client/modules/pix2pix/pix2pix.actions.js +++ b/app/client/modules/pix2pix/pix2pix.actions.js @@ -35,11 +35,11 @@ export const load_directories = (id) => (dispatch) => { // console.log(datasetUsage) const sequenceDirectories = sequences.filter(s => s.dir) - console.log(sequenceDirectories) + // console.log(sequenceDirectories) sequenceDirectories.forEach(dir => { const dataset = datasetLoader.getDataset(module, datasetLookup, dir.name) dataset.isBuilt = true - console.log(dir.name, dataset) + // console.log(dir.name, dataset) }) datasets.filter(s => s.dir).forEach(dir => { diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js index b6c5a83..cc6fe6a 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -46,7 +46,7 @@ const systemInitialState = { const modules = ['pix2pix','samplernn','pix2wav'].reduce((a,b) => (a[b]=b,a),{}) const systemReducer = (state = systemInitialState, action) => { - console.log(action.type) + // console.log(action.type) let processor = null switch(action.type) { case types.socket.connect: |
