Skip to content

Commit

Permalink
Visual improvements to receipt emails
Browse files Browse the repository at this point in the history
  • Loading branch information
brundonsmith committed Dec 20, 2023
1 parent 82c9074 commit 685f24a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions back-end/utils/mailgun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function sendMail(email: Email) {
)

if (!res.ok) {
const { html, ...rest } = email
const { html: _, ...rest } = email
throw Error(`Failed to send mailgun email: ${JSON.stringify(rest)}`)
}
}
Expand All @@ -42,8 +42,7 @@ export const receiptEmail = (account: Pick<Tables['account'], 'email_address' |
const purchaseRows = objectEntries(purchases)
.map(([key, count]) =>
`<tr>
<td>${PURCHASE_TYPES_BY_TYPE[key].description}</td>
<td>x${count}</td>
<td>${PURCHASE_TYPES_BY_TYPE[key].description} x${count}</td>
<td>$${(PURCHASE_TYPES_BY_TYPE[key].price_in_cents * count! / 100).toFixed(2)}</td>
</tr>`)
.join('\n')
Expand Down Expand Up @@ -81,12 +80,16 @@ export const receiptEmail = (account: Pick<Tables['account'], 'email_address' |
margin: 0 auto;
max-width: 400px;
}
table {
width: 100%;
}
td {
vertical-align: baseline;
}
td:nth-child(3) {
td:nth-child(2) {
text-align: right;
}
Expand Down Expand Up @@ -123,7 +126,6 @@ export const receiptEmail = (account: Pick<Tables['account'], 'email_address' |
<tr>
<td>Total:</td>
<td></td>
<td>$${totalCost}</td>
</tr>
</table>
Expand Down

0 comments on commit 685f24a

Please sign in to comment.