From 0b3dc585a0b02a3426b45f5cd474f81a31d5bd7b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 16 Jan 2019 02:05:42 +0100 Subject: uprez ui --- .../modules/pix2pixhd/views/pix2pixhd.uprez.js | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 app/client/modules/pix2pixhd/views/pix2pixhd.uprez.js (limited to 'app/client/modules/pix2pixhd/views') diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.uprez.js b/app/client/modules/pix2pixhd/views/pix2pixhd.uprez.js new file mode 100644 index 0000000..b26eae9 --- /dev/null +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.uprez.js @@ -0,0 +1,114 @@ +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 pix2pixhdActions from '../pix2pixhd.actions' +import * as pix2pixhdTasks from '../pix2pixhd.tasks' + +import Loading from '../../../common/loading.component' +import { FileList, FileRow } from '../../../common/fileList.component' + +let yes_count = 0 + +class Pix2pixHDUprez extends Component { + constructor(props){ + super() + if (!props.pix2pixhd.uprez) props.actions.load_uprez() + } + componentDidMount(){ + yes_count = 0 + } + render(){ + if (! this.props.pix2pixhd.uprez) return + + const { resultsFolder, results, renders, files } = this.props.pix2pixhd.uprez + // console.log(resultsFolder, results) + + return ( +
+
+

Pix2PixHD Uprez

+
+
+ +

folders on server

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + options={file => { + console.log(file) + // create uprez task + return ( + + ) + }} + /> +
+ +

uprezzed videos

+ { + 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) + } + }} + /> + +
+
+ ) + } + handlePick(file){ + // this.props.audioPlayer.play(file) + } + handleUprez(file, opt){ + console.log(file) + this.props.remote.uprez_task({ + is_result: true, + dataset: file.name, + ...opt + }) + } +} + +const mapStateToProps = state => ({ + pix2pixhd: state.module.pix2pixhd, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(pix2pixhdActions, dispatch), + remote: bindActionCreators(pix2pixhdTasks, dispatch), + // audioPlayer: bindActionCreators(audioPlayerActions, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Pix2pixHDUprez) -- cgit v1.2.3-70-g09d2