diff --git a/app/soapbox/features/event/event-information.tsx b/app/soapbox/features/event/event-information.tsx index 4b9f6c0a4..557c3abfa 100644 --- a/app/soapbox/features/event/event-information.tsx +++ b/app/soapbox/features/event/event-information.tsx @@ -59,6 +59,44 @@ const EventInformation: React.FC = ({ params }) => { const renderEventLocation = useCallback(() => { const event = status!.event!; + if (!event.location) return null; + + const text = [ + + {event.location.get('name')} + , + ]; + + if (event.location.get('street')?.trim()) { + text.push ( + +
{event.location.get('street')} +
, + ); + } + + const address = [event.location.get('postalCode'), event.location.get('locality'), event.location.get('country')].filter(text => text).join(', '); + + if (address) { + text.push( + +
+ {address} +
, + ); + } + + if (tileServer && event.location.get('latitude')) { + text.push( + +
+ + + +
, + ); + } + return event.location && ( @@ -66,21 +104,7 @@ const EventInformation: React.FC = ({ params }) => { - - {event.location.get('name')} -
- {!!event.location.get('street')?.trim() && (<> - {event.location.get('street')} -
- )} - {[event.location.get('postalCode'), event.location.get('locality'), event.location.get('country')].filter(text => text).join(', ')} - {tileServer && event.location.get('latitude') && (<> -
- - - - )} -
+ {text}
);