From ee2471bb4ad8e190c1f2c1c47817046a2c4d6b30 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 3 Jan 2020 15:35:26 +0100 Subject: adding biggan dataset stuff --- app/client/modules/biggan/views/biggan.results.js | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 app/client/modules/biggan/views/biggan.results.js (limited to 'app/client/modules/biggan/views/biggan.results.js') diff --git a/app/client/modules/biggan/views/biggan.results.js b/app/client/modules/biggan/views/biggan.results.js new file mode 100644 index 0000000..d76b301 --- /dev/null +++ b/app/client/modules/biggan/views/biggan.results.js @@ -0,0 +1,105 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { Link } from 'react-router-dom'; +import { connect } from 'react-redux' +import util from '../../../util' + +import actions from '../../../actions' + +import * as bigganActions from '../biggan.actions' +import * as bigganTasks from '../biggan.tasks' + +import Loading from '../../../common/loading.component' +import { FileList, FileRow } from '../../../common/fileList.component' + +let yes_count = 0 + +class BigGANResults extends Component { + constructor(props){ + super() + if (!props.biggan.results) props.actions.load_results() + } + componentDidMount(){ + yes_count = 0 + } + render(){ + if (! this.props.biggan.results) return + + const { resultsFolder, results, renders, files } = this.props.biggan.results + // console.log(resultsFolder, results) + + return ( +
+
+

BigGAN Results

+
+
+ + { + let yes; + if (yes_count < 3) { + yes = confirm('Are you sure you want to delete this file?') + } else { + yes = true + } + if (yes) { + yes_count += 1 + console.log('delete: confirmed') + actions.file.destroy(file) + } + }} + /> +
+ +

renders on server

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> +
+ +

folders on server

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> + +
+
+ ) + } + handlePick(file){ + // this.props.audioPlayer.play(file) + } +} + +const mapStateToProps = state => ({ + biggan: state.module.biggan, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(bigganActions, dispatch), + remote: bindActionCreators(bigganTasks, dispatch), + // audioPlayer: bindActionCreators(audioPlayerActions, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(bigganResults) -- cgit v1.2.3-70-g09d2