add unreadnotificationscount

This commit is contained in:
Connor Turland 2018-03-08 07:25:54 -05:00
parent 2971b81463
commit c1dbfc9f72
4 changed files with 55 additions and 59 deletions

View file

@ -81,7 +81,6 @@ $unread_notifications_dot_size: 8px;
} }
} }
.controller-notifications {
.notificationPage, .notificationPage,
.notificationsPage { .notificationsPage {
font-family: 'din-regular', Sans-Serif; font-family: 'din-regular', Sans-Serif;
@ -111,8 +110,6 @@ $unread_notifications_dot_size: 8px;
} }
} }
.notificationPage { .notificationPage {
.thirty-two-avatar { .thirty-two-avatar {
display: inline-block; display: inline-block;
@ -144,7 +141,6 @@ $unread_notifications_dot_size: 8px;
} }
} }
} }
}
ul.notifications { ul.notifications {
list-style: none; list-style: none;

View file

@ -7,7 +7,7 @@ const Notifications = {
notificationsLoading: false, notificationsLoading: false,
unreadNotificationsCount: 0, unreadNotificationsCount: 0,
init: serverData => { init: serverData => {
Notifications.unreadNotificationsCount = serverData.unreadNotificationsCount Notifications.unreadNotificationsCount = serverData.ActiveMapper.unread_notifications_count
}, },
fetchNotifications: render => { fetchNotifications: render => {
Notifications.notificationsLoading = true Notifications.notificationsLoading = true

View file

@ -61,11 +61,11 @@ class NotificationBox extends Component {
} }
render = () => { render = () => {
const { loading } = this.props const { notifications, loading } = this.props
return <div className='notificationsBox'> return <div className='notificationsBox'>
<div className='notificationsBoxTriangle' /> <div className='notificationsBoxTriangle' />
<ul className='notifications'> <ul className='notifications'>
{loading ? this.showLoading() : this.showNotifications()} {notifications.length === 0 && loading ? this.showLoading() : this.showNotifications()}
</ul> </ul>
</div> </div>
} }

View file

@ -27,7 +27,7 @@ class Notifications extends Component {
render = () => { render = () => {
const { notificationsLoading, markAsRead, markAsUnread } = this.props const { notificationsLoading, markAsRead, markAsUnread } = this.props
const notifications = (this.props.notifications || []).filter(n => !(BLACKLIST.indexOf(n.type) > -1 && (!n.data.object || !n.data.map))) const notifications = (this.props.notifications || []).filter(n => !(BLACKLIST.indexOf(n.type) > -1 && (!n.data.object || !n.data.map)))
if (notificationsLoading) { if (notifications.length === 0 && notificationsLoading) {
return ( return (
<div> <div>
<LoadingPage /> <LoadingPage />