[Glitch] Add notification quick-filter bar in the frontend app
Port 13dce12665
to glitch-soc
This commit is contained in:
@@ -2,6 +2,7 @@ import { connect } from 'react-redux';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import ColumnSettings from '../components/column_settings';
|
||||
import { changeSetting } from 'flavours/glitch/actions/settings';
|
||||
import { setFilter } from 'flavours/glitch/actions/notifications';
|
||||
import { clearNotifications } from 'flavours/glitch/actions/notifications';
|
||||
import { changeAlerts as changePushNotifications } from 'flavours/glitch/actions/push_notifications';
|
||||
import { openModal } from 'flavours/glitch/actions/modal';
|
||||
@@ -21,6 +22,9 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
onChange (path, checked) {
|
||||
if (path[0] === 'push') {
|
||||
dispatch(changePushNotifications(path.slice(1), checked));
|
||||
} else if (path[0] === 'quickFilter') {
|
||||
dispatch(changeSetting(['notifications', ...path], checked));
|
||||
dispatch(setFilter('all'));
|
||||
} else {
|
||||
dispatch(changeSetting(['notifications', ...path], checked));
|
||||
}
|
||||
|
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import FilterBar from '../components/filter_bar';
|
||||
import { setFilter } from '../../../actions/notifications';
|
||||
|
||||
const makeMapStateToProps = state => ({
|
||||
selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
|
||||
advancedMode: state.getIn(['settings', 'notifications', 'quickFilter', 'advanced']),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
selectFilter (newActiveFilter) {
|
||||
dispatch(setFilter(newActiveFilter));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(makeMapStateToProps, mapDispatchToProps)(FilterBar);
|
Reference in New Issue
Block a user