import React, { useCallback, FC } from 'react'; import { useEndpoint } from '../../../contexts/ServerContext'; import { useTranslation } from '../../../contexts/TranslationContext'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import * as NotificationStatus from '../NotificationStatus'; import { followStyle, anchor } from '../helpers/followSyle'; import Metrics, { Reply, Content } from '..'; type ThreadReplyOptions = { unread: boolean; mention: boolean; all: boolean; lm: Date; mid: string; rid: string; counter: number; participants: number; following: boolean; openThread: () => any; }; const ThreadMetric: FC = ({ unread, mention, all, rid, mid, counter, participants, following, lm, openThread }) => { const t = useTranslation(); const followMessage = useEndpoint('POST', 'chat.followMessage'); const unfollowMessage = useEndpoint('POST', 'chat.unfollowMessage'); const format = useTimeAgo(); const handleFollow = useCallback(() => (following ? unfollowMessage({ mid }) : followMessage({ mid })), [followMessage, following, mid, unfollowMessage]); return {t('Reply')} {counter} { participants && {participants} } {format(lm)} { (mention && ) || (all && ) || (unread && )} ; }; export default ThreadMetric;