0
0
Fork 0

Remove trending hashtags (#7711)

* Delete trends_controller.rb

* Update routes.rb

* Update trending_tags.rb

* Update index.js

* Update index.js

* Update search_results.js

* Update async-components.js

* Update index.js

* Delete trends.js

* Delete trends.js

* Delete trends_container.js

* Delete trends.js

* Update search_results.js

* Update search_results_container.js
This commit is contained in:
Eugen Rochko 2018-06-04 02:18:18 +02:00 committed by GitHub
parent 00512ecf87
commit 0deb9fa6b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 2 additions and 226 deletions

View file

@ -1,71 +0,0 @@
import classNames from 'classnames';
import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage, defineMessages } from 'react-intl';
import Hashtag from '../../../components/hashtag';
import { Link } from 'react-router-dom';
const messages = defineMessages({
refresh_trends: { id: 'trends.refresh', defaultMessage: 'Refresh' },
});
export default class Trends extends ImmutablePureComponent {
static defaultProps = {
loading: false,
};
static propTypes = {
trends: ImmutablePropTypes.list,
loading: PropTypes.bool.isRequired,
showTrends: PropTypes.bool.isRequired,
fetchTrends: PropTypes.func.isRequired,
toggleTrends: PropTypes.func.isRequired,
};
componentDidMount () {
setTimeout(() => this.props.fetchTrends(), 5000);
}
handleRefreshTrends = () => {
this.props.fetchTrends();
}
handleToggle = () => {
this.props.toggleTrends(!this.props.showTrends);
}
render () {
const { intl, trends, loading, showTrends } = this.props;
if (!trends || trends.size < 1) {
return null;
}
return (
<div className='getting-started__trends'>
<div className='column-header__wrapper'>
<h1 className='column-header'>
<button>
<i className='fa fa-fire fa-fw' />
<FormattedMessage id='trends.header' defaultMessage='Trending now' />
</button>
<div className='column-header__buttons'>
{showTrends && <button onClick={this.handleRefreshTrends} className='column-header__button' title={intl.formatMessage(messages.refresh_trends)} aria-label={intl.formatMessage(messages.refresh_trends)} disabled={loading}><i className={classNames('fa', 'fa-refresh', { 'fa-spin': loading })} /></button>}
<button onClick={this.handleToggle} className='column-header__button'><i className={classNames('fa', showTrends ? 'fa-chevron-down' : 'fa-chevron-up')} /></button>
</div>
</h1>
</div>
{showTrends && <div className='getting-started__scrollable'>
{trends.take(3).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
<Link to='/trends' className='load-more'><FormattedMessage id='status.load_more' defaultMessage='Load more' /></Link>
</div>}
</div>
);
}
}

View file

@ -1,18 +0,0 @@
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { fetchTrends } from '../../../actions/trends';
import Trends from '../components/trends';
import { changeSetting } from '../../../actions/settings';
const mapStateToProps = state => ({
trends: state.getIn(['trends', 'items']),
loading: state.getIn(['trends', 'isLoading']),
showTrends: state.getIn(['settings', 'trends', 'show']),
});
const mapDispatchToProps = dispatch => ({
fetchTrends: () => dispatch(fetchTrends()),
toggleTrends: show => dispatch(changeSetting(['trends', 'show'], show)),
});
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Trends));

View file

@ -12,7 +12,6 @@ import { fetchFollowRequests } from '../../actions/accounts';
import { List as ImmutableList } from 'immutable';
import { Link } from 'react-router-dom';
import NavigationBar from '../compose/components/navigation_bar';
import TrendsContainer from './containers/trends_container';
const messages = defineMessages({
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
@ -132,8 +131,6 @@ export default class GettingStarted extends ImmutablePureComponent {
{navItems}
</div>
{multiColumn && <TrendsContainer />}
{!multiColumn && <div className='flex-spacer' />}
<div className='getting-started getting-started__footer'>