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.

55 lines
1.2 KiB

  1. /*
  2. `<NotificationContainer>`
  3. =========================
  4. This container connects `<Notification>`s to the Redux store.
  5. */
  6. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  7. /*
  8. Imports:
  9. --------
  10. */
  11. // Package imports //
  12. import { connect } from 'react-redux';
  13. // Mastodon imports //
  14. import { makeGetNotification } from '../../../mastodon/selectors';
  15. // Our imports //
  16. import Notification from '.';
  17. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  18. /*
  19. State mapping:
  20. --------------
  21. The `mapStateToProps()` function maps various state properties to the
  22. props of our component. We wrap this in `makeMapStateToProps()` so that
  23. we only have to call `makeGetNotification()` once instead of every
  24. time.
  25. */
  26. const makeMapStateToProps = () => {
  27. const getNotification = makeGetNotification();
  28. const mapStateToProps = (state, props) => ({
  29. notification: getNotification(state, props.notification, props.accountId),
  30. settings: state.get('local_settings'),
  31. });
  32. return mapStateToProps;
  33. };
  34. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  35. export default connect(makeMapStateToProps)(Notification);