import { Box, Icon, Icons, Line, Text } from 'folds'; import React, { ReactNode } from 'react'; import classNames from 'classnames'; import { IThreadBundledRelationship, Room } from 'matrix-js-sdk'; import * as css from './styles.css'; import { getMemberDisplayName } from '../../../../utils/room'; import { getMxIdLocalPart } from '../../../../utils/matrix'; import { Time } from '../../../../components/message'; export function ThreadSelectorContainer({ children }: { children: ReactNode }) { return {children}; } type ThreadSelectorProps = { room: Room; threadDetail: IThreadBundledRelationship; outlined?: boolean; hour24Clock: boolean; dateFormatString: string; }; export function ThreadSelector({ room, threadDetail, outlined, hour24Clock, dateFormatString, }: ThreadSelectorProps) { const latestEvent = threadDetail.latest_event; const latestSenderId = latestEvent.sender; const latestDisplayName = getMemberDisplayName(room, latestSenderId) ?? getMxIdLocalPart(latestSenderId) ?? latestSenderId; const latestEventTs = latestEvent.origin_server_ts; return ( {threadDetail.count} {threadDetail.count === 1 ? 'Reply' : 'Replies'} {latestSenderId && ( <> Last reply by {latestDisplayName} )} ); }