/** * @author Tanya Vykliuk */ import React from 'react'; import { useHistory } from "react-router-dom"; import Typography from '@material-ui/core/Typography'; import Avatar from '@material-ui/core/Avatar'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; // @ts-ignore import styles from './NotificationCard.module.scss'; import { useTranslation } from 'react-i18next'; const NotificationCard = ({notification} : any) => { const history = useHistory(); const { t } = useTranslation(); const checkNotificationAction = (type) =>{ switch (type) { case 'feed-fire': return t('social:notification.feedFire'); case 'feed-bookmark': return t('social:notification.feedBookmarked'); case 'comment': return t('social:notification.comment'); case 'comment-fire': return t('social:notification.commentFire'); case 'follow': return t('social:notification.follow'); case 'unfollow': return t('social:notification.unfollow'); default: return t('social:notification.followed'); } }; return history.push('/creator?creatorId=' + notification.creatorAuthorId)} className={styles.authorAvatar} src={notification.avatar} /> {notification.creator_username} {checkNotificationAction(notification.type)} {notification.comment_text && ' "'+notification.comment_text+'"'} {notification.type !== 'follow' && notification.type !== 'unfollow' &&
history.push('/feed?feedId=' + notification.feedId)} className={styles.authorAvatar} src={notification.previewUrl} />
}
; }; export default (NotificationCard);