diff --git a/app/soapbox/components/event-preview.tsx b/app/soapbox/components/event-preview.tsx index 74dd69021..2ee688e05 100644 --- a/app/soapbox/components/event-preview.tsx +++ b/app/soapbox/components/event-preview.tsx @@ -19,12 +19,13 @@ const messages = defineMessages({ }); interface IEventPreview { - status: StatusEntity, - className?: string, - hideAction?: boolean; + status: StatusEntity + className?: string + hideAction?: boolean + floatingAction?: boolean } -const EventPreview: React.FC = ({ status, className, hideAction }) => { +const EventPreview: React.FC = ({ status, className, hideAction, floatingAction = true }) => { const intl = useIntl(); const me = useAppSelector((state) => state.me); @@ -32,26 +33,37 @@ const EventPreview: React.FC = ({ status, className, hideAction } const account = status.account as AccountEntity; const event = status.event!; - const banner = status.media_attachments?.find(({ description }) => description === 'Banner'); + const banner = event.banner; + + const action = !hideAction && (account.id === me ? ( + + ) : ( + + )); return (
- {!hideAction && (account.id === me ? ( - - ) : )} + {floatingAction && action}
{banner && {intl.formatMessage(messages.bannerHeader)}}
- {event.name} + + {event.name} + + {!floatingAction && action} +
diff --git a/app/soapbox/components/status-media.tsx b/app/soapbox/components/status-media.tsx index a09ce171a..d1ca296e9 100644 --- a/app/soapbox/components/status-media.tsx +++ b/app/soapbox/components/status-media.tsx @@ -24,8 +24,6 @@ interface IStatusMedia { showMedia?: boolean, /** Callback when visibility is toggled (eg clicked through NSFW). */ onToggleVisibility?: () => void, - /** Whether or not to hide image describer as 'Banner' */ - excludeBanner?: boolean, } /** Render media attachments for a status. */ @@ -35,7 +33,6 @@ const StatusMedia: React.FC = ({ onClick, showMedia = true, onToggleVisibility = () => { }, - excludeBanner = false, }) => { const dispatch = useAppDispatch(); const settings = useSettings(); @@ -43,10 +40,8 @@ const StatusMedia: React.FC = ({ const [mediaWrapperWidth, setMediaWrapperWidth] = useState(undefined); - const mediaAttachments = excludeBanner ? status.media_attachments.filter(({ description, pleroma }) => description !== 'Banner' && pleroma.get('mime_type') !== 'text/html') : status.media_attachments; - - const size = mediaAttachments.size; - const firstAttachment = mediaAttachments.first(); + const size = status.media_attachments.size; + const firstAttachment = status.media_attachments.first(); let media: JSX.Element | null = null; @@ -76,7 +71,7 @@ const StatusMedia: React.FC = ({ if (muted) { media = ( @@ -147,7 +142,7 @@ const StatusMedia: React.FC = ({ {(Component: any) => ( = ({ status }) => { +const EventActionButton: React.FC = ({ status, theme = 'secondary' }) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -86,7 +88,7 @@ const EventActionButton: React.FC = ({ status }) => { return (