import classNames from 'classnames'; import { isNil } from 'lodash'; import { MouseEvent, ReactNode, useCallback } from 'react'; import { contextMenu } from 'react-contexify'; import { createPortal } from 'react-dom'; import { useDispatch } from 'react-redux'; import { CSSProperties } from 'styled-components'; import { Avatar, AvatarSize } from '../../avatar/Avatar'; import { openConversationWithMessages } from '../../../state/ducks/conversations'; import { updateUserDetailsModal } from '../../../state/ducks/modalDialog'; import { ContextConversationProvider, useConvoIdFromContext, } from '../../../contexts/ConvoIdContext'; import { useAvatarPath, useConversationUsername, useHasUnread, useIsBlocked, useIsPrivate, useMentionedUs, } from '../../../hooks/useParamSelector'; import { useIsSearching } from '../../../state/selectors/search'; import { useSelectedConversationKey } from '../../../state/selectors/selectedConversation'; import { SpacerXS } from '../../basic/Text'; import { MemoConversationListItemContextMenu } from '../../menu/ConversationListItemContextMenu'; import { ConversationListItemHeaderItem } from './HeaderItem'; import { MessageItem } from './MessageItem'; const Portal = ({ children }: { children: ReactNode }) => { return createPortal(children, document.querySelector('.inbox.index') as Element); }; const AvatarItem = () => { const conversationId = useConvoIdFromContext(); const userName = useConversationUsername(conversationId); const isPrivate = useIsPrivate(conversationId); const avatarPath = useAvatarPath(conversationId); const dispatch = useDispatch(); function onPrivateAvatarClick() { dispatch( updateUserDetailsModal({ conversationId, userName: userName || '', authorAvatarPath: avatarPath, }) ); } return (