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