This commit is contained in:
mgabdev
2020-04-09 15:18:14 -04:00
parent 2b61a7c067
commit 7249143d9f
22 changed files with 166 additions and 440 deletions

View File

@@ -18,13 +18,12 @@ const messages = defineMessages({
});
const makeMapStateToProps = state => ({
selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
selectedFilter: state.getIn(['notifications', 'filter', 'active']),
});
const mapDispatchToProps = (dispatch) => ({
selectFilter(newActiveFilter) {
console.log("newActiveFilter:", newActiveFilter)
dispatch(setFilter(newActiveFilter))
selectFilter(value) {
dispatch(setFilter('active', value))
},
});
@@ -33,6 +32,10 @@ export default
@connect(makeMapStateToProps, mapDispatchToProps)
class NotificationsPage extends PureComponent {
static contextTypes = {
router: PropTypes.object.isRequired,
}
static propTypes = {
selectFilter: PropTypes.func.isRequired,
selectedFilter: PropTypes.string.isRequired,
@@ -43,8 +46,16 @@ class NotificationsPage extends PureComponent {
document.title = 'Notifications - Gab'
}
// : todo : on pop change filter active type
onClick(notificationType) {
this.props.selectFilter(notificationType);
this.props.selectFilter(notificationType)
if (notificationType === 'all') {
this.context.router.history.push('/notifications')
} else {
this.context.router.history.push(`/notifications?only=${notificationType}`)
}
}
render() {