@ -16,6 +16,28 @@ const shortNumberFormat = number => {
}
}
} ;
} ;
const renderHashtag = hashtag => (
< div className = 'trends__item' key = { hashtag . get ( 'name' ) } >
< div className = 'trends__item__name' >
< Link to = { ` /timelines/tag/ ${ hashtag . get ( 'name' ) } ` } >
# < span > { hashtag . get ( 'name' ) } < / s p a n >
< / L i n k >
< 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> }} / >
< / d i v >
< div className = 'trends__item__current' >
{ shortNumberFormat ( hashtag . getIn ( [ 'history' , 0 , 'uses' ] ) ) }
< / d i v >
< div className = 'trends__item__sparkline' >
< Sparklines width = { 50 } height = { 28 } data = { hashtag . get ( 'history' ) . reverse ( ) . map ( day => day . get ( 'uses' ) ) . toArray ( ) } >
< SparklinesCurve style = { { fill : 'none' } } / >
< / S p a r k l i n e s >
< / d i v >
< / d i v >
) ;
export default class SearchResults extends ImmutablePureComponent {
export default class SearchResults extends ImmutablePureComponent {
static propTypes = {
static propTypes = {
@ -44,27 +66,7 @@ export default class SearchResults extends ImmutablePureComponent {
< FormattedMessage id = 'trends.header' defaultMessage = 'Trending now' / >
< FormattedMessage id = 'trends.header' defaultMessage = 'Trending now' / >
< / d i v >
< / d i v >
{ trends && trends . map ( hashtag => (
{ trends && trends . map ( hashtag => renderHashtag ( hashtag ) ) }
< div className = 'trends__item' key = { hashtag . get ( 'name' ) } >
< div className = 'trends__item__name' >
< Link to = { ` /timelines/tag/ ${ hashtag . get ( 'name' ) } ` } >
# < span > { hashtag . get ( 'name' ) } < / s p a n >
< / L i n k >
< 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> }} / >
< / d i v >
< div className = 'trends__item__current' >
{ shortNumberFormat ( hashtag . getIn ( [ 'history' , 0 , 'uses' ] ) ) }
< / d i v >
< div className = 'trends__item__sparkline' >
< Sparklines width = { 50 } height = { 28 } data = { hashtag . get ( 'history' ) . reverse ( ) . map ( day => day . get ( 'uses' ) ) . toArray ( ) } >
< SparklinesCurve style = { { fill : 'none' } } / >
< / S p a r k l i n e s >
< / d i v >
< / d i v >
) ) }
< / d i v >
< / d i v >
< / d i v >
< / d i v >
) ;
) ;
@ -74,7 +76,7 @@ export default class SearchResults extends ImmutablePureComponent {
count += results . get ( 'accounts' ) . size ;
count += results . get ( 'accounts' ) . size ;
accounts = (
accounts = (
< div className = 'search-results__section' >
< div className = 'search-results__section' >
< h5 > < FormattedMessage id = 'search_results.accounts' defaultMessage = 'People' / > < / h 5 >
< h5 > < i className = 'fa fa-fw fa-users' / > < FormattedMessage id = 'search_results.accounts' defaultMessage = 'People' / > < / h 5 >
{ results . get ( 'accounts' ) . map ( accountId => < AccountContainer key = { accountId } id = { accountId } / > ) }
{ results . get ( 'accounts' ) . map ( accountId => < AccountContainer key = { accountId } id = { accountId } / > ) }
< / d i v >
< / d i v >
@ -85,7 +87,7 @@ export default class SearchResults extends ImmutablePureComponent {
count += results . get ( 'statuses' ) . size ;
count += results . get ( 'statuses' ) . size ;
statuses = (
statuses = (
< div className = 'search-results__section' >
< div className = 'search-results__section' >
< h5 > < FormattedMessage id = 'search_results.statuses' defaultMessage = 'Toots' / > < / h 5 >
< h5 > < i className = 'fa fa-fw fa-quote-right' / > < FormattedMessage id = 'search_results.statuses' defaultMessage = 'Toots' / > < / h 5 >
{ results . get ( 'statuses' ) . map ( statusId => < StatusContainer key = { statusId } id = { statusId } / > ) }
{ results . get ( 'statuses' ) . map ( statusId => < StatusContainer key = { statusId } id = { statusId } / > ) }
< / d i v >
< / d i v >
@ -96,13 +98,9 @@ export default class SearchResults extends ImmutablePureComponent {
count += results . get ( 'hashtags' ) . size ;
count += results . get ( 'hashtags' ) . size ;
hashtags = (
hashtags = (
< div className = 'search-results__section' >
< div className = 'search-results__section' >
< h5 > < FormattedMessage id = 'search_results.hashtags' defaultMessage = 'Hashtags' / > < / h 5 >
< h5 > < i className = 'fa fa-fw fa-hashtag' / > < FormattedMessage id = 'search_results.hashtags' defaultMessage = 'Hashtags' / > < / h 5 >
{ results . get ( 'hashtags' ) . map ( hashtag => (
{ results . get ( 'hashtags' ) . map ( hashtag => renderHashtag ( hashtag ) ) }
< Link key = { hashtag } className = 'search-results__hashtag' to = { ` /timelines/tag/ ${ hashtag } ` } >
{ hashtag }
< / L i n k >
) ) }
< / d i v >
< / d i v >
) ;
) ;
}
}