Skip to content

Commit

Permalink
Merge pull request #10944 from wellcomecollection/just-turn-up
Browse files Browse the repository at this point in the history
Just turn up
  • Loading branch information
gestchild authored Jun 12, 2024
2 parents e39efaa + 0da3137 commit 403cbdd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
9 changes: 7 additions & 2 deletions content/webapp/components/EventSchedule/EventSchedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { font } from '@weco/common/utils/classnames';
const EventScheduleList: FunctionComponent<{
groupedEvents: EventsGroup<EventType>[];
isNotLinkedIds: string[];
}> = ({ groupedEvents, isNotLinkedIds }) => (
parentEvent: EventType;
}> = ({ groupedEvents, isNotLinkedIds, parentEvent }) => (
<>
{groupedEvents.map(
eventsGroup =>
Expand All @@ -30,6 +31,7 @@ const EventScheduleList: FunctionComponent<{
{eventsGroup.events.map(event => (
<EventScheduleItem
key={event.id}
parentEvent={parentEvent}
event={event}
isNotLinked={isNotLinkedIds.indexOf(event.id) > -1}
/>
Expand All @@ -41,14 +43,15 @@ const EventScheduleList: FunctionComponent<{
);

type Props = {
parentEvent: EventType;
schedule: EventScheduleType;
};

// Note: if you're working on this component, a good test case is
// "Festival of Minds and Bodies" (XagmOxAAACIAo0v8), which is
// a multi-day event with repeated schedule items. Some of the items
// span multiple days.
const EventSchedule: FunctionComponent<Props> = ({ schedule }) => {
const EventSchedule: FunctionComponent<Props> = ({ parentEvent, schedule }) => {
const events = schedule.map(({ event }) => event);
const groupedEvents = groupEventsByDay(events);
const isNotLinkedIds = schedule
Expand All @@ -75,6 +78,7 @@ const EventSchedule: FunctionComponent<Props> = ({ schedule }) => {
<EventScheduleList
groupedEvents={futureEvents}
isNotLinkedIds={isNotLinkedIds}
parentEvent={parentEvent}
/>
</>
)}
Expand All @@ -84,6 +88,7 @@ const EventSchedule: FunctionComponent<Props> = ({ schedule }) => {
<EventScheduleList
groupedEvents={pastEvents}
isNotLinkedIds={isNotLinkedIds}
parentEvent={parentEvent}
/>
</>
)}
Expand Down
52 changes: 37 additions & 15 deletions content/webapp/components/EventSchedule/EventScheduleItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Place } from '@weco/content/types/places';

type Props = {
event: Event;
parentEvent: Event;
isNotLinked: boolean;
};

Expand Down Expand Up @@ -95,8 +96,33 @@ const eventLocations = (locations: Place[], isHybridEvent: boolean) => {
);
};

// We have a message block on scheduled events which either displays
// 'Just turn up' or 'Arrive early to register'
// We only show this message if:
// - the event isn't past AND
// - it doesn't require booking (either through Eventbrite or by contacting the booking enquiry team) AND
// - it doesn't have it's own event schedule
// We also don't show it if the parent event is Ticketed, unless it will display 'Arrive early to register'
// as we don't want to show 'Just turn up' when the parent event is ticketed
function shouldShowMessage({
event,
parentEvent,
}: {
event: Event;
parentEvent: Event;
}): boolean {
return (
!isEventPast(event) &&
!event.eventbriteId &&
!event.bookingEnquiryTeam &&
!(event.schedule && event.schedule.length > 1) &&
!(parentEvent.bookingType === 'Ticketed' && !event.hasEarlyRegistration)
);
}

const EventScheduleItem: FunctionComponent<Props> = ({
event,
parentEvent,
isNotLinked,
}) => {
const waitForTicketSales =
Expand Down Expand Up @@ -191,21 +217,17 @@ const EventScheduleItem: FunctionComponent<Props> = ({
<EventBookingButton event={event} />
</Space>
)}

{!isEventPast(event) &&
!event.eventbriteId &&
!event.bookingEnquiryTeam &&
!(event.schedule && event.schedule.length > 1) && (
<Space $v={{ size: 'm', properties: ['margin-top'] }}>
<Message
text={`${
event.hasEarlyRegistration
? 'Arrive early to register'
: 'Just turn up'
}`}
/>
</Space>
)}
{shouldShowMessage({ event, parentEvent }) && (
<Space $v={{ size: 'm', properties: ['margin-top'] }}>
<Message
text={`${
event.hasEarlyRegistration
? 'Arrive early to register'
: 'Just turn up'
}`}
/>
</Space>
)}

{event.secondaryLabels.length > 0 && (
<Space $v={{ size: 'm', properties: ['margin-top'] }}>
Expand Down
2 changes: 1 addition & 1 deletion content/webapp/pages/events/[eventId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const EventPage: NextPage<EventProps> = ({
<EventDateList event={event} />
</DateWrapper>
{event.schedule && event.schedule.length > 0 && (
<EventSchedule schedule={event.schedule} />
<EventSchedule parentEvent={event} schedule={event.schedule} />
)}
{event.ticketSalesStart &&
showTicketSalesStart(event.ticketSalesStart) && (
Expand Down

0 comments on commit 403cbdd

Please sign in to comment.