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);
}
if (whitelabel.subdomain && whitelabel.subdomain !== 'www' && whitelabel.logo){
if (whitelabel.subdomain && whitelabel.subdomain !== 'www' && whitelabel.logo) {
return (
<Link to="/collection">
<img className="img-brand" src={whitelabel.logo} alt="Whitelabel brand"/>
<img alt="Whitelabel brand" className="img-brand" src={whitelabel.logo} />
</Link>
);
} else {
@ -120,8 +120,8 @@ let Header = React.createClass({
</DropdownButton>
);
// Let's assume that if the piece list hasn't loaded yet (ie. when unfilteredPieceListCount === -1)
// then the user has pieces
// Let's assume that if the piece list hasn't loaded yet (ie. when
// unfilteredPieceListCount === -1) then the user has pieces.
// 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
// they actually click on it and get redirected to piece registration.
@ -154,7 +154,7 @@ let Header = React.createClass({
<div>
<Navbar
ref="navbar"
fixedTop={true}
fixedTop
className="hidden-print">
<Navbar.Header>
<Navbar.Brand>
@ -169,7 +169,7 @@ let Header = React.createClass({
</Navbar.Header>
<Navbar.Collapse>
<Nav navbar pullRight>
<HeaderNotificationDebug show={false}/>
<HeaderNotificationDebug show={false} />
{account}
{signup}
</Nav>

View File

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