From f9bacec62aa065f2634fc760f24411411e1c5cc9 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 16 Jun 2016 17:29:45 +0200 Subject: [PATCH] Fix ESLint errors with nav bar and notifications --- js/components/header.js | 12 ++++++------ js/components/header_notifications.js | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/js/components/header.js b/js/components/header.js index 070e5555..c0265062 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -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 ( - Whitelabel brand + Whitelabel brand ); } else { @@ -120,8 +120,8 @@ let Header = React.createClass({ ); - // 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({
@@ -169,7 +169,7 @@ let Header = React.createClass({ diff --git a/js/components/header_notifications.js b/js/components/header_notifications.js index 1c65fdd5..8dfa6206 100644 --- a/js/components/header_notifications.js +++ b/js/components/header_notifications.js @@ -62,7 +62,7 @@ let HeaderNotifications = React.createClass({
{`${(isPiece ? 'Artworks' : 'Editions')} (${notifications.length})`}
- {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({ - + ({numNotifications}) }> @@ -124,10 +123,14 @@ let NotificationListItem = React.createClass({ pieceOrEdition: React.PropTypes.object, }, - getNotificationText(){ + getNotificationText() { let numNotifications = null; - if (this.props.notification.length > 1){ - numNotifications =
+ {this.props.notification.length - 1} {getLangText('more...')}
; + if (this.props.notification.length > 1) { + numNotifications = ( +
+ + {this.props.notification.length - 1} {getLangText('more...')} +
+ ); } return (
@@ -137,17 +140,19 @@ let NotificationListItem = React.createClass({ }, render() { - if (this.props.pieceOrEdition) { + const { pieceOrEdition } = this.props; + + if (pieceOrEdition) { return (
- +
-

{this.props.pieceOrEdition.title}

-
by {this.props.pieceOrEdition.artist_name}
+

{pieceOrEdition.title}

+
by {pieceOrEdition.artist_name}
{this.getNotificationText()}