Merge pull request #185 from lbryio/misc-bugfixes-2

Misc. bugfixes, round 2
This commit is contained in:
alexliebowitz 2017-02-24 04:23:13 -05:00 committed by GitHub
commit 7bce94b10d
6 changed files with 25 additions and 12 deletions

View file

@ -252,9 +252,11 @@ export let FileActions = React.createClass({
});
},
onFileInfoUpdate: function(fileInfo) {
this.setState({
fileInfo: fileInfo,
});
if (this.isMounted) {
this.setState({
fileInfo: fileInfo,
});
}
},
componentDidMount: function() {
this._isMounted = true;

View file

@ -42,7 +42,7 @@ export let DropDownMenu = React.createClass({
window.removeEventListener('click', this.handleWindowClick, false);
}
},
onMenuIconClick: function(e) {
handleMenuIconClick: function(e) {
this.setState({
menuOpen: !this.state.menuOpen,
});
@ -53,6 +53,12 @@ export let DropDownMenu = React.createClass({
}
return false;
},
handleMenuClick: function(e) {
// Event bubbles up to the menu after a link is clicked
this.setState({
menuOpen: false,
});
},
handleWindowClick: function(e) {
if (this.state.menuOpen &&
(!this._menuDiv || !this._menuDiv.contains(e.target))) {
@ -68,9 +74,9 @@ export let DropDownMenu = React.createClass({
}
return (
<div className="menu-container">
<Link ref={(span) => this._menuButton = span} button="text" icon="icon-ellipsis-v" onClick={this.onMenuIconClick} />
<Link ref={(span) => this._menuButton = span} button="text" icon="icon-ellipsis-v" onClick={this.handleMenuIconClick} />
{this.state.menuOpen
? <div ref={(div) => this._menuDiv = div} className="menu">
? <div ref={(div) => this._menuDiv = div} className="menu" onClick={this.handleMenuClick}>
{this.props.children}
</div>
: null}

View file

@ -75,6 +75,12 @@ export let FileListPublished = React.createClass({
document.title = "Published Files";
lbry.getMyClaims((claimInfos) => {
if (claimInfos.length == 0) {
this.setState({
fileInfos: [],
});
}
/**
* Build newFileInfos as a sparse array and drop elements in at the same position they
* occur in claimInfos, so the order is preserved even if the API calls inside this loop
@ -116,7 +122,7 @@ export let FileListPublished = React.createClass({
else if (!this.state.fileInfos.length) {
return (
<main className="page">
<span>You haven't published anything to LBRY yet.</span> Try <Link href="/?publish" label="publishing" />!
<span>You haven't published anything to LBRY yet.</span> Try <Link href="index.html?publish" label="publishing" />!
</main>
);
}

View file

@ -67,7 +67,7 @@ var HelpPage = React.createClass({
<section className="card">
<h3>Report a Bug</h3>
<p>Did you find something wrong?</p>
<p><Link href="/?report" label="Submit a Bug Report" icon="icon-bug" button="alt" /></p>
<p><Link href="index.html?report" label="Submit a Bug Report" icon="icon-bug" button="alt" /></p>
<div className="meta">Thanks! LBRY is made by its users.</div>
</section>
{!ver ? null :

View file

@ -152,7 +152,7 @@ var DetailPage = React.createClass({
) : (
<div>
<h2>No content</h2>
There is no content available at the name <strong>lbry://{this.props.name}</strong>. If you reached this page from a link within the LBRY interface, please <Link href="/?report" label="report a bug" />. Thanks!
There is no content available at the name <strong>lbry://{this.props.name}</strong>. If you reached this page from a link within the LBRY interface, please <Link href="index.html?report" label="report a bug" />. Thanks!
</div>
)}
</section>

View file

@ -12,14 +12,13 @@ $border-radius-menu: 2px;
background-color: white;
box-shadow: $default-box-shadow;
border-radius: $border-radius-menu;
padding-top: $spacing-vertical / 2;
padding-bottom: $spacing-vertical / 2;
padding-top: ($spacing-vertical / 5) 0px;
z-index: 1;
}
.menu__menu-item {
display: block;
padding: $spacing-vertical / 4 $spacing-vertical / 2;
padding: ($spacing-vertical / 4) ($spacing-vertical / 2);
&:hover {
background: $color-bg-alt;
}