diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-02-25 00:34:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 00:34:33 +0100 |
commit | d4592bbfcd091c4eaef8c8f24c47d5c2ce1bacd3 (patch) | |
tree | 237a385de76d112d120b7a35119067e1fd4947ef /app/javascript/mastodon/features/explore/statuses.js | |
parent | 27965ce5edff20db2de1dd233c88f8393bb0da0b (diff) |
Add explore page to web UI (#17123)
* Add explore page to web UI * Fix not removing loaded statuses from trends on mute/block action
Diffstat (limited to 'app/javascript/mastodon/features/explore/statuses.js')
-rw-r--r-- | app/javascript/mastodon/features/explore/statuses.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/explore/statuses.js b/app/javascript/mastodon/features/explore/statuses.js new file mode 100644 index 000000000..4e5530d84 --- /dev/null +++ b/app/javascript/mastodon/features/explore/statuses.js @@ -0,0 +1,48 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import StatusList from 'mastodon/components/status_list'; +import { FormattedMessage } from 'react-intl'; +import { connect } from 'react-redux'; +import { fetchTrendingStatuses } from 'mastodon/actions/trends'; + +const mapStateToProps = state => ({ + statusIds: state.getIn(['status_lists', 'trending', 'items']), + isLoading: state.getIn(['status_lists', 'trending', 'isLoading'], true), +}); + +export default @connect(mapStateToProps) +class Statuses extends React.PureComponent { + + static propTypes = { + statusIds: ImmutablePropTypes.list, + isLoading: PropTypes.bool, + multiColumn: PropTypes.bool, + dispatch: PropTypes.func.isRequired, + }; + + componentDidMount () { + const { dispatch } = this.props; + dispatch(fetchTrendingStatuses()); + } + + render () { + const { isLoading, statusIds, multiColumn } = this.props; + + const emptyMessage = <FormattedMessage id='empty_column.explore_statuses' defaultMessage='Nothing is trending right now. Check back later!' />; + + return ( + <StatusList + trackScroll + statusIds={statusIds} + scrollKey='explore-statuses' + hasMore={false} + isLoading={isLoading} + emptyMessage={emptyMessage} + bindToDocument={!multiColumn} + withCounters + /> + ); + } + +} |