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) { onFileInfoUpdate: function(fileInfo) {
this.setState({ if (this.isMounted) {
fileInfo: fileInfo, this.setState({
}); fileInfo: fileInfo,
});
}
}, },
componentDidMount: function() { componentDidMount: function() {
this._isMounted = true; this._isMounted = true;

View file

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

View file

@ -75,6 +75,12 @@ export let FileListPublished = React.createClass({
document.title = "Published Files"; document.title = "Published Files";
lbry.getMyClaims((claimInfos) => { 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 * 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 * 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) { else if (!this.state.fileInfos.length) {
return ( return (
<main className="page"> <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> </main>
); );
} }

View file

@ -67,7 +67,7 @@ var HelpPage = React.createClass({
<section className="card"> <section className="card">
<h3>Report a Bug</h3> <h3>Report a Bug</h3>
<p>Did you find something wrong?</p> <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> <div className="meta">Thanks! LBRY is made by its users.</div>
</section> </section>
{!ver ? null : {!ver ? null :

View file

@ -152,7 +152,7 @@ var DetailPage = React.createClass({
) : ( ) : (
<div> <div>
<h2>No content</h2> <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> </div>
)} )}
</section> </section>

View file

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