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.

66 lines
1.3 KiB

  1. /*
  2. `<ComposeAdvancedOptionsContainer>`
  3. ===================================
  4. This container connects `<ComposeAdvancedOptions>` 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 { toggleComposeAdvancedOption } from '../../../../mastodon/actions/compose';
  15. // Our imports //
  16. import ComposeAdvancedOptions from '.';
  17. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  18. /*
  19. State mapping:
  20. --------------
  21. The `mapStateToProps()` function maps various state properties to the
  22. props of our component. The only property we care about is
  23. `compose.advanced_options`.
  24. */
  25. const mapStateToProps = state => ({
  26. values: state.getIn(['compose', 'advanced_options']),
  27. });
  28. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  29. /*
  30. Dispatch mapping:
  31. -----------------
  32. The `mapDispatchToProps()` function maps dispatches to our store to the
  33. various props of our component. We just need to provide a dispatch for
  34. when an advanced option toggle changes.
  35. */
  36. const mapDispatchToProps = dispatch => ({
  37. onChange (option) {
  38. dispatch(toggleComposeAdvancedOption(option));
  39. },
  40. });
  41. export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions);