import { MarkMentionsReadComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; import { LocalizeText, SendMessageComposer } from '../../api'; import { Button, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common'; import { useMentionsSnapshot } from '../../hooks'; import { markAllRead } from '../../hooks/mentions/mentionsStore'; import { MentionRowView } from './MentionRowView'; import { useMentionRowClick } from './useMentionRowClick'; interface MentionsViewProps { onClose: () => void; } export const MentionsView: FC = props => { const { onClose } = props; const { mentions } = useMentionsSnapshot(); const onRowClick = useMentionRowClick(); const onMarkAll = useCallback(() => { markAllRead(); SendMessageComposer(new MarkMentionsReadComposer(0, 0)); }, []); return ( { (mentions.length === 0) ? { LocalizeText('mentions.window.empty') } : mentions.map(mention => ( )) } { (mentions.length > 0) && } ); };