import { MessageMetricsItem, MessageBlock, MessageMetrics, MessageMetricsReply, MessageMetricsItemIcon, MessageMetricsItemLabel, } from '@rocket.chat/fuselage'; import { useResizeObserver } from '@rocket.chat/fuselage-hooks'; import { useTranslation } from 'react-i18next'; import ThreadMetricsFollow from './ThreadMetricsFollow'; import ThreadMetricsParticipants from './ThreadMetricsParticipants'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import { useGoToThread } from '../../../views/room/hooks/useGoToThread'; export type ThreadMetricsProps = { unread: boolean; mention: boolean; all: boolean; lm: Date; mid: string; rid: string; counter: number; participants: string[]; following: boolean; }; const ThreadMetrics = ({ unread, mention, all, rid, mid, counter, participants, following, lm }: ThreadMetricsProps) => { const { t } = useTranslation(); const format = useTimeAgo(); const goToThread = useGoToThread(); const { ref, borderBoxSize } = useResizeObserver(); const isSmall = (borderBoxSize.inlineSize || Infinity) < 320; return ( goToThread({ rid, tmid: mid })} primary={!!unread} position='relative' overflow='visible' > {t('View_thread')} {participants?.length > 0 && } {isSmall ? ( {t('__count__replies', { count: counter })} ) : ( {t('__count__replies__date__', { count: counter, date: format(lm) })} )} ); }; export default ThreadMetrics;