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