import classNames from 'clsx'; import React, { useRef } from 'react'; import { FormattedDate, FormattedMessage, useIntl } from 'react-intl'; import Icon from 'soapbox/components/icon'; import StatusMedia from 'soapbox/components/status-media'; import StatusReplyMentions from 'soapbox/components/status-reply-mentions'; import StatusContent from 'soapbox/components/status_content'; import SensitiveContentOverlay from 'soapbox/components/statuses/sensitive-content-overlay'; import TranslateButton from 'soapbox/components/translate-button'; import { HStack, Stack, Text } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; import QuotedStatus from 'soapbox/features/status/containers/quoted_status_container'; import { getActualStatus } from 'soapbox/utils/status'; import StatusInteractionBar from './status-interaction-bar'; import type { List as ImmutableList } from 'immutable'; import type { Attachment as AttachmentEntity, Status as StatusEntity } from 'soapbox/types/entities'; interface IDetailedStatus { status: StatusEntity, onOpenMedia: (media: ImmutableList, index: number) => void, onOpenVideo: (media: ImmutableList, start: number) => void, onToggleHidden: (status: StatusEntity) => void, showMedia: boolean, onOpenCompareHistoryModal: (status: StatusEntity) => void, onToggleMediaVisibility: () => void, } const DetailedStatus: React.FC = ({ status, onOpenCompareHistoryModal, onToggleMediaVisibility, showMedia, }) => { const intl = useIntl(); const node = useRef(null); const handleOpenCompareHistoryModal = () => { onOpenCompareHistoryModal(status); }; const actualStatus = getActualStatus(status); if (!actualStatus) return null; const { account } = actualStatus; if (!account || typeof account !== 'object') return null; const isUnderReview = actualStatus.visibility === 'self'; const isSensitive = actualStatus.hidden; let statusTypeIcon = null; let quote; if (actualStatus.quote) { if (actualStatus.pleroma.get('quote_visible', true) === false) { quote = (

); } else { quote = ; } } if (actualStatus.visibility === 'direct') { statusTypeIcon = ; } else if (actualStatus.visibility === 'private') { statusTypeIcon = ; } return (
{(isUnderReview || isSensitive) && ( )} {(quote || actualStatus.card || actualStatus.media_attachments.size > 0) && ( {quote} )} {statusTypeIcon} {actualStatus.edited_at && ( <> {' ยท '}
)}
); }; export default DetailedStatus;