]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/features/getting_started/components/trends.js
1 import React
from 'react';
2 import ImmutablePureComponent
from 'react-immutable-pure-component';
3 import PropTypes
from 'prop-types';
4 import ImmutablePropTypes
from 'react-immutable-proptypes';
5 import Hashtag
from 'mastodon/components/hashtag';
6 import { FormattedMessage
} from 'react-intl';
8 export default class Trends
extends ImmutablePureComponent
{
10 static defaultProps
= {
15 trends: ImmutablePropTypes
.list
,
16 fetchTrends: PropTypes
.func
.isRequired
,
19 componentDidMount () {
20 this.props
.fetchTrends();
21 this.refreshInterval
= setInterval(() => this.props
.fetchTrends(), 900 * 1000);
24 componentWillUnmount () {
25 if (this.refreshInterval
) {
26 clearInterval(this.refreshInterval
);
31 const { trends
} = this.props
;
33 if (!trends
|| trends
.isEmpty()) {
38 <div className
='getting-started__trends'>
39 <h4
><FormattedMessage id
='trends.trending_now' defaultMessage
='Trending now' /></h4
>
41 {trends
.take(3).map(hashtag
=> <Hashtag key
={hashtag
.get('name')} hashtag
={hashtag
} />)}
This page took 0.077684 seconds and 4 git commands to generate.