diff --git a/js/component/link.js b/js/component/link.js
index 15d7f374e..cad6b5e60 100644
--- a/js/component/link.js
+++ b/js/component/link.js
@@ -169,22 +169,28 @@ export let DownloadLink = React.createClass({
deleteChecked: React.PropTypes.bool,
},
tryDownload: function() {
+ this.setState({
+ attemptingDownload: true,
+ });
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
lbry.getBalance((balance) => {
if (cost > balance) {
this.setState({
modal: 'notEnoughCredits',
+ attemptingDownload: false,
});
} else {
lbry.getStream(this.props.streamName, (streamInfo) => {
if (streamInfo === null || typeof streamInfo !== 'object') {
this.setState({
modal: 'timedOut',
+ attemptingDownload: false,
});
} else {
this.setState({
modal: 'downloadStarted',
filePath: streamInfo.path,
+ attemptingDownload: false,
});
}
});
@@ -227,6 +233,7 @@ export let DownloadLink = React.createClass({
modal: null,
menuOpen: false,
deleteChecked: false,
+ attemptingDownload: false,
}
},
closeModal: function() {
@@ -250,12 +257,9 @@ export let DownloadLink = React.createClass({
];
let linkBlock;
- if (this.props.state == 'not-started') {
- linkBlock = (
-
- );
- } else if (this.props.state == 'downloading') {
- const label = `${parseInt(this.props.progress * 100)}% complete`;
+ if (this.state.attemptingDownload || this.props.state == 'downloading') {
+ const progress = this.state.attemptingDownload ? 0 : this.props.progress;
+ const label = `${parseInt(progress * 100)}% complete`;
linkBlock = (
+ onClick={this.handleClick} style={{width: `${progress * 100}%`}}>
{dropDownItems}
);
+ } else if (this.props.state == 'not-started') {
+ linkBlock = (
+
+ );
} else if (this.props.state == 'done') {
linkBlock = (