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
+155
-5
@@ -499,14 +499,164 @@ main a:hover {
|
||||
color: var(--hope-ink-2);
|
||||
}
|
||||
|
||||
.saved-link {
|
||||
margin: 0.85rem 0 0.2rem;
|
||||
overflow-wrap: anywhere;
|
||||
line-height: 1.45;
|
||||
.receipt {
|
||||
display: grid;
|
||||
gap: 1.05rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.saved-link a {
|
||||
.receipt-head {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
gap: 0.85rem 1rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.receipt h1 {
|
||||
margin: 0;
|
||||
font-size: clamp(2rem, 4vw, 2.55rem);
|
||||
}
|
||||
|
||||
.receipt-mark {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 3.35rem;
|
||||
height: 3.35rem;
|
||||
border-radius: 999px;
|
||||
background: var(--hope-yellow);
|
||||
border: 1px solid var(--hope-gold);
|
||||
box-shadow: var(--hope-shadow-soft);
|
||||
color: var(--hope-ink);
|
||||
}
|
||||
|
||||
.receipt.is-cancelled .receipt-mark {
|
||||
background: var(--hope-full);
|
||||
border-color: var(--hope-full-edge);
|
||||
}
|
||||
|
||||
.receipt-mark svg {
|
||||
display: block;
|
||||
width: 1.65rem;
|
||||
height: 1.65rem;
|
||||
}
|
||||
|
||||
.receipt-mark path {
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 2.4;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.receipt-summary {
|
||||
margin: 0.2rem 0 0;
|
||||
}
|
||||
|
||||
.receipt .spots,
|
||||
.receipt-hold {
|
||||
margin-top: 0.65rem;
|
||||
}
|
||||
|
||||
.receipt-hold {
|
||||
display: inline-block;
|
||||
width: fit-content;
|
||||
padding: 0.15rem 0.7rem;
|
||||
border: 1px solid var(--hope-border-2);
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.receipt-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(44rem, 100%);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
border-radius: 1.75rem;
|
||||
box-shadow: var(--hope-shadow);
|
||||
}
|
||||
|
||||
.receipt-banner {
|
||||
margin: 0;
|
||||
padding: 0.75rem 1.15rem;
|
||||
background: var(--hope-yellow);
|
||||
color: var(--hope-ink);
|
||||
font-size: 1.35rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.25;
|
||||
letter-spacing: -0.02em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.receipt.is-cancelled .receipt-banner {
|
||||
background: var(--hope-full);
|
||||
}
|
||||
|
||||
.receipt-body {
|
||||
display: grid;
|
||||
gap: 0.85rem;
|
||||
align-content: start;
|
||||
flex: 1;
|
||||
padding: 1.05rem 1.25rem 1.2rem;
|
||||
}
|
||||
|
||||
.receipt-role,
|
||||
.receipt-when,
|
||||
.receipt-where,
|
||||
.receipt-note {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.receipt-role,
|
||||
.receipt-date,
|
||||
.receipt-clock,
|
||||
.receipt-where {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.receipt-role,
|
||||
.receipt-date,
|
||||
.receipt-where {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.receipt-clock {
|
||||
margin-top: 0.15rem;
|
||||
color: var(--hope-ink-2);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.receipt-note {
|
||||
color: var(--hope-ink-2);
|
||||
font-size: 1.02rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.receipt-link {
|
||||
display: block;
|
||||
margin-top: auto;
|
||||
padding: 0.9rem 1.25rem 1rem;
|
||||
overflow-wrap: anywhere;
|
||||
background: var(--hope-blue-100);
|
||||
color: var(--hope-ink);
|
||||
font-size: 1rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.45;
|
||||
text-decoration: none;
|
||||
user-select: all;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.receipt-link:hover,
|
||||
.receipt-link:active {
|
||||
background: var(--hope-blue-75);
|
||||
color: var(--hope-ink);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.signup-board {
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ describe('transactional mail', () => {
|
||||
expect(rendered.subject).not.toContain('\n');
|
||||
expect(rendered.html).toContain('Pat <script> Review');
|
||||
expect(rendered.html).not.toContain('<script>');
|
||||
expect(rendered.text).toContain('Use the south driveway and park in the parking lot for your shift.');
|
||||
expect(rendered.html).toContain('Use the south driveway and park in the parking lot for your shift.');
|
||||
expect(rendered.text).toContain('http://127.0.0.1:3000/m/token-value-abcdefghijk');
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user