mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
toggleNotification -> markNotificationsRead
This commit is contained in:
@@ -123,9 +123,7 @@ class Dashboard extends React.Component {
|
||||
<Notification
|
||||
isNotification={this.props.ui.flags.isNotification}
|
||||
notifications={this.props.domain.notifications}
|
||||
onToggle={() => {
|
||||
this.props.actions.toggleNotifications();
|
||||
}}
|
||||
onToggle={this.props.actions.markNotificationsRead}
|
||||
/>
|
||||
<LoadingOverlay
|
||||
ui={this.props.ui.flags.isFetchingDomain}
|
||||
|
||||
@@ -43,8 +43,8 @@ export default class Notification extends React.Component{
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.isNotification) {
|
||||
|
||||
const notificationsToRender = this.props.notifications.filter(n => !('isRead' in n && n.isRead))
|
||||
if (notificationsToRender.length > 0) {
|
||||
return (
|
||||
<div className={`notification-wrapper`}>
|
||||
{this.props.notifications.map((notification) => {
|
||||
|
||||
@@ -39,28 +39,16 @@ function toggleInfoPopup(uiState, action) {
|
||||
}
|
||||
}
|
||||
|
||||
function toggleNotifications(uiState, action) {
|
||||
return {
|
||||
...uiState,
|
||||
flags: {
|
||||
...uiState.flags,
|
||||
isNotification: !uiState.flags.isNotification
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ui(uiState = initial.ui, action) {
|
||||
switch (action.type) {
|
||||
case TOGGLE_FETCHING_DOMAIN:
|
||||
return toggleFetchingDomain(uiState, action);
|
||||
return toggleFetchingDomain(uiState, action)
|
||||
case TOGGLE_FETCHING_SOURCES:
|
||||
return toggleFetchingSources(uiState, action);
|
||||
return toggleFetchingSources(uiState, action)
|
||||
case TOGGLE_INFOPOPUP:
|
||||
return toggleInfoPopup(uiState, action);
|
||||
case TOGGLE_NOTIFICATIONS:
|
||||
return toggleNotifications(uiState, action);
|
||||
return toggleInfoPopup(uiState, action)
|
||||
default:
|
||||
return uiState;
|
||||
return uiState
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +142,7 @@ const initial = {
|
||||
isFetchingSources: false,
|
||||
|
||||
isCardstack: true,
|
||||
isInfopopup: false,
|
||||
isNotification: true
|
||||
isInfopopup: false
|
||||
},
|
||||
tools: {
|
||||
formatter: d3.timeFormat("%d %b, %H:%M"),
|
||||
|
||||
Reference in New Issue
Block a user