Fix "Download" link; also notify user and disable link on click.
This commit is contained in:
parent
80fdf2fd5f
commit
0c3cc55a31
3 changed files with 23 additions and 2 deletions
|
@ -16,7 +16,7 @@ var Link = React.createClass({
|
|||
var href = this.props.href ? this.props.href : 'javascript:;',
|
||||
icon = this.props.icon ? <Icon icon={this.props.icon} /> : '',
|
||||
className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') +
|
||||
(this.props.hidden ? ' hidden' : '');
|
||||
(this.props.hidden ? ' hidden' : '') + (this.props.disabled ? ' disabled' : '');
|
||||
return (
|
||||
<a className={className} href={href} style={this.props.style ? this.props.style : {}} onClick={this.props.onClick}>
|
||||
{this.props.icon ? icon : '' }
|
||||
|
|
|
@ -87,6 +87,21 @@ var searchRowImgStyle = {
|
|||
|
||||
|
||||
var SearchResultRow = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
downloading: false
|
||||
}
|
||||
},
|
||||
startDownload: function() {
|
||||
if (!this.state.downloading) {
|
||||
this.setState({
|
||||
downloading: true
|
||||
});
|
||||
lbry.getStream(this.props.name, (streamInfo) => {
|
||||
alert('Downloading ' + this.props.title + ' to ' + streamInfo.path);
|
||||
});
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
var displayURI = 'lbry://' + this.props.name;
|
||||
|
||||
|
@ -111,7 +126,8 @@ var SearchResultRow = React.createClass({
|
|||
<p style={searchRowDescriptionStyle}>{this.props.description}</p>
|
||||
<div>
|
||||
<Link href={linkURI} label="Watch" icon="icon-play" button="primary" />
|
||||
<Link href={linkURI} label="Download" icon="icon-download" button="alt" />
|
||||
<Link onClick={this.startDownload} label={this.state.downloading ? "Downloading" : "Download"}
|
||||
disabled={this.state.downloading} icon="icon-download" button="alt" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,6 +44,11 @@ header
|
|||
display: none;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
input[type="search"]
|
||||
{
|
||||
border: 0 none;
|
||||
|
|
Loading…
Reference in a new issue