1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

Fix ESLint errors with nav bar and notifications

This commit is contained in:
Brett Sun 2016-06-16 17:29:45 +02:00
parent 8581131fc7
commit f9bacec62a
2 changed files with 21 additions and 16 deletions

View File

@ -59,10 +59,10 @@ let Header = React.createClass({
constructHead(whitelabel.head); constructHead(whitelabel.head);
} }
if (whitelabel.subdomain && whitelabel.subdomain !== 'www' && whitelabel.logo){ if (whitelabel.subdomain && whitelabel.subdomain !== 'www' && whitelabel.logo) {
return ( return (
<Link to="/collection"> <Link to="/collection">
<img className="img-brand" src={whitelabel.logo} alt="Whitelabel brand"/> <img alt="Whitelabel brand" className="img-brand" src={whitelabel.logo} />
</Link> </Link>
); );
} else { } else {
@ -120,8 +120,8 @@ let Header = React.createClass({
</DropdownButton> </DropdownButton>
); );
// Let's assume that if the piece list hasn't loaded yet (ie. when unfilteredPieceListCount === -1) // Let's assume that if the piece list hasn't loaded yet (ie. when
// then the user has pieces // unfilteredPieceListCount === -1) then the user has pieces.
// FIXME: this doesn't work that well as the user may not load their piece list // FIXME: this doesn't work that well as the user may not load their piece list
// until much later, so we would show the 'Collection' header as available until // until much later, so we would show the 'Collection' header as available until
// they actually click on it and get redirected to piece registration. // they actually click on it and get redirected to piece registration.
@ -154,7 +154,7 @@ let Header = React.createClass({
<div> <div>
<Navbar <Navbar
ref="navbar" ref="navbar"
fixedTop={true} fixedTop
className="hidden-print"> className="hidden-print">
<Navbar.Header> <Navbar.Header>
<Navbar.Brand> <Navbar.Brand>
@ -169,7 +169,7 @@ let Header = React.createClass({
</Navbar.Header> </Navbar.Header>
<Navbar.Collapse> <Navbar.Collapse>
<Nav navbar pullRight> <Nav navbar pullRight>
<HeaderNotificationDebug show={false}/> <HeaderNotificationDebug show={false} />
{account} {account}
{signup} {signup}
</Nav> </Nav>

View File

@ -62,7 +62,7 @@ let HeaderNotifications = React.createClass({
<div className="notification-header"> <div className="notification-header">
{`${(isPiece ? 'Artworks' : 'Editions')} (${notifications.length})`} {`${(isPiece ? 'Artworks' : 'Editions')} (${notifications.length})`}
</div> </div>
{notifications.map((notification, i) => { {notifications.map((notification) => {
const pieceOrEdition = isPiece ? notification.piece : notification.edition; const pieceOrEdition = isPiece ? notification.piece : notification.edition;
const href = isPiece ? `/pieces/${pieceOrEdition.id}` const href = isPiece ? `/pieces/${pieceOrEdition.id}`
: `/editions/${pieceOrEdition.bitcoin_id}`; : `/editions/${pieceOrEdition.bitcoin_id}`;
@ -101,10 +101,9 @@ let HeaderNotifications = React.createClass({
<DropdownButton <DropdownButton
ref='dropdownButton' ref='dropdownButton'
id="header-notification-dropdown" id="header-notification-dropdown"
eventKey="1"
title={ title={
<span> <span>
<Glyphicon glyph='envelope' color="green"/> <Glyphicon color="green" glyph="envelope" />
<span className="notification-amount">({numNotifications})</span> <span className="notification-amount">({numNotifications})</span>
</span> </span>
}> }>
@ -124,10 +123,14 @@ let NotificationListItem = React.createClass({
pieceOrEdition: React.PropTypes.object, pieceOrEdition: React.PropTypes.object,
}, },
getNotificationText(){ getNotificationText() {
let numNotifications = null; let numNotifications = null;
if (this.props.notification.length > 1){ if (this.props.notification.length > 1) {
numNotifications = <div>+ {this.props.notification.length - 1} {getLangText('more...')}</div>; numNotifications = (
<div>
+ {this.props.notification.length - 1} {getLangText('more...')}
</div>
);
} }
return ( return (
<div className="notification-action"> <div className="notification-action">
@ -137,17 +140,19 @@ let NotificationListItem = React.createClass({
}, },
render() { render() {
if (this.props.pieceOrEdition) { const { pieceOrEdition } = this.props;
if (pieceOrEdition) {
return ( return (
<div className="row notification-wrapper"> <div className="row notification-wrapper">
<div className="col-xs-4 clear-paddings"> <div className="col-xs-4 clear-paddings">
<div className="thumbnail-wrapper"> <div className="thumbnail-wrapper">
<img src={this.props.pieceOrEdition.thumbnail.url_safe}/> <img role="presentation" src={pieceOrEdition.thumbnail.url_safe} />
</div> </div>
</div> </div>
<div className="col-xs-8 notification-list-item-header"> <div className="col-xs-8 notification-list-item-header">
<h1>{this.props.pieceOrEdition.title}</h1> <h1>{pieceOrEdition.title}</h1>
<div className="sub-header">by {this.props.pieceOrEdition.artist_name}</div> <div className="sub-header">by {pieceOrEdition.artist_name}</div>
{this.getNotificationText()} {this.getNotificationText()}
</div> </div>
</div> </div>