2020-01-24 06:00:13 +09:00
|
|
|
import { connect } from 'react-redux';
|
2020-01-26 00:35:33 +09:00
|
|
|
import { addReaction, removeReaction } from 'mastodon/actions/announcements';
|
2020-01-24 06:00:13 +09:00
|
|
|
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 => ({
|
|
|
|
addReaction: (id, name) => dispatch(addReaction(id, name)),
|
|
|
|
removeReaction: (id, name) => dispatch(removeReaction(id, name)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Announcements);
|