mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
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:;',
|
var href = this.props.href ? this.props.href : 'javascript:;',
|
||||||
icon = this.props.icon ? <Icon icon={this.props.icon} /> : '',
|
icon = this.props.icon ? <Icon icon={this.props.icon} /> : '',
|
||||||
className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') +
|
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 (
|
return (
|
||||||
<a className={className} href={href} style={this.props.style ? this.props.style : {}} onClick={this.props.onClick}>
|
<a className={className} href={href} style={this.props.style ? this.props.style : {}} onClick={this.props.onClick}>
|
||||||
{this.props.icon ? icon : '' }
|
{this.props.icon ? icon : '' }
|
||||||
|
|
|
@ -87,6 +87,21 @@ var searchRowImgStyle = {
|
||||||
|
|
||||||
|
|
||||||
var SearchResultRow = React.createClass({
|
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() {
|
render: function() {
|
||||||
var displayURI = 'lbry://' + this.props.name;
|
var displayURI = 'lbry://' + this.props.name;
|
||||||
|
|
||||||
|
@ -111,7 +126,8 @@ var SearchResultRow = React.createClass({
|
||||||
<p style={searchRowDescriptionStyle}>{this.props.description}</p>
|
<p style={searchRowDescriptionStyle}>{this.props.description}</p>
|
||||||
<div>
|
<div>
|
||||||
<Link href={linkURI} label="Watch" icon="icon-play" button="primary" />
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,6 +44,11 @@ header
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
input[type="search"]
|
input[type="search"]
|
||||||
{
|
{
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
|
|
Loading…
Add table
Reference in a new issue