import ChromeNotice from './ChromeNotice' import DownloadActions from '../actions/DownloadActions' import DownloadButton from './DownloadButton' import DownloadStore from '../stores/DownloadStore' import ErrorPage from './ErrorPage' import ProgressBar from './ProgressBar' import React from 'react' import Spinner from './Spinner' import { formatSize } from '../util' export default class DownloadPage extends React.Component { constructor() { super() this.state = DownloadStore.getState() this._onChange = () => { this.setState(DownloadStore.getState()) } } componentDidMount() { DownloadStore.listen(this._onChange) } componentDidUnmount() { DownloadStore.unlisten(this._onChange) } downloadFile() { DownloadActions.requestDownload() } render() { switch (this.state.status) { case 'ready': return

FilePizza

Peers: {this.state.peers} · Up: {formatSize(this.state.speedUp)} · Down: {formatSize(this.state.speedDown)}

case 'requesting': case 'downloading': return

FilePizza

Peers: {this.state.peers} · Up: {formatSize(this.state.speedUp)} · Down: {formatSize(this.state.speedDown)}

case 'done': return

FilePizza

Peers: {this.state.peers} · Up: {formatSize(this.state.speedUp)} · Down: {formatSize(this.state.speedDown)}

default: return } } }