2017-09-07 03:58:11 -04:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import { fetchPinnedStatuses } from '../../actions/pin_statuses';
|
|
|
|
import Column from '../ui/components/column';
|
|
|
|
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
|
|
|
|
import StatusList from '../../components/status_list';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2022-10-20 08:35:29 -04:00
|
|
|
import { Helmet } from 'react-helmet';
|
2017-09-07 03:58:11 -04:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
2022-04-28 18:24:31 -04:00
|
|
|
heading: { id: 'column.pins', defaultMessage: 'Pinned post' },
|
2017-09-07 03:58:11 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
statusIds: state.getIn(['status_lists', 'pins', 'items']),
|
|
|
|
hasMore: !!state.getIn(['status_lists', 'pins', 'next']),
|
|
|
|
});
|
|
|
|
|
2018-09-14 11:59:48 -04:00
|
|
|
class PinnedStatuses extends ImmutablePureComponent {
|
2017-09-07 03:58:11 -04:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
dispatch: PropTypes.func.isRequired,
|
|
|
|
statusIds: ImmutablePropTypes.list.isRequired,
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
hasMore: PropTypes.bool.isRequired,
|
2019-07-19 03:25:22 -04:00
|
|
|
multiColumn: PropTypes.bool,
|
2017-09-07 03:58:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
componentWillMount () {
|
|
|
|
this.props.dispatch(fetchPinnedStatuses());
|
|
|
|
}
|
|
|
|
|
|
|
|
handleHeaderClick = () => {
|
|
|
|
this.column.scrollTop();
|
2023-01-29 19:45:35 -05:00
|
|
|
};
|
2017-09-07 03:58:11 -04:00
|
|
|
|
|
|
|
setRef = c => {
|
|
|
|
this.column = c;
|
2023-01-29 19:45:35 -05:00
|
|
|
};
|
2017-09-07 03:58:11 -04:00
|
|
|
|
|
|
|
render () {
|
2021-07-13 09:45:17 -04:00
|
|
|
const { intl, statusIds, hasMore, multiColumn } = this.props;
|
2017-09-07 03:58:11 -04:00
|
|
|
|
|
|
|
return (
|
2019-08-01 13:17:17 -04:00
|
|
|
<Column bindToDocument={!multiColumn} icon='thumb-tack' heading={intl.formatMessage(messages.heading)} ref={this.setRef}>
|
2017-09-07 03:58:11 -04:00
|
|
|
<ColumnBackButtonSlim />
|
|
|
|
<StatusList
|
|
|
|
statusIds={statusIds}
|
|
|
|
scrollKey='pinned_statuses'
|
|
|
|
hasMore={hasMore}
|
2019-07-19 03:25:22 -04:00
|
|
|
bindToDocument={!multiColumn}
|
2017-09-07 03:58:11 -04:00
|
|
|
/>
|
2022-10-20 08:35:29 -04:00
|
|
|
<Helmet>
|
|
|
|
<meta name='robots' content='noindex' />
|
|
|
|
</Helmet>
|
2017-09-07 03:58:11 -04:00
|
|
|
</Column>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-23 22:17:53 -04:00
|
|
|
|
|
|
|
export default connect(mapStateToProps)(injectIntl(PinnedStatuses));
|