* Action/reducer for changing column settings takes a path and a value instead of a javascript object * Settings menu version and column headline version working simultaneously * remove column headline entirely * remove css for headlines that aren't possible now * Remove commented out code from unfruitful attempt at this feature * Give direct timeline its own column settings bc it doesn't have a media only option * Fix typo in public timeline code that was preventing per-column settings from working properly * Fix codeclimate issues * Missing semicolons * Use redux state to set onlyMedia, let that do the update instead of a callback. Consequently, unpinned setting works without history modification * Unused import
28 lines
914 B
JavaScript
28 lines
914 B
JavaScript
import { connect } from 'react-redux';
|
|
import ColumnSettings from '../components/column_settings';
|
|
import { changeSetting } from '../../../actions/settings';
|
|
import { changeColumnParams } from '../../../actions/columns';
|
|
|
|
const mapStateToProps = (state, { columnId }) => {
|
|
const uuid = columnId;
|
|
const columns = state.getIn(['settings', 'columns']);
|
|
const index = columns.findIndex(c => c.get('uuid') === uuid);
|
|
|
|
return {
|
|
settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'community']),
|
|
};
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch, { columnId }) => {
|
|
return {
|
|
onChange (key, checked) {
|
|
if (columnId) {
|
|
dispatch(changeColumnParams(columnId, key, checked));
|
|
} else {
|
|
dispatch(changeSetting(['community', ...key], checked));
|
|
}
|
|
},
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
|