From 1baa16f7a6ee679f556896314cb9c5f372fc9089 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Jan 2020 01:46:43 +0100 Subject: encoding list --- .../modules/biggan/views/biggan.encodingList.js | 68 ++++++++++++++++++++++ app/client/modules/biggan/views/biggan.live.js | 4 ++ 2 files changed, 72 insertions(+) create mode 100644 app/client/modules/biggan/views/biggan.encodingList.js (limited to 'app/client/modules/biggan/views') 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
Loading encodings...
+ } + return ( +
+
+ +
+
this.categoryRef = ref}> + {Object.keys(encodings).sort().map(name => { + return ( +
+ {encodings[name].map(file => ( + actions.live.send_command('setEncoding', 'id=' + file.id)} + /> + ))} +
+ ) + })} +
+
+ ) + } + +} + +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 {
+
+ +
) -- cgit v1.2.3-70-g09d2