diff --git a/emails/showSubmission.tsx b/emails/showSubmission.tsx index 300488a..16ae76d 100644 --- a/emails/showSubmission.tsx +++ b/emails/showSubmission.tsx @@ -27,7 +27,7 @@ interface EmailProps { showDateStart: string; showDateEnd: string; showType: "Live" | "Pre-record"; - severity: "confirmation" | "confirmation" | "initial" | "follow-up" | "late"; + severity: "confirmation" | "initial" | "follow-up" | "late"; showId: string; } @@ -39,8 +39,8 @@ const baseUrl = "https://refugeworldwide.com/"; export const ShowSubmissionEmail = ({ userName = "Gramrcy", - showDateStart = "2024-05-15T15:00:00.000Z", - showDateEnd = "2024-05-15T17:00:00.000Z", + showDateStart = "2025-05-15T15:00:00.000Z", + showDateEnd = "2025-05-15T17:00:00.000Z", showType = "Live", severity = "confirmation", showId = "7JIvNxsqyZcPZsw2PJGzIx", @@ -58,6 +58,24 @@ export const ShowSubmissionEmail = ({ .format("dddd Do MMMM"); const submitUrl = baseUrl + "submission-v2?id=" + showId; const showFormLink = startDate.diff(dayjs(), "day") < 10; + + const emailContent = () => { + switch (severity) { + case "initial": + return initialText(formattedDate, submitUrl, submissionDeadlineDate); + case "follow-up": + return followUpText(formattedDate, submitUrl, submissionDeadlineDate); + case "late": + return lateText(formattedDate, submitUrl, submissionDeadlineDate); + default: + return confirmationText( + formattedDate, + showFormLink, + submitUrl, + submissionDeadlineDate + ); + } + }; return ( @@ -86,65 +104,7 @@ export const ShowSubmissionEmail = ({ > Hi {userName},{" "} - - {severity == "confirmation" ? ( - - This email confirms your show on Refuge Worldwide on{" "} - {formattedDate}. - {!showFormLink && ( - <> - {" "} - You’ll receive an email from us closer to your show date - – in the meantime, please feel free to add it to your - calendar. - - )}{" "} - We look forward to welcoming you to the station! - {showFormLink && ( - <> - {" "} - Please fill out the{" "} - - submission form - {" "} - linked below as soon as possible and by{" "} - - {submissionDeadlineDate} at the latest - - . - - )} - - ) : ( - - {severity == "follow-up" && <>Final call for info! } - {severity == "late" && ( - - Your submission is late!{" "} - - )} - We need some essential information ahead of your show on{" "} - {formattedDate}. Please fill out the{" "} - - submission form - {" "} - linked below{" "} - {severityText(severity, submissionDeadlineDate)}. - - )} - {showFormLink && ( - <> - - - )} + {emailContent()}
Your upcoming show @@ -189,11 +149,69 @@ export const ShowSubmissionEmail = ({ ); }; -const severityText = (level: string, date: string) => { - if (level == "initial") { - return ( - - as soon as possible and by{" "} +const confirmationText = ( + formattedDate: string, + showFormLink: boolean, + submitUrl: string, + submissionDeadlineDate: string +) => { + return ( + <> + + This email confirms your show on Refuge Worldwide on {formattedDate}. + {!showFormLink && ( + <> + {" "} + You’ll receive an email from us closer to the date of your show – in + the meantime, please feel free to add it to your calendar. We look + forward to welcoming you to the station! + + )}{" "} + We look forward to welcoming you to the station! + + {showFormLink && ( + <> + + Please fill out the{" "} + + submission form + {" "} + linked below as soon as possible and by{" "} + + {submissionDeadlineDate} at the latest + + + {submissionButton(submitUrl)} + + )} + + Please note: Any previously confirmed shows taking place before this one + are still happening! + + + ); +}; + +const initialText = ( + formattedDate: string, + submitUrl: string, + submissionDeadlineDate: string +) => { + return ( + <> + + We need some essential information ahead of your show on {formattedDate} + . Please fill out the{" "} + + submission form + {" "} + linked below as soon as possible and by{" "} { fontWeight: "bold", }} > - {date} at the latest + {submissionDeadlineDate} at the latest. - - ); - } else if (level == "follow-up") { - return ( - + + {submissionButton(submitUrl)} + + Completion of the submission form is required to confirm your attendance + in person on the day (or that you will submit your pre-recorded show on + time). Failure to complete the form by the specified date will result in + your show being rescheduled or cancelled. + + + Please get in touch by replying to this email if there are any questions + or issues! + + + ); +}; + +const followUpText = ( + formattedDate: string, + submitUrl: string, + submissionDeadlineDate: string +) => { + return ( + <> + + Final call for info! We need some essential information ahead of your + show on {formattedDate}. Please fill out the{" "} + + submission form + {" "} + linked below as soon as possible and{" "} { fontWeight: "bold", }} > - as soon as possible + no later than the end of the day tomorrow. + + + {submissionButton(submitUrl)} + + + Please remember: {" "} - and no later than tomorrow - - ); - } else { - return ( - + Completion of the submission form is required to confirm your attendance + in person on the day (or that you will submit your pre-recorded show on + time). Failure to complete the form by the specified date will result in + your show being rescheduled or cancelled. + + + Please get in touch by replying to this email if there are any questions + or issues! + + + ); +}; + +const lateText = ( + formattedDate: string, + submitUrl: string, + submissionDeadlineDate: string +) => { + return ( + <> + + Your submission is late! We need some essential information ahead of + your show on {formattedDate}. Please fill out the{" "} + + submission form + {" "} + linked below by the end of the day today. Failure to complete the form + will result in your show being rescheduled or cancelled. + + {submissionButton(submitUrl)} + { fontWeight: "bold", }} > - by the end of today{" "} - - otherwise we will have to sadly cancel your show - - ); - } + Please remember: + {" "} + Failure to complete the form by the specified date will result in your + show being rescheduled or cancelled. Consistent late submissions will + count against the possibility of future shows – we hope you understand. + + + Please get in touch by replying to this email if there are any questions + or issues! + + + ); +}; + +const submissionButton = (submitUrl: string) => { + return ( + + ); }; export const preview = (severity: string) => {