diff --git a/grassclipper.zip b/grassclipper.zip new file mode 100644 index 0000000..bebbaab Binary files /dev/null and b/grassclipper.zip differ diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 82f985a..cd3cf56 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -13,6 +13,7 @@ import { getConfig, saveConfig } from '../utils/configuration' import Topbar from './components/TopBar' import BigButton from './components/common/BigButton' import Checkbox from './components/common/Checkbox' +import ProgressBar from './components/common/ProgressBar' const downloadHandler = new DownloadHandler() @@ -60,6 +61,16 @@ function App() { + +
+ + + +
) diff --git a/src/ui/components/common/BigButton.tsx b/src/ui/components/common/BigButton.tsx index e89f09f..55d3e2b 100644 --- a/src/ui/components/common/BigButton.tsx +++ b/src/ui/components/common/BigButton.tsx @@ -12,8 +12,7 @@ interface IState { } export default class BigButton extends React.Component { - - constructor(props: { text: string, onClick: () => any, id: string }) { + constructor(props: IProps) { super(props) this.state = { diff --git a/src/ui/components/common/ProgressBar.css b/src/ui/components/common/ProgressBar.css new file mode 100644 index 0000000..e69de29 diff --git a/src/ui/components/common/ProgressBar.tsx b/src/ui/components/common/ProgressBar.tsx new file mode 100644 index 0000000..45b4bff --- /dev/null +++ b/src/ui/components/common/ProgressBar.tsx @@ -0,0 +1,52 @@ +import React from 'react' + +interface IProps { + path: string, + downloadManager: any, +} + +interface IState { + progress: number, + status: string, + total: number, +} + +export default class ProgressBar extends React.Component { + constructor(props: IProps) { + super(props) + + this.state = { + progress: 0, + status: '', + total: this.props.downloadManager.getDownloadProgress(this.props.path).total, + } + } + + componentDidMount() { + // Periodically check the progress of passed file path + const intv = setInterval(() => { + const prog = this.props.downloadManager.getDownloadProgress(this.props.path) + this.setState({ + progress: prog.progress, + status: prog.status, + }) + + if (prog.status === 'finished') { + clearInterval(intv) + } + }, 100) + } + + render() { + return ( +
+
+
+ {this.state.status} +
+
+ ) + } +} \ No newline at end of file