diff --git a/public/css/app.css b/public/css/app.css index a3c0d87..cc7b333 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -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 { diff --git a/src/mail/templates.ts b/src/mail/templates.ts index 1f8f598..a78a814 100644 --- a/src/mail/templates.ts +++ b/src/mail/templates.ts @@ -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 ? `
${escapeHtml(place)}` : ''; + const htmlDirections = input.directions ? `

${escapeHtml(input.directions)}

` : ''; const html = ` @@ -231,6 +235,7 @@ function render(input: {

${escapeHtml(input.greeting)}

${escapeHtml(input.hello)}

${escapeHtml(input.shift.eventTitle)}
${escapeHtml(when)}${htmlPlace}

+${htmlDirections}

${escapeHtml(input.linkLabel)}

${escapeHtml(input.linkNote)} Replies go to ${escapeHtml(input.replyTo)}.

Hope Food Pantry

diff --git a/src/pages.tsx b/src/pages.tsx index 396cd78..97ad4d8 100644 --- a/src/pages.tsx +++ b/src/pages.tsx @@ -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 ( - <> -

{props.cancelled ? 'This signup is cancelled' : "You're signed up"}

-

- {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.`} -

- {props.groupSize && props.groupSize > 1 ?

This signup holds {props.groupSize} spots.

: null} - - {props.managePath ? ( - <> -

- {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.'} +

+
+ +
+

{cancelled ? 'This signup is cancelled' : "You're signed up"}

+

{summary}

+ {props.groupSize && props.groupSize > 1 ? ( +

This signup holds {props.groupSize} spots.

+ ) : null} +
+
+
+

Shift information

+
+

{shift.role}

+

+ + + + {' to '} + {shift.when.sameDay ? null : } + {shift.when.abbreviation} +

- - - ) : ( -

If you just signed up, the link stays in this browser for a few minutes. A confirmation email is on the way.

- )} - + {location ?

{location}

: null} +

{note}

+
+ {props.managePath ? ( + {`${props.config.baseUrl}${props.managePath}`} + ) : null} +
+
); } diff --git a/tests/mail.test.ts b/tests/mail.test.ts index f689996..a46af0e 100644 --- a/tests/mail.test.ts +++ b/tests/mail.test.ts @@ -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('