feat: enhance confirmation page and email templates with receipt layout and directions
Refactored the ConfirmationPage component to utilize a new receipt layout for improved clarity on signup status. Added a directions note to the email templates for better user guidance. Updated styles for the receipt elements to ensure consistency and visual appeal.
This commit is contained in:
1 parent
cc8b3ef114
commit
b039eef5ae
4 files changed
+210
-28
No files matched your search
@@ -32,6 +32,7 @@ export function renderConfirmation(input: {
|
||||
hello: `You are signed up for ${role}.${partyNote(input.groupSize)}`,
|
||||
greeting: `Hello ${name},`,
|
||||
shift: input.shift,
|
||||
directions: 'Use the south driveway and park in the parking lot for your shift.',
|
||||
linkLabel: 'Open this signup',
|
||||
linkNote: 'You can cancel or switch this signup from that link. Use the separate link for each signup.',
|
||||
manageUrl: input.manageUrl,
|
||||
@@ -196,6 +197,7 @@ function render(input: {
|
||||
greeting: string;
|
||||
hello: string;
|
||||
shift: MailShift;
|
||||
directions?: string;
|
||||
linkLabel: string;
|
||||
linkNote: string;
|
||||
manageUrl: string;
|
||||
@@ -211,6 +213,7 @@ function render(input: {
|
||||
input.shift.eventTitle,
|
||||
when,
|
||||
...(place ? [place] : []),
|
||||
...(input.directions ? ['', input.directions] : []),
|
||||
'',
|
||||
`${input.linkLabel}:`,
|
||||
input.manageUrl,
|
||||
@@ -221,6 +224,7 @@ function render(input: {
|
||||
'Hope Food Pantry',
|
||||
];
|
||||
const htmlPlace = place ? `<br>${escapeHtml(place)}` : '';
|
||||
const htmlDirections = input.directions ? `<p>${escapeHtml(input.directions)}</p>` : '';
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -231,6 +235,7 @@ function render(input: {
|
||||
<p>${escapeHtml(input.greeting)}</p>
|
||||
<p>${escapeHtml(input.hello)}</p>
|
||||
<p>${escapeHtml(input.shift.eventTitle)}<br>${escapeHtml(when)}${htmlPlace}</p>
|
||||
${htmlDirections}
|
||||
<p><a href="${escapeHtml(input.manageUrl)}" style="color:#222">${escapeHtml(input.linkLabel)}</a></p>
|
||||
<p>${escapeHtml(input.linkNote)} Replies go to ${escapeHtml(input.replyTo)}.</p>
|
||||
<p>Hope Food Pantry</p>
|
||||
|
||||
+48
-23
@@ -297,31 +297,56 @@ export function ConfirmationPage(props: {
|
||||
groupSize?: number;
|
||||
cancelled?: boolean;
|
||||
}) {
|
||||
const shift = props.shift;
|
||||
const cancelled = Boolean(props.cancelled);
|
||||
const summary = cancelled
|
||||
? `${props.name ? `${props.name} is no longer on the ` : 'This signup is no longer for the '}${shift.role} shift.`
|
||||
: `${props.name ? `${props.name} is on the ` : 'This signup is for the '}${shift.role} shift.`;
|
||||
const note = props.managePath
|
||||
? cancelled
|
||||
? 'A cancellation email is on the way. The address below still opens this cancelled signup.'
|
||||
: 'A confirmation email is on the way. Save the address below in case the email is late. This browser keeps it for a few minutes. Use it to cancel or switch to a different shift.'
|
||||
: 'If you just signed up, the link stays in this browser for a few minutes. A confirmation email is on the way.';
|
||||
const location = shift.event.location.trim();
|
||||
return (
|
||||
<>
|
||||
<h1>{props.cancelled ? 'This signup is cancelled' : "You're signed up"}</h1>
|
||||
<p>
|
||||
{props.cancelled
|
||||
? `${props.name ? `${props.name} is no longer on the ` : 'This signup is no longer for the '}${props.shift.role} shift.`
|
||||
: `${props.name ? `${props.name} is on the ` : 'This signup is for the '}${props.shift.role} shift.`}
|
||||
</p>
|
||||
{props.groupSize && props.groupSize > 1 ? <p>This signup holds {props.groupSize} spots.</p> : null}
|
||||
<ShiftWhen shift={props.shift} />
|
||||
{props.managePath ? (
|
||||
<>
|
||||
<p>
|
||||
{props.cancelled
|
||||
? 'A cancellation email is on the way. The address below still opens this cancelled signup.'
|
||||
: 'A confirmation email is on the way. Save the address below in case the email is late. This browser keeps it for a few minutes. Use it to cancel or switch to a different shift.'}
|
||||
<article class={cancelled ? 'receipt is-cancelled' : 'receipt'}>
|
||||
<header class="receipt-head">
|
||||
<span class="receipt-mark" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" focusable="false">
|
||||
<path d={cancelled ? 'M7 7l10 10M17 7 7 17' : 'M5 12.5 9.2 16.7 19 7'} />
|
||||
</svg>
|
||||
</span>
|
||||
<div>
|
||||
<h1>{cancelled ? 'This signup is cancelled' : "You're signed up"}</h1>
|
||||
<p class="receipt-summary">{summary}</p>
|
||||
{props.groupSize && props.groupSize > 1 ? (
|
||||
<p class={cancelled ? 'receipt-hold' : 'spots is-open'}>This signup holds {props.groupSize} spots.</p>
|
||||
) : null}
|
||||
</div>
|
||||
</header>
|
||||
<section class="receipt-card">
|
||||
<h2 class="receipt-banner">Shift information</h2>
|
||||
<div class="receipt-body">
|
||||
<p class="receipt-role">{shift.role}</p>
|
||||
<p class="receipt-when">
|
||||
<time class="receipt-date" dateTime={shift.when.date}>
|
||||
{shift.when.dateLabel}
|
||||
</time>
|
||||
<span class="receipt-clock">
|
||||
<time dateTime={shift.startsAtUtc}>{shift.when.startLabel}</time>
|
||||
{' to '}
|
||||
{shift.when.sameDay ? null : <time dateTime={shift.endsAtUtc}>{shift.when.endDateLabel} </time>}
|
||||
<time dateTime={shift.endsAtUtc}>{shift.when.endLabel}</time> {shift.when.abbreviation}
|
||||
</span>
|
||||
</p>
|
||||
<p class="saved-link">
|
||||
<a href={props.managePath}>{`${props.config.baseUrl}${props.managePath}`}</a>
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p>If you just signed up, the link stays in this browser for a few minutes. A confirmation email is on the way.</p>
|
||||
)}
|
||||
</>
|
||||
{location ? <p class="receipt-where">{location}</p> : null}
|
||||
<p class="receipt-note">{note}</p>
|
||||
</div>
|
||||
{props.managePath ? (
|
||||
<a class="receipt-link" href={props.managePath}>{`${props.config.baseUrl}${props.managePath}`}</a>
|
||||
) : null}
|
||||
</section>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user