group timeline improvements and prep for sorting
This commit is contained in:
parent
f7118a39df
commit
57ddfabf20
@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import StatusListContainer from '../../ui/containers/status_list_container';
|
import StatusListContainer from '../../ui/containers/status_list_container';
|
||||||
import Column from '../../../components/column';
|
import Column from '../../../components/column';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
||||||
import { connectGroupStream } from '../../../actions/streaming';
|
import { connectGroupStream } from '../../../actions/streaming';
|
||||||
import { expandGroupTimeline } from '../../../actions/timelines';
|
import { expandGroupTimeline } from '../../../actions/timelines';
|
||||||
import MissingIndicator from '../../../components/missing_indicator';
|
import MissingIndicator from '../../../components/missing_indicator';
|
||||||
@ -12,6 +12,12 @@ import LoadingIndicator from '../../../components/loading_indicator';
|
|||||||
import ComposeFormContainer from '../../../../gabsocial/features/compose/containers/compose_form_container';
|
import ComposeFormContainer from '../../../../gabsocial/features/compose/containers/compose_form_container';
|
||||||
import { me } from 'gabsocial/initial_state';
|
import { me } from 'gabsocial/initial_state';
|
||||||
import Avatar from '../../../components/avatar';
|
import Avatar from '../../../components/avatar';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
tabLatest: { id: 'group.timeline.tab_latest', defaultMessage: 'Latest' },
|
||||||
|
});
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
account: state.getIn(['accounts', me]),
|
account: state.getIn(['accounts', me]),
|
||||||
@ -60,7 +66,7 @@ class GroupTimeline extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { columnId, group, relationships, account } = this.props;
|
const { columnId, group, relationships, account, intl } = this.props;
|
||||||
const { id } = this.props.params;
|
const { id } = this.props.params;
|
||||||
|
|
||||||
if (typeof group === 'undefined' || !relationships) {
|
if (typeof group === 'undefined' || !relationships) {
|
||||||
@ -89,6 +95,14 @@ class GroupTimeline extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className='group__feed'>
|
<div className='group__feed'>
|
||||||
|
<div className="column-header__wrapper">
|
||||||
|
<h1 className="column-header">
|
||||||
|
<Link to={`/groups/${id}`} className={classNames('btn grouped active')}>
|
||||||
|
{intl.formatMessage(messages.tabLatest)}
|
||||||
|
</Link>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<StatusListContainer
|
<StatusListContainer
|
||||||
alwaysPrepend
|
alwaysPrepend
|
||||||
scrollKey={`group_timeline-${columnId}`}
|
scrollKey={`group_timeline-${columnId}`}
|
||||||
|
@ -8,8 +8,8 @@ import { dequeueTimeline } from 'gabsocial/actions/timelines';
|
|||||||
import { scrollTopTimeline } from '../../../actions/timelines';
|
import { scrollTopTimeline } from '../../../actions/timelines';
|
||||||
|
|
||||||
const makeGetStatusIds = () => createSelector([
|
const makeGetStatusIds = () => createSelector([
|
||||||
(state, { type }) => state.getIn(['settings', type], ImmutableMap()),
|
(state, { type, id }) => state.getIn(['settings', type], ImmutableMap()),
|
||||||
(state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()),
|
(state, { type, id }) => state.getIn(['timelines', id, 'items'], ImmutableList()),
|
||||||
(state) => state.get('statuses'),
|
(state) => state.get('statuses'),
|
||||||
], (columnSettings, statusIds, statuses) => {
|
], (columnSettings, statusIds, statuses) => {
|
||||||
return statusIds.filter(id => {
|
return statusIds.filter(id => {
|
||||||
@ -34,7 +34,7 @@ const mapStateToProps = (state, {timelineId}) => {
|
|||||||
const getStatusIds = makeGetStatusIds();
|
const getStatusIds = makeGetStatusIds();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
statusIds: getStatusIds(state, { type: timelineId }),
|
statusIds: getStatusIds(state, { type: timelineId.substring(0,5) === 'group' ? 'group' : timelineId, id: timelineId }),
|
||||||
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
|
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
|
||||||
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
|
||||||
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
|
||||||
|
@ -24,6 +24,12 @@ const initialState = ImmutableMap({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
group: ImmutableMap({
|
||||||
|
shows: ImmutableMap({
|
||||||
|
reply: true,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
|
||||||
notifications: ImmutableMap({
|
notifications: ImmutableMap({
|
||||||
alerts: ImmutableMap({
|
alerts: ImmutableMap({
|
||||||
follow: true,
|
follow: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user