From c7f272c3a3d58fdff39ed2e6e3e3266aa34c83af Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 17 Dec 2015 17:31:33 +0100 Subject: [PATCH] Small fixes for DRY and React warnings --- .../accordion_list_item_piece.js | 5 ++++- .../accordion_list_item_prize.js | 16 +++++++++------- .../components/prize_settings_container.js | 7 ++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/js/components/ascribe_accordion_list/accordion_list_item_piece.js b/js/components/ascribe_accordion_list/accordion_list_item_piece.js index 006479c5..7c6b63a9 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_piece.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_piece.js @@ -12,7 +12,10 @@ import { getLangText } from '../../utils/lang_utils'; let AccordionListItemPiece = React.createClass({ propTypes: { className: React.PropTypes.string, - artistName: React.PropTypes.string, + artistName: React.PropTypes.oneOfType([ + React.PropTypes.string, + React.PropTypes.element + ]), piece: React.PropTypes.object, children: React.PropTypes.oneOfType([ React.PropTypes.arrayOf(React.PropTypes.element), diff --git a/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js b/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js index 965b9012..3fc3f5fd 100644 --- a/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js +++ b/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js @@ -171,23 +171,25 @@ let AccordionListItemPrize = React.createClass({ }, render() { + const { children, className, content } = this.props; + const { currentUser } = this.state; + // Only show the artist name if you are the participant or if you are a judge and the piece is shortlisted - let artistName = ((this.state.currentUser.is_jury && !this.state.currentUser.is_judge) || - (this.state.currentUser.is_judge && !this.props.content.selected )) ? -