import React, { Component } from 'react' import { Link } from 'react-router' import { MAP_ACCESS_REQUEST } from '../../constants' import NotificationsHeader from './NotificationsHeader' import LoadingPage from '../helpers/LoadingPage' import Loading from '../../components/Loading' import NotificationBody from '../../components/NotificationBody' /* TODO: allow / decline access loading states make backend serve HTML for raw body too */ class NotificationPage extends Component { componentDidMount() { // the notification id const id = parseInt(this.props.params.id, 10) if (!this.props.notifications.find(n => n.id === id)) { this.props.fetchNotification(id) } } render = () => { const id = parseInt(this.props.params.id, 10) const notification = this.props.notifications.find(n => n.id === id) if (!notification) { return (
) } const request = notification.data.object const map = notification.data.map const subject = notification.type === MAP_ACCESS_REQUEST ? ({notification.actor.name} wants to collaborate on map { map.name }) : notification.subject return (
Back to notifications

{subject}

{notification.type === MAP_ACCESS_REQUEST &&

{request.answered && {request.approved && You already responded to this access request, and allowed access.} {!request.approved && You already responded to this access request, and declined access. If you changed your mind, you can still grant them access by going to the map and adding them as a collaborator.} } {!request.answered && Allow Decline }

Go to map    View mapper profile
} {notification.type !== MAP_ACCESS_REQUEST && }
) } } export default NotificationPage /* */