Skip to content

Commit b5f8a5f

Browse files
authored
Merge pull request #1839 from Mephistic/fix-email-styles
Email Style Tweaks
2 parents 1928689 + c0090b8 commit b5f8a5f

File tree

9 files changed

+74
-45
lines changed

9 files changed

+74
-45
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}}" target="_blank" rel="noopener noreferrer" 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}}" target="_blank" rel="noopener noreferrer" style="text-decoration: none; color: inherit">
11+
<div style="padding: 12px 0px 12px 12px; 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/bills/bills.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
</div>
1818
<div>
1919
{{#ifGreaterThan numBillsWithNewTestimony 4}}
20-
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
20+
<div style="padding: 12px 0px 12px 12px; background: #EAE7E7;
2121
border-radius: 12px; margin-bottom: 36px;">
22-
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px">
22+
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px; text-align: center">
2323
{{#ifGreaterThan numBillsWithNewTestimony 5}}
2424
{{minusFour numBillsWithNewTestimony}} other bills you follow received testimony since your last update
2525
{{else}}

functions/src/email/partials/header.handlebars

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="logo" style="background-color: #1a3185; padding: 16px 20px 16px 50px">
1+
<div id="logo" style="background-color: #1a3185; padding: 16px 20px 16px 50px; text-align: center;">
22
<img src="https://mapletestimony.org/email/images_no-svgs/Logo.png" alt="Maple Logo" />
33
</div>
44

@@ -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>

functions/src/email/partials/noUpdates.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div style="padding-top: 12px; padding-bottom: 20px; display: block; margin: auto; width: 65%">
1+
<div style="padding-top: 12px; padding-bottom: 20px; display: block; margin: auto; width: 65%; text-align: center;">
22
<img src="https://mapletestimony.org/email/images_no-svgs/empty-mail.png" alt="Empty Mail" />
33
</div>
44
<h5 style="font-weight: 600; font-size: 25px; line-height: 125%; margin-bottom: 0px;

functions/src/email/partials/users/user.handlebars

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
<div style="font-weight: 500; font-size: 22px; line-height: 125%; color: #000000;
55
margin-right: auto"
66
>
7-
{{this.userName}}
7+
<a href="https://mapletestimony.org/profile?id={{this.userId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">{{this.userName}}</a>
88
</div>
99
<div style="margin-right: auto;">
1010
<div style="margin-right: 24px; display: inline-block">
1111
<div style="width: 37px; height: 76px; font-weight: 600; font-size: 61px;
12-
line-height: 125%; letter-spacing: -0.03em; color: #1A3185;
12+
line-height: 125%; letter-spacing: -0.03em; color: #000000;
1313
margin-left: auto; margin-right: auto;"
1414
>
1515
{{this.newTestimonyCount}}
1616
</div>
1717
<div style="font-weight: 700; font-size: 16px; line-height: 125%; letter-spacing: 0.015em;
1818
color: #000000; width: 135px"
1919
>
20-
New Testimonies
20+
{{#ifGreaterThan this.newTestimonyCount 1}}
21+
New Testimonies
22+
{{else}}
23+
New Testimony
24+
{{/ifGreaterThan}}
2125
</div>
2226
</div>
2327
<table style="display: inline-block; margin: 0; padding: 0">
@@ -31,7 +35,9 @@
3135
{{#if this.bills.0.billId}}
3236
<td style="width: 75px">
3337
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
34-
{{this.bills.0.billId}}
38+
<a href="https://mapletestimony.org/bills/{{this.bills.0.court}}/{{this.bills.0.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
39+
{{this.bills.0.billId}}
40+
</a>
3541
</div>
3642
</td>
3743
<td style="width: 75px">
@@ -46,7 +52,9 @@
4652
{{#if this.bills.1.billId}}
4753
<td style="width: 75px">
4854
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
49-
{{this.bills.1.billId}}
55+
<a href="https://mapletestimony.org/bills/{{this.bills.1.court}}/{{this.bills.1.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
56+
{{this.bills.1.billId}}
57+
</a>
5058
</div>
5159
</td>
5260
<td style="width: 75px">
@@ -62,7 +70,9 @@
6270
{{#if this.bills.2.billId}}
6371
<td style="width: 75px">
6472
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
65-
{{this.bills.2.billId}}
73+
<a href="https://mapletestimony.org/bills/{{this.bills.2.court}}/{{this.bills.2.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
74+
{{this.bills.2.billId}}
75+
</a>
6676
</div>
6777
</td>
6878
<td style="width: 75px">
@@ -77,7 +87,9 @@
7787
{{#if this.bills.3.billId}}
7888
<td style="width: 75px">
7989
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
80-
{{this.bills.3.billId}}
90+
<a href="https://mapletestimony.org/bills/{{this.bills.3.court}}/{{this.bills.3.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
91+
{{this.bills.3.billId}}
92+
</a>
8193
</div>
8294
</td>
8395
<td style="width: 75px">
@@ -94,7 +106,9 @@
94106
{{#if this.bills.4.billId}}
95107
<td style="width: 75px">
96108
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
97-
{{this.bills.4.billId}}
109+
<a href="https://mapletestimony.org/bills/{{this.bills.4.court}}/{{this.bills.4.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
110+
{{this.bills.4.billId}}
111+
</a>
98112
</div>
99113
</td>
100114
<td style="width: 75px">
@@ -109,7 +123,7 @@
109123
{{#if this.bills.5.billId}}
110124
{{#if this.bills.6.billId}}
111125
<td style="width: 75px">
112-
<a class="orgItemText" href="https://mapletestimony.org/profile" target="_blank" rel="noopener noreferrer">
126+
<a class="orgItemText" href="https://mapletestimony.org/profile?id={{userId}}" target="_blank" rel="noopener noreferrer">
113127
see more
114128
</a>
115129
</td>
@@ -121,7 +135,9 @@
121135
{{else}}
122136
<td style="width: 75px">
123137
<div style="text-decoration-line: underline; display: inline-block; margin-right: 15px">
124-
{{this.bills.5.billId}}
138+
<a href="https://mapletestimony.org/bills/{{this.bills.5.court}}/{{this.bills.5.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">
139+
{{this.bills.5.billId}}
140+
</a>
125141
</div>
126142
</td>
127143
<td style="width: 75px">

functions/src/email/partials/users/users.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
</div>
2323
<div></div>
2424
{{#ifGreaterThan numUsersWithNewTestimony 4}}
25-
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
25+
<div style="padding: 12px 0px 12px 12px; background: #EAE7E7;
2626
border-radius: 12px; margin-bottom: 36px;">
27-
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px">
27+
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px; text-align: center">
2828
{{#ifGreaterThan numUsersWithNewTestimony 5}}
2929
{{minusFour numUsersWithNewTestimony}} other users you follow posted testimony since your last update
3030
{{else}}

0 commit comments

Comments
 (0)