diff options
Diffstat (limited to 'app/client/modules/biggan/views')
| -rw-r--r-- | app/client/modules/biggan/views/biggan.encodingList.js | 68 | ||||
| -rw-r--r-- | app/client/modules/biggan/views/biggan.live.js | 4 |
2 files changed, 72 insertions, 0 deletions
diff --git a/app/client/modules/biggan/views/biggan.encodingList.js b/app/client/modules/biggan/views/biggan.encodingList.js new file mode 100644 index 0000000..d041e2e --- /dev/null +++ b/app/client/modules/biggan/views/biggan.encodingList.js @@ -0,0 +1,68 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import { + Loading +} from '../../../common/' + +import actions from '../../../actions' +import * as bigganTasks from '../biggan.tasks' +import * as bigganActions from '../biggan.actions' + +const ALL_CATEGORIES = 'inversion/categories/biggan_all.json' + +class BigGANEncodingList extends Component { + constructor() { + super() + if (!this.props.encodings) { + this.actions.biggan.load_encodings() + } + } + + render() { + const { encodings } = this.props + if (!encodings) { + return <div>Loading encodings...</div> + } + return ( + <div> + <div> + <select> + </select> + </div> + <div className="categories" ref={ref => this.categoryRef = ref}> + {Object.keys(encodings).sort().map(name => { + return ( + <div key={name}> + {encodings[name].map(file => ( + <img + key={file.id} + src={file.url} + onClick={() => actions.live.send_command('setEncoding', 'id=' + file.id)} + /> + ))} + </div> + ) + })} + </div> + </div> + ) + } + +} + +const mapStateToProps = state => ({ + opt: state.live.opt, + frame: state.live.frame, + biggan: state.module.biggan, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: { + biggan: bindActionCreators(bigganActions, dispatch), + tasks: bindActionCreators(bigganTasks, dispatch), + } +}) + +export default connect(mapStateToProps, mapDispatchToProps)(BigGANCategoryList) diff --git a/app/client/modules/biggan/views/biggan.live.js b/app/client/modules/biggan/views/biggan.live.js index af1edea..8d4a234 100644 --- a/app/client/modules/biggan/views/biggan.live.js +++ b/app/client/modules/biggan/views/biggan.live.js @@ -14,6 +14,7 @@ import * as queueActions from '../../../queue/queue.actions' import * as bigganTasks from '../biggan.tasks' import * as bigganActions from '../biggan.actions' import BigGANCategoryList from './biggan.categoryList.js' +import BigGANEncodingList from './biggan.encodingList.js' class BigGANLive extends Component { constructor(props) { @@ -120,6 +121,9 @@ class BigGANLive extends Component { <div className='params column'> <BigGANCategoryList /> </div> + <div className='params column'> + <BigGANEncodingList /> + </div> </div> </div> ) |
