import classNames from 'clsx'; import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import EventActionButton from 'soapbox/features/event/components/event-action-button'; import EventDate from 'soapbox/features/event/components/event-date'; import { useAppSelector } from 'soapbox/hooks'; import Icon from './icon'; import { Button, HStack, Stack, Text } from './ui'; import VerificationBadge from './verification_badge'; import type { Account as AccountEntity, Status as StatusEntity } from 'soapbox/types/entities'; const messages = defineMessages({ bannerHeader: { id: 'event.banner', defaultMessage: 'Event banner' }, leaveConfirm: { id: 'confirmations.leave_event.confirm', defaultMessage: 'Leave event' }, leaveMessage: { id: 'confirmations.leave_event.message', defaultMessage: 'If you want to rejoin the event, the request will be manually reviewed again. Are you sure you want to proceed?' }, }); interface IEventPreview { status: StatusEntity, className?: string, hideAction?: boolean; } const EventPreview: React.FC = ({ status, className, hideAction }) => { const intl = useIntl(); const me = useAppSelector((state) => state.me); const account = status.account as AccountEntity; const event = status.event!; const banner = status.media_attachments?.find(({ description }) => description === 'Banner'); return (
{!hideAction && (account.id === me ? ( ) : )}
{banner && {intl.formatMessage(messages.bannerHeader)}}
{event.name}
{account.verified && } {event.location && ( {event.location.get('name')} )}
); }; export default EventPreview;