Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #378 from redbadger/updateCallToActionStates
Browse files Browse the repository at this point in the history
Don't suggest 'watch video here', when there is no video
  • Loading branch information
kephail authored Aug 12, 2020
2 parents edabbde + 07d2f58 commit a4b476c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
11 changes: 3 additions & 8 deletions shared/components/TicketStatus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export const StatusButton = ({ buttonText, buttonLink }) => {
});
return (
<div className="TicketStatus__booking-btn__container">
<a
className={actionClasses}
href={buttonLink}
>
<a className={actionClasses} href={buttonLink}>
{buttonText}
</a>
</div>
Expand All @@ -23,10 +20,8 @@ const TicketStatus = (props) => {
const { title } = props;
return (
<div className="TicketStatus__section TicketStatus__section__booking">
<p className="TicketStatus__live-stream-text">
{title}
</p>
<StatusButton {...props} />
<p className="TicketStatus__live-stream-text">{title}</p>
{props.buttonLink && <StatusButton {...props} />}
</div>
);
};
Expand Down
32 changes: 23 additions & 9 deletions shared/utilities/ticket-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const statusTypes = {
linkType: 'registrationClosedLink',
},
LIVE_STREAM: {
title: 'Couldn\'t make it? Watch the event live.',
title: "Couldn't make it? Watch the event live.",
subtitle: 'Didn’t make it to the meetup? We got your back.',
buttonText: 'Watch Live Stream',
linkType: 'streamingLink',
},
EVENT_ENDED: {
title: 'This event has ended. Watch the video here.',
title: 'This event has ended.',
subtitle: 'Tickets now sold out.',
buttonText: 'Watch Video',
linkType: 'streamingLink',
Expand All @@ -40,21 +40,26 @@ const statusTypes = {

export function getTicketProvider(link) {
if (!link) {
return 'our ticket provider\'s website';
return "our ticket provider's website";
}
if (link.includes('skillsmatter')) {
return 'Skillsmatter';
}
if (link.includes('ti.to')) {
return 'Ti.to';
}
return 'our ticket provider\'s website';
return "our ticket provider's website";
}

export function getTicketStatusTitle(event, ticketStatusOptions) {
if (event.status === 'PRE_RELEASE') {
return ticketStatusOptions.title + formatDate(event.ticketReleaseDate,
'dddd, Do MMMM YYYY, HH:mm');
return (
ticketStatusOptions.title +
formatDate(event.ticketReleaseDate, 'dddd, Do MMMM YYYY, HH:mm')
);
}
if (event.status === 'EVENT_ENDED' && ticketStatusOptions.buttonLink) {
return ticketStatusOptions.title + ' Watch the video here.';
}
return ticketStatusOptions.title;
}
Expand All @@ -64,7 +69,10 @@ export function getTicketStatusSubtitle(event, ticketStatusOptions) {
return formatDate(event.ticketReleaseDate, 'dddd, Do MMMM YYYY, HH:mm');
}
if (event.status === 'TICKETS_LIVE' || event.status === 'WAITLIST') {
return ticketStatusOptions.subtitle + getTicketProvider(ticketStatusOptions.buttonLink);
return (
ticketStatusOptions.subtitle +
getTicketProvider(ticketStatusOptions.buttonLink)
);
}
return ticketStatusOptions.subtitle;
}
Expand All @@ -73,8 +81,14 @@ export function getTicketStatusOptions(event) {
if (statusTypes[event.status]) {
const ticketStatusOptions = { ...statusTypes[event.status] };
ticketStatusOptions.buttonLink = event[ticketStatusOptions.linkType];
ticketStatusOptions.title = getTicketStatusTitle(event, ticketStatusOptions);
ticketStatusOptions.subtitle = getTicketStatusSubtitle(event, ticketStatusOptions);
ticketStatusOptions.title = getTicketStatusTitle(
event,
ticketStatusOptions
);
ticketStatusOptions.subtitle = getTicketStatusSubtitle(
event,
ticketStatusOptions
);
return ticketStatusOptions;
}
return {
Expand Down

0 comments on commit a4b476c

Please sign in to comment.