Search: Conditionally display hashtag features, fixes #142

This commit is contained in:
Alex Gleason 2020-06-07 14:09:33 -05:00
parent 71a980bf81
commit d772608df4
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 6 additions and 6 deletions

View file

@ -12,16 +12,16 @@ const Hashtag = ({ hashtag }) => (
#<span>{hashtag.get('name')}</span> #<span>{hashtag.get('name')}</span>
</Permalink> </Permalink>
<div className='trends__item__count'> {hashtag.get('history') && <div className='trends__item__count'>
<FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <strong>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</strong> }} /> <FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <strong>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</strong> }} />
</div> </div>}
</div> </div>
<div className='trends__item__sparkline'> {hashtag.get('history') && <div className='trends__item__sparkline'>
<Sparklines width={50} height={28} data={hashtag.get('history').reverse().map(day => day.get('uses')).toArray()}> <Sparklines width={50} height={28} data={hashtag.get('history').reverse().map(day => day.get('uses')).toArray()}>
<SparklinesCurve style={{ fill: 'none' }} /> <SparklinesCurve style={{ fill: 'none' }} />
</Sparklines> </Sparklines>
</div> </div>}
</div> </div>
); );

View file

@ -21,7 +21,7 @@ class SearchResults extends ImmutablePureComponent {
static propTypes = { static propTypes = {
results: ImmutablePropTypes.map.isRequired, results: ImmutablePropTypes.map.isRequired,
features: PropTypes.node, features: PropTypes.object,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };

View file

@ -44,7 +44,7 @@ const SearchPage = ({ children, features }) => (
SearchPage.propTypes = { SearchPage.propTypes = {
children: PropTypes.node, children: PropTypes.node,
features: PropTypes.node, features: PropTypes.object,
}; };
export default connect(mapStateToProps)(SearchPage); export default connect(mapStateToProps)(SearchPage);