import React from 'react'
import PropTypes from 'prop-types'
import { NavLink } from 'react-router-dom'
import { injectIntl, defineMessages } from 'react-intl'
import ImmutablePureComponent from 'react-immutable-pure-component'
import ImmutablePropTypes from 'react-immutable-proptypes'
import { me } from '../initial_state'
import {
CX,
BREAKPOINT_EXTRA_SMALL,
} from '../constants'
import Responsive from '../features/ui/util/responsive_component'
import StatusContainer from '../containers/status_container'
import Avatar from './avatar'
import Icon from './icon'
import Text from './text'
import DotTextSeperator from './dot_text_seperator'
import RelativeTimestamp from './relative_timestamp'
import DisplayName from './display_name'
class Notification extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
}
render() {
const {
intl,
accounts,
createdAt,
type,
statusId,
isHidden,
isUnread,
isDeckConnected,
} = this.props
const count = !!accounts ? accounts.size : 0
let message
let icon
switch (type) {
case 'follow':
icon = 'group'
message = intl.formatMessage(count > 1 ? messages.followedYouMultiple : messages.followedYouOne, {
count: count - 1,
})
break
case 'mention':
icon = 'comment'
message = intl.formatMessage(messages.mentionedInPost)
break
case 'like':
icon = 'like'
message = intl.formatMessage(count > 1 ? messages.likedStatusMultiple : messages.likedStatusOne, {
count: count - 1,
})
break
case 'repost':
icon = 'repost'
message = intl.formatMessage(count > 1 ? messages.repostedStatusMultiple : messages.repostedStatusOne, {
count: count - 1,
})
break
case 'poll':
let msg = messages.poll
if (accounts.size === 1) {
if (accounts.first().get('id') === me) {
msg = messages.ownPoll
}
}
icon = 'poll'
message = intl.formatMessage(msg)
break
default:
return null
}
if (isHidden) {
return (