2017-07-14 20:13:02 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
`<ComposeAdvancedOptionsContainer>`
|
|
|
|
===================================
|
|
|
|
|
|
|
|
This container connects `<ComposeAdvancedOptions>` to the Redux store.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Imports:
|
|
|
|
--------
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2017-07-12 10:02:51 +02:00
|
|
|
// Package imports //
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
// Mastodon imports //
|
2017-07-13 11:40:16 +02:00
|
|
|
import { toggleComposeAdvancedOption } from '../../../../mastodon/actions/compose';
|
2017-07-12 10:02:51 +02:00
|
|
|
|
|
|
|
// Our imports //
|
2017-07-13 11:40:16 +02:00
|
|
|
import ComposeAdvancedOptions from '.';
|
2017-07-12 10:02:51 +02:00
|
|
|
|
2017-07-14 20:13:02 +02:00
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
State mapping:
|
|
|
|
--------------
|
|
|
|
|
|
|
|
The `mapStateToProps()` function maps various state properties to the
|
|
|
|
props of our component. The only property we care about is
|
|
|
|
`compose.advanced_options`.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2017-07-12 10:02:51 +02:00
|
|
|
const mapStateToProps = state => ({
|
|
|
|
values: state.getIn(['compose', 'advanced_options']),
|
|
|
|
});
|
|
|
|
|
2017-07-14 20:13:02 +02:00
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Dispatch mapping:
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
The `mapDispatchToProps()` function maps dispatches to our store to the
|
|
|
|
various props of our component. We just need to provide a dispatch for
|
|
|
|
when an advanced option toggle changes.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2017-07-12 10:02:51 +02:00
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
|
|
|
|
onChange (option) {
|
2017-07-12 07:50:50 +02:00
|
|
|
dispatch(toggleComposeAdvancedOption(option));
|
2017-07-12 10:02:51 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions);
|