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)
}
}}
/>
)
}
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)