import Centered from './Centered'
import ChromeNotice from './ChromeNotice'
import DownloadActions from '../actions/DownloadActions'
import DownloadButton from './DownloadButton'
import DownloadStore from '../stores/DownloadStore'
import ProgressBar from './ProgressBar'
import React from 'react'
import Spinner from './Spinner'
import peer from 'filepizza-peerjs'
export default class DownloadPage extends React.Component {
constructor() {
this.state = DownloadStore.getState()
this._onChange = () => {
this.setState(DownloadStore.getState())
}
this._onConnection = (conn) => {
DownloadActions.beginDownload(conn)
}
}
componentDidMount() {
DownloadStore.listen(this._onChange)
peer.on('connection', this._onConnection)
}
componentDidUnmount() {
DownloadStore.unlisten(this._onChange)
peer.removeListener('connection', this._onConnection)
}
downloadFile() {
DownloadActions.requestDownload()
}
render() {
switch (this.state.status) {
case 'ready':
return
FilePizza
case 'requesting':
case 'downloading':
return
FilePizza
case 'cancelled':
return
FilePizza
case 'done':
return
FilePizza
}
}
}