99cf92a3cf
* Change meaning of /api/v1/announcements/:id/dismiss to mark an announcement as read * Change how unread announcements are counted in UI * Add unread marker to announcements and mark announcements as unread as they are displayed * Fixups
20 lines
913 B
JavaScript
20 lines
913 B
JavaScript
import { connect } from 'react-redux';
|
|
import { addReaction, removeReaction, dismissAnnouncement } from 'mastodon/actions/announcements';
|
|
import Announcements from '../components/announcements';
|
|
import { createSelector } from 'reselect';
|
|
import { Map as ImmutableMap } from 'immutable';
|
|
|
|
const customEmojiMap = createSelector([state => state.get('custom_emojis')], items => items.reduce((map, emoji) => map.set(emoji.get('shortcode'), emoji), ImmutableMap()));
|
|
|
|
const mapStateToProps = state => ({
|
|
announcements: state.getIn(['announcements', 'items']),
|
|
emojiMap: customEmojiMap(state),
|
|
});
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
dismissAnnouncement: id => dispatch(dismissAnnouncement(id)),
|
|
addReaction: (id, name) => dispatch(addReaction(id, name)),
|
|
removeReaction: (id, name) => dispatch(removeReaction(id, name)),
|
|
});
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Announcements);
|