2023-05-24 00:15:17 +09:00
|
|
|
import { Map as ImmutableMap } from 'immutable';
|
2020-01-24 06:00:13 +09:00
|
|
|
import { connect } from 'react-redux';
|
2023-05-24 00:15:17 +09:00
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
|
2020-02-03 09:53:09 +09:00
|
|
|
import { addReaction, removeReaction, dismissAnnouncement } from 'mastodon/actions/announcements';
|
2023-05-24 00:15:17 +09:00
|
|
|
|
2020-01-24 06:00:13 +09:00
|
|
|
import Announcements from '../components/announcements';
|
|
|
|
|
|
|
|
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 => ({
|
2020-02-03 09:53:09 +09:00
|
|
|
dismissAnnouncement: id => dispatch(dismissAnnouncement(id)),
|
2020-01-24 06:00:13 +09:00
|
|
|
addReaction: (id, name) => dispatch(addReaction(id, name)),
|
|
|
|
removeReaction: (id, name) => dispatch(removeReaction(id, name)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Announcements);
|