You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.2 KiB

  1. /*
  2. `<NotificationPurgeButtonsContainer>`
  3. =========================
  4. This container connects `<NotificationPurgeButtons>`s to the Redux store.
  5. */
  6. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  7. /*
  8. Imports:
  9. --------
  10. */
  11. // Package imports //
  12. import { connect } from 'react-redux';
  13. // Our imports //
  14. import NotificationPurgeButtons from './notification_purge_buttons';
  15. import {
  16. deleteMarkedNotifications,
  17. enterNotificationClearingMode,
  18. } from '../../../../mastodon/actions/notifications';
  19. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  20. /*
  21. Dispatch mapping:
  22. -----------------
  23. The `mapDispatchToProps()` function maps dispatches to our store to the
  24. various props of our component. We only need to provide a dispatch for
  25. deleting notifications.
  26. */
  27. const mapDispatchToProps = dispatch => ({
  28. onEnterCleaningMode(yes) {
  29. dispatch(enterNotificationClearingMode(yes));
  30. },
  31. onDeleteMarkedNotifications() {
  32. dispatch(deleteMarkedNotifications());
  33. },
  34. });
  35. const mapStateToProps = state => ({
  36. active: state.getIn(['notifications', 'cleaningMode']),
  37. });
  38. export default connect(mapStateToProps, mapDispatchToProps)(NotificationPurgeButtons);