Skip to content

Commit 2203160

Browse files
committed
fix(email): Fixing styles in notification email header + bills section based on user feedback, adding hyperlinks from bills to the respective bill page on MAPLE
1 parent 1928689 commit 2203160

File tree

5 files changed

+42
-29
lines changed

5 files changed

+42
-29
lines changed

functions/src/email/digestEmail.handlebars

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<html>
22
<head>
33
<title>Digest Email</title>
4-
<link rel="stylesheet" type="text/css" href="https://mapletestimony.org/email/style.css" />
54
</head>
65

76
<body style="background: white; width: 600px; min-height: 80vh; font-family: 'Nunito';

functions/src/email/handlebarsHelpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const registerHelpers = () => {
1414
handlebars.registerHelper("minusFour", helpers.minusFour)
1515
handlebars.registerHelper("noUpdatesFormat", helpers.noUpdatesFormat)
1616
handlebars.registerHelper("toLowerCase", helpers.toLowerCase)
17+
handlebars.registerHelper("pluralize", helpers.pluralize)
1718
}
1819

1920
// Register all Handlebars partials

functions/src/email/helpers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { BillDigest } from "../notifications/emailTypes"
2+
13
export function addCounts() {
24
let sum = 0
35
for (let i = 0; i < arguments.length - 1; i++) {
@@ -56,3 +58,12 @@ export function toLowerCase(aString: unknown) {
5658
console.error(`toLowerCase received a non-string value: ${aString}`)
5759
return undefined
5860
}
61+
62+
// TODO: This will be replaced by I18n logic when we implement it for emails
63+
export function pluralize(bill: BillDigest): string {
64+
if (bill.endorseCount + bill.neutralCount + bill.opposeCount === 1) {
65+
return "Testimony"
66+
} else {
67+
return "Testimonies"
68+
}
69+
}
Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
<article id="bill">
2-
<div style="font-weight: 500; font-size: 22px; line-height: 125%;
3-
text-decoration-line: underline; color: #000000; margin-bottom: 24px">
4-
{{this.billId}}
2+
<div style="font-weight: 500; font-size: 20px; line-height: 125%;
3+
text-decoration-line: underline; color: #000000; margin-bottom: 4px">
4+
<a href="https://mapletestimony.org/bills/{{this.billCourt}}/{{this.billId}}" style="color: inherit">{{this.billId}}</a>
55
</div>
6-
<div style="font-weight: 600; font-size: 12px; line-height: 125%;
6+
<div style="font-weight: 600; font-size: 16px; line-height: 125%;
77
color: #000000; letter-spacing: 0.03em; margin-bottom: 24px">
88
{{this.billName}}
99
</div>
10-
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
11-
border-radius: 12px; margin-bottom: 36px;">
12-
<div>
13-
<div style="height: 49px; font-weight: 500; font-size: 39px; line-height: 125%;
14-
letter-spacing: -0.015em; color: #000000; margin: auto; text-align: center">
15-
{{addCounts this.endorseCount this.neutralCount this.opposeCount}}
10+
<a href="https://mapletestimony.org/bills/{{this.billCourt}}/{{this.billId}}" style="text-decoration: none; color: inherit">
11+
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
12+
border-radius: 12px; margin-bottom: 12px; text-align: center">
13+
<div>
14+
<div style="height: 49px; font-weight: 500; font-size: 39px; line-height: 125%;
15+
letter-spacing: -0.015em; color: #000000; margin: auto; text-align: center">
16+
{{addCounts this.endorseCount this.neutralCount this.opposeCount}}
17+
</div>
18+
</div>
19+
<div style="height: 20px; font-weight: 700; font-size: 16px; line-height: 125%;
20+
letter-spacing: 0.015em; color: #3E3E3E; margin: auto; text-align: center">
21+
New {{pluralize this}}
22+
</div>
23+
<div style="height: 19px; font-weight: 700; font-size: 14px; line-height: 100%;
24+
color: #000000; margin: auto; padding: 16px 0px 26px 0px;
25+
text-align: center">
26+
<img src="https://mapletestimony.org/email/images_no-svgs/endorse.png" alt="checkmark" style="padding-right: 18px"/>
27+
{{this.endorseCount}} Endorse
28+
<img src="https://mapletestimony.org/email/images_no-svgs/neutral.png" alt="dash" style="padding: 0 18px"/>
29+
{{this.neutralCount}} Neutral
30+
<img src="https://mapletestimony.org/email/images_no-svgs/oppose.png" alt="x-mark" style="padding: 0 18px"/>
31+
{{this.opposeCount}} Oppose
1632
</div>
1733
</div>
18-
<div style="height: 20px; font-weight: 700; font-size: 16px; line-height: 125%;
19-
letter-spacing: 0.015em; color: #3E3E3E; margin: auto; text-align: center">
20-
New Testimonies
21-
</div>
22-
<div style="height: 19px; font-weight: 700; font-size: 14px; line-height: 100%;
23-
color: #000000; margin: auto; padding: 16px 0px 26px 0px;
24-
text-align: center">
25-
<img src="https://mapletestimony.org/email/images_no-svgs/endorse.png" alt="checkmark" style="padding-right: 18px"/>
26-
{{this.endorseCount}} Endorse
27-
<img src="https://mapletestimony.org/email/images_no-svgs/neutral.png" alt="dash" style="padding: 0 18px"/>
28-
{{this.neutralCount}} Neutral
29-
<img src="https://mapletestimony.org/email/images_no-svgs/oppose.png" alt="x-mark" style="padding: 0 18px"/>
30-
{{this.opposeCount}} Oppose
31-
</div>
32-
</div>
34+
</a>
3335
</article>

functions/src/email/partials/header.handlebars

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
report
1212
</h2>
1313
<h2 style="font-weight: 700; font-size: 31px; line-height: 125%; margin: auto; width: 80%; color: #1a3185">
14-
of the Bills and Users you follow!
14+
of the bills and users you follow!
1515
</h2>
16-
<p class="subheadline blue center" style="font-weight: 600; font-size: 12px; line-height: 125%;
16+
<p class="subheadline blue center" style="font-weight: 600; font-size: 16px; line-height: 125%;
1717
color: #1a3185; display: block; margin: auto; width: 30%">
1818
{{formatDate startDate}} - {{formatDate endDate}}
1919
</p>
2020
</div>
21-
<img src="https://mapletestimony.org/email/images_no-svgs/Mail Report.png" alt="Report" style="display: block; margin: auto; width: 32%" />
21+
<img src="https://mapletestimony.org/email/images_no-svgs/Mail Report.png" alt="Report" style="display: block; margin: auto; width: 16%" />
2222
</header>

0 commit comments

Comments
 (0)