Merge pull request #142 from lbryio/unavailable-content-bugfixes
Unavailable content bugfixes
This commit is contained in:
commit
d95e04104f
7 changed files with 38 additions and 13 deletions
|
@ -176,7 +176,7 @@ let FileActionsRow = React.createClass({
|
||||||
const
|
const
|
||||||
progress = this.state.fileInfo ? this.state.fileInfo.written_bytes / this.state.fileInfo.total_bytes * 100 : 0,
|
progress = this.state.fileInfo ? this.state.fileInfo.written_bytes / this.state.fileInfo.total_bytes * 100 : 0,
|
||||||
label = this.state.fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...',
|
label = this.state.fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...',
|
||||||
labelWithIcon = <span className="button__content"><Icon icon="icon-download" />{label}</span>;
|
labelWithIcon = <span className="button__content"><Icon icon="icon-download" /><span>{label}</span></span>;
|
||||||
|
|
||||||
linkBlock = (
|
linkBlock = (
|
||||||
<div className="faux-button-block file-actions__download-status-bar">
|
<div className="faux-button-block file-actions__download-status-bar">
|
||||||
|
@ -185,7 +185,7 @@ let FileActionsRow = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
linkBlock = <Link button="text" label="Open" icon="icon-folder-open" onClick={this.onOpenClick} />;
|
linkBlock = <Link label="Open" icon="icon-folder-open" onClick={this.onOpenClick} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -263,7 +263,7 @@ export let FileActions = React.createClass({
|
||||||
<div className="button-container empty">This file is not currently available.</div>
|
<div className="button-container empty">This file is not currently available.</div>
|
||||||
<div className="button-container">
|
<div className="button-container">
|
||||||
<ToolTip label="Why?"
|
<ToolTip label="Why?"
|
||||||
body="The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment" />
|
body="The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment." />
|
||||||
</div>
|
</div>
|
||||||
<div className="button-container">
|
<div className="button-container">
|
||||||
<Link label="Try Anyway" className="button-text" onClick={this.onShowFileActionsRowClicked} />
|
<Link label="Try Anyway" className="button-text" onClick={this.onShowFileActionsRowClicked} />
|
||||||
|
|
|
@ -28,26 +28,27 @@ export let Link = React.createClass({
|
||||||
/* The way the class name is generated here is a mess -- refactor */
|
/* The way the class name is generated here is a mess -- refactor */
|
||||||
|
|
||||||
const className = (this.props.className || '') +
|
const className = (this.props.className || '') +
|
||||||
(this.props.button ? ' button-block button-' + this.props.button : '') +
|
(!this.props.className && !this.props.button ? 'button-block button-text' : '') + // Non-button links get the same look as text buttons
|
||||||
|
(this.props.button ? 'button-block button-' + this.props.button : '') +
|
||||||
(this.props.disabled ? ' disabled' : '');
|
(this.props.disabled ? ' disabled' : '');
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
if (this.props.children) { // Custom content
|
if (this.props.children) { // Custom content
|
||||||
content = this.props.children;
|
content = this.props.children;
|
||||||
} else {
|
} else {
|
||||||
content = [
|
content = (
|
||||||
'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null,
|
<span {... 'button' in this.props ? {className: 'button__content'} : {}}>
|
||||||
<span className="link-label">{this.props.label}</span>,
|
{'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null}
|
||||||
'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null,
|
{<span className="link-label">{this.props.label}</span>}
|
||||||
];
|
{'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
|
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
|
||||||
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
|
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
|
||||||
{('button' in this.props) && this.props.button != 'text'
|
{content}
|
||||||
? <span className="button__content">{content}</span>
|
|
||||||
: content}
|
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
14
js/lbry.js
14
js/lbry.js
|
@ -5,6 +5,7 @@ var lbry = {
|
||||||
rootPath: '.',
|
rootPath: '.',
|
||||||
daemonConnectionString: 'http://localhost:5279/lbryapi',
|
daemonConnectionString: 'http://localhost:5279/lbryapi',
|
||||||
webUiUri: 'http://localhost:5279',
|
webUiUri: 'http://localhost:5279',
|
||||||
|
peerListTimeout: 6000,
|
||||||
colors: {
|
colors: {
|
||||||
primary: '#155B4A'
|
primary: '#155B4A'
|
||||||
},
|
},
|
||||||
|
@ -190,7 +191,18 @@ lbry.getTotalCost = function(name, size, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getPeersForBlobHash = function(blobHash, callback) {
|
lbry.getPeersForBlobHash = function(blobHash, callback) {
|
||||||
lbry.call('get_peers_for_hash', { blob_hash: blobHash }, callback)
|
let timedOut = false;
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
timedOut = true;
|
||||||
|
callback([]);
|
||||||
|
}, lbry.peerListTimeout);
|
||||||
|
|
||||||
|
lbry.call('peer_list', { blob_hash: blobHash }, function(peers) {
|
||||||
|
if (!timedOut) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
callback(peers);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
lbry.getCostInfoForName = function(name, callback) {
|
lbry.getCostInfoForName = function(name, callback) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
$spacing-vertical: 24px;
|
$spacing-vertical: 24px;
|
||||||
|
|
||||||
$padding-button: 12px;
|
$padding-button: 12px;
|
||||||
|
$padding-text-link: 4px;
|
||||||
|
|
||||||
$color-primary: #155B4A;
|
$color-primary: #155B4A;
|
||||||
$color-light-alt: hsl(hue($color-primary), 15, 85);
|
$color-light-alt: hsl(hue($color-primary), 15, 85);
|
||||||
|
|
|
@ -198,6 +198,10 @@ input[type="text"], input[type="search"]
|
||||||
{
|
{
|
||||||
@include text-link();
|
@include text-link();
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
.button__content {
|
||||||
|
margin: 0 $padding-text-link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.button-text-help
|
.button-text-help
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,12 @@ $color-download: #444;
|
||||||
min-height: $height-button;
|
min-height: $height-button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.file-actions__download-status-bar, .file-actions__download-status-bar-overlay {
|
||||||
|
.button__content {
|
||||||
|
margin: 0 $padding-text-link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.file-actions__download-status-bar
|
.file-actions__download-status-bar
|
||||||
{
|
{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -10,6 +10,7 @@ $border-radius-menu: 2px;
|
||||||
border-radius: $border-radius-menu;
|
border-radius: $border-radius-menu;
|
||||||
padding-top: $spacing-vertical / 2;
|
padding-top: $spacing-vertical / 2;
|
||||||
padding-bottom: $spacing-vertical / 2;
|
padding-bottom: $spacing-vertical / 2;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu__menu-item {
|
.menu__menu-item {
|
||||||
|
|
Loading…
Reference in a new issue