[Glitch] Put "Media Only" option in column settings instead of content area headline

Port 4f42238c29 to glitch-soc
This commit is contained in:
Thibaut Girka
2018-12-18 18:52:37 +01:00
committed by ThibG
parent 9fc7ad7b9c
commit 82b01a6c9f
11 changed files with 126 additions and 135 deletions

View File

@@ -1,17 +1,28 @@
import { connect } from 'react-redux';
import ColumnSettings from 'flavours/glitch/features/community_timeline/components/column_settings';
import { changeSetting } from 'flavours/glitch/actions/settings';
import { changeColumnParams } from 'flavours/glitch/actions/columns';
const mapStateToProps = (state, { columnId }) => {
const uuid = columnId;
const columns = state.getIn(['settings', 'columns']);
const index = columns.findIndex(c => c.get('uuid') === uuid);
const mapStateToProps = state => ({
settings: state.getIn(['settings', 'public']),
});
return {
settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'public']),
};
};
const mapDispatchToProps = dispatch => ({
onChange (path, checked) {
dispatch(changeSetting(['public', ...path], checked));
},
});
const mapDispatchToProps = (dispatch, { columnId }) => {
return {
onChange (key, checked) {
if (columnId) {
dispatch(changeColumnParams(columnId, key, checked));
} else {
dispatch(changeSetting(['public', ...key], checked));
}
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);