From 2664eb3e474f5d03d1782c15673b774d68fb2c58 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 28 May 2018 13:06:54 +0200 Subject: textInput/fileUpload --- app/client/common/fileUpload.component.js | 28 +++++++++++++++++++++++++ app/client/common/header.component.js | 27 ++++++++++++++---------- app/client/common/textInput.component.js | 34 +++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 app/client/common/fileUpload.component.js create mode 100644 app/client/common/textInput.component.js (limited to 'app/client/common') diff --git a/app/client/common/fileUpload.component.js b/app/client/common/fileUpload.component.js new file mode 100644 index 0000000..5a1291c --- /dev/null +++ b/app/client/common/fileUpload.component.js @@ -0,0 +1,28 @@ +import { h, Component } from 'preact' + +class FileUpload extends Component { + constructor(props){ + super(props) + this.handleChange = this.handleChange.bind(this) + } + handleChange(e){ + this.props.onChange && this.props.onChange() + } + render() { + return ( +
+ +
+ ) + } +} + +export default FileUpload diff --git a/app/client/common/header.component.js b/app/client/common/header.component.js index 29c3713..5c1c145 100644 --- a/app/client/common/header.component.js +++ b/app/client/common/header.component.js @@ -1,36 +1,41 @@ import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' import { Link } from 'react-router-dom'; import { connect } from 'react-redux' -function Header(props) { - const tools = "pix2pix samplernn style_transfer_video style_transfer_audio".split(" ").map((s,i) => { - return +import * as systemActions from '../system/system.actions' + +import modules from '../modules' + +function Header({ fps, app, actions }) { + const tool_list = Object.keys(modules).map((name, i) => { + const label = name.replace(/_/, " ") + return }) + const Links = modules[app.tool].links return (
live cortex - actions.changeTool(e.target.value)} value={app.tool}> + {tool_list} system dashboard - checkpoints - datasets - results - live - {props.fps} fps + + {fps} fps
) } const mapStateToProps = state => ({ + app: state.system.app, fps: state.live.fps, - frame: state.live.frame, }) const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(systemActions, dispatch), }) export default connect(mapStateToProps, mapDispatchToProps)(Header) diff --git a/app/client/common/textInput.component.js b/app/client/common/textInput.component.js new file mode 100644 index 0000000..b3c4866 --- /dev/null +++ b/app/client/common/textInput.component.js @@ -0,0 +1,34 @@ +import { h, Component } from 'preact' + +class TextInput extends Component { + constructor(props){ + super(props) + this.handleInput = this.handleInput.bind(this) + this.handleKeydown = this.handleKeydown.bind(this) + } + handleInput(e){ + this.props.onInput && this.props.onInput(e.target.value) + } + handleKeydown(e){ + if (e.keyCode === 13) { + this.props.onSave && this.props.onSave(e.target.value) + } + } + render() { + return ( +
+ +
+ ) + } +} + +export default TextInput -- cgit v1.2.3-70-g09d2