remove downloads frontend

This commit is contained in:
SpikeHD
2022-05-12 21:20:43 -07:00
parent f9f3461da5
commit 2bcb68ba32
3 changed files with 18 additions and 4 deletions

View File

@@ -3,10 +3,11 @@ import { capitalize } from '../../../utils/string'
import Stop from '../../../resources/icons/close.svg'
import './ProgressBar.css'
import DownloadHandler from '../../../utils/download'
interface IProps {
path: string,
downloadManager: any,
downloadManager: DownloadHandler,
}
interface IState {
@@ -31,7 +32,7 @@ export default class ProgressBar extends React.Component<IProps, IState> {
const intv = setInterval(() => {
const prog = this.props.downloadManager.getDownloadProgress(this.props.path)
this.setState({
progress: parseInt(prog?.progress || 0, 10),
progress: prog?.progress || 0,
status: prog?.status || 'error',
total: prog?.total || 0,
})
@@ -43,6 +44,10 @@ export default class ProgressBar extends React.Component<IProps, IState> {
}, 500)
}
stopDownload() {
this.props.downloadManager.stopDownload(this.props.path)
}
render() {
return (
<div className="ProgressBarWrapper">
@@ -66,7 +71,7 @@ export default class ProgressBar extends React.Component<IProps, IState> {
}}></div>
</div>
<div className="DownloadControls">
<div>
<div onClick={this.stopDownload}>
<img src={Stop}></img>
</div>
</div>