placementt-core 1.400.743 → 1.400.744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/emailSections.js +76 -38
- package/lib/emailSections.js.map +1 -1
- package/package.json +1 -1
- package/src/emailSections.ts +80 -38
package/lib/emailSections.js
CHANGED
|
@@ -28,39 +28,69 @@ function sectionStyles(color) {
|
|
|
28
28
|
exports.upcomingEventsSection = {
|
|
29
29
|
id: "upcomingEvents",
|
|
30
30
|
title: "Upcoming Events",
|
|
31
|
-
description: "A
|
|
31
|
+
description: "A grid of upcoming school and institute events that employers can sign up to attend.",
|
|
32
32
|
forTemplates: ["employersEmailCampaign"],
|
|
33
33
|
render: ({ placeholder, events, oId, primaryColor: pc }) => {
|
|
34
34
|
const color = pc || PRIMARY_COLOUR;
|
|
35
35
|
const s = sectionStyles(color);
|
|
36
36
|
const displayEvents = placeholder ? [
|
|
37
37
|
{ title: "Mock Interviews Day", startDate: "15 May 2025", activityType: "mockInterviews", location: "School Main Hall" },
|
|
38
|
-
{ title: "Annual Careers Fair", startDate: "22 May 2025", activityType: "workExperience", location: "Town Hall" },
|
|
39
|
-
{ title: "Mentoring Programme", startDate: "5 June 2025", activityType: "mentoring"
|
|
38
|
+
{ title: "Annual Careers Fair", startDate: "22 May 2025", endDate: "23 May 2025", activityType: "workExperience", location: "Town Hall" },
|
|
39
|
+
{ title: "Mentoring Programme", startDate: "5 June 2025", activityType: "mentoring" },
|
|
40
|
+
{ title: "Workplace Visit Day", startDate: "12 June 2025", activityType: "workplaceVisits", location: "City Centre" },
|
|
40
41
|
] : (events || []);
|
|
41
42
|
if (!displayEvents.length)
|
|
42
43
|
return "";
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const hexToRgba = (hex, alpha) => {
|
|
45
|
+
try {
|
|
46
|
+
const clean = hex.replace("#", "");
|
|
47
|
+
const r = parseInt(clean.slice(0, 2), 16);
|
|
48
|
+
const g = parseInt(clean.slice(2, 4), 16);
|
|
49
|
+
const b = parseInt(clean.slice(4, 6), 16);
|
|
50
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return `rgba(57,125,242,${alpha})`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const bgColor = hexToRgba(color, 0.75);
|
|
57
|
+
const makeCard = (event) => {
|
|
58
|
+
const dateStr = event.endDate && event.endDate !== event.startDate
|
|
59
|
+
? `${event.startDate} – ${event.endDate}`
|
|
60
|
+
: event.startDate;
|
|
61
|
+
const eventLink = oId ? `https://careerthread.co.uk/publicEvents/${oId}` : "#";
|
|
62
|
+
const imgStyle = event.image
|
|
63
|
+
? `height:140px;background-image:url('${event.image}');background-size:cover;background-position:center;`
|
|
64
|
+
: `height:140px;background-color:${bgColor};`;
|
|
65
|
+
return `
|
|
66
|
+
<div style="border-radius:12px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,0.12);background:#ffffff;">
|
|
67
|
+
<div style="${imgStyle}"></div>
|
|
68
|
+
<div style="padding:12px 14px 14px;">
|
|
69
|
+
<p style="font-weight:bold;font-size:14px;margin:0 0 3px 0;font-family:nunito,sans-serif;color:#333;line-height:1.3;">${event.title}</p>
|
|
70
|
+
<p style="font-size:12px;color:#888;margin:0 0 12px 0;font-family:nunito,sans-serif;">${dateStr}</p>
|
|
71
|
+
<a href="${eventLink}" style="display:block;background-color:${color};color:#ffffff;text-align:center;padding:9px 12px;border-radius:6px;text-decoration:none;font-size:13px;font-family:nunito,sans-serif;font-weight:bold;">View Event</a>
|
|
72
|
+
</div>
|
|
73
|
+
</div>`;
|
|
74
|
+
};
|
|
75
|
+
const cardRows = [];
|
|
76
|
+
for (let i = 0; i < displayEvents.length; i += 2) {
|
|
77
|
+
const second = displayEvents[i + 1];
|
|
78
|
+
cardRows.push(`
|
|
79
|
+
<tr>
|
|
80
|
+
<td class="evt-col" style="width:50%;vertical-align:top;padding:0 6px 16px 0;">
|
|
81
|
+
${makeCard(displayEvents[i])}
|
|
82
|
+
</td>
|
|
83
|
+
<td class="evt-col" style="width:50%;vertical-align:top;padding:0 0 16px 6px;">
|
|
84
|
+
${second ? makeCard(second) : ""}
|
|
85
|
+
</td>
|
|
86
|
+
</tr>`);
|
|
87
|
+
}
|
|
51
88
|
return `
|
|
52
89
|
<div style="${s.container}">
|
|
90
|
+
<style>@media(max-width:600px){.evt-col{width:100%!important;display:block!important;padding:0 0 12px 0!important;}}</style>
|
|
53
91
|
<p style="${s.title}">Upcoming Events</p>
|
|
54
|
-
<table style="
|
|
55
|
-
|
|
56
|
-
<tr>
|
|
57
|
-
<th style="${s.th}">Event</th>
|
|
58
|
-
<th style="${s.th}">Date</th>
|
|
59
|
-
<th style="${s.th}">Type</th>
|
|
60
|
-
${hasLocation ? `<th style="${s.th}">Location</th>` : ""}
|
|
61
|
-
</tr>
|
|
62
|
-
</thead>
|
|
63
|
-
<tbody>${rows}</tbody>
|
|
92
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
93
|
+
${cardRows.join("")}
|
|
64
94
|
</table>
|
|
65
95
|
${oId ? `<p style="${s.footer}"><a href="https://careerthread.co.uk/publicEvents/${oId}" style="${s.link}">View all events and sign up →</a></p>` : ""}
|
|
66
96
|
</div>`;
|
|
@@ -110,7 +140,7 @@ exports.attendingEventsSection = {
|
|
|
110
140
|
exports.sharedOpportunitiesSection = {
|
|
111
141
|
id: "sharedOpportunities",
|
|
112
142
|
title: "Your Shared Opportunities",
|
|
113
|
-
description: "A
|
|
143
|
+
description: "A grid of opportunities this employer has submitted, or a prompt to submit one if they haven't.",
|
|
114
144
|
forTemplates: ["employersEmailCampaign"],
|
|
115
145
|
render: ({ placeholder, opportunities, oId, primaryColor: pc }) => {
|
|
116
146
|
const color = pc || PRIMARY_COLOUR;
|
|
@@ -118,34 +148,42 @@ exports.sharedOpportunitiesSection = {
|
|
|
118
148
|
const displayOps = placeholder ? [
|
|
119
149
|
{ title: "Mock Interview Sessions", description: "Offering 10 mock interview slots for Year 11 students", type: "mockInterviews" },
|
|
120
150
|
{ title: "Workplace Visit", description: "Office tour for up to 30 students", type: "workplaceVisits" },
|
|
151
|
+
{ title: "Year 10 Work Experience", description: "1-week placement at a local engineering firm", type: "workExperience" },
|
|
121
152
|
] : (opportunities || []);
|
|
122
153
|
if (!placeholder && !displayOps.length) {
|
|
123
154
|
return `
|
|
124
155
|
<div style="${s.container}">
|
|
125
156
|
<p style="${s.title}">Share an Opportunity</p>
|
|
126
157
|
<p style="${s.emptyText}">We would love to hear from you! You can share work experience placements, mock interview sessions, workplace visits, and more with our students.</p>
|
|
127
|
-
${oId ? `<p style="font-family:
|
|
158
|
+
${oId ? `<p style="font-family:nunito,sans-serif;margin:12px 0 0 0;"><a href="https://careerthread.co.uk/requestEvent/${oId}" style="background-color:${color};color:white;padding:8px 16px;border-radius:20px;text-decoration:none;font-size:14px;font-family:nunito,sans-serif;">Submit an Opportunity</a></p>` : ""}
|
|
128
159
|
</div>`;
|
|
129
160
|
}
|
|
130
|
-
const
|
|
131
|
-
<
|
|
132
|
-
<
|
|
133
|
-
<
|
|
134
|
-
<
|
|
135
|
-
</
|
|
161
|
+
const makeCard = (op) => `
|
|
162
|
+
<div style="border-radius:12px;box-shadow:0 2px 10px rgba(0,0,0,0.12);background:#ffffff;padding:16px;">
|
|
163
|
+
<p style="font-size:11px;font-weight:bold;color:${color};text-transform:uppercase;letter-spacing:0.5px;margin:0 0 6px 0;font-family:nunito,sans-serif;">${op.type ? activityTypeLabel(op.type) : "Opportunity"}</p>
|
|
164
|
+
<p style="font-weight:bold;font-size:14px;margin:0 0 6px 0;font-family:nunito,sans-serif;color:#333;line-height:1.3;">${op.title}</p>
|
|
165
|
+
<p style="font-size:12px;color:#888;margin:0;font-family:nunito,sans-serif;line-height:1.5;">${op.description || ""}</p>
|
|
166
|
+
</div>`;
|
|
167
|
+
const cardRows = [];
|
|
168
|
+
for (let i = 0; i < displayOps.length; i += 2) {
|
|
169
|
+
const second = displayOps[i + 1];
|
|
170
|
+
cardRows.push(`
|
|
171
|
+
<tr>
|
|
172
|
+
<td class="opp-col" style="width:50%;vertical-align:top;padding:0 6px 16px 0;">
|
|
173
|
+
${makeCard(displayOps[i])}
|
|
174
|
+
</td>
|
|
175
|
+
<td class="opp-col" style="width:50%;vertical-align:top;padding:0 0 16px 6px;">
|
|
176
|
+
${second ? makeCard(second) : ""}
|
|
177
|
+
</td>
|
|
178
|
+
</tr>`);
|
|
179
|
+
}
|
|
136
180
|
return `
|
|
137
181
|
<div style="${s.container}">
|
|
182
|
+
<style>@media(max-width:600px){.opp-col{width:100%!important;display:block!important;padding:0 0 12px 0!important;}}</style>
|
|
138
183
|
<p style="${s.title}">Your Shared Opportunities</p>
|
|
139
184
|
<p style="${s.emptyText}">Thank you for the opportunities you have shared with our students.</p>
|
|
140
|
-
<table style="
|
|
141
|
-
|
|
142
|
-
<tr>
|
|
143
|
-
<th style="${s.th}">Opportunity</th>
|
|
144
|
-
<th style="${s.th}">Description</th>
|
|
145
|
-
<th style="${s.th}">Type</th>
|
|
146
|
-
</tr>
|
|
147
|
-
</thead>
|
|
148
|
-
<tbody>${rows}</tbody>
|
|
185
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
186
|
+
${cardRows.join("")}
|
|
149
187
|
</table>
|
|
150
188
|
${oId ? `<p style="${s.footer}"><a href="https://careerthread.co.uk/requestEvent/${oId}" style="${s.link}">Submit another opportunity →</a></p>` : ""}
|
|
151
189
|
</div>`;
|
package/lib/emailSections.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emailSections.js","sourceRoot":"","sources":["../src/emailSections.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"emailSections.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CAAC;YACrC,OAAO;8BACW,CAAC,CAAC,SAAS;gCACT,CAAC,CAAC,KAAK;gCACP,CAAC,CAAC,SAAS;uBACpB,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;;6BAElB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,KAAK;6BACjD,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,WAAW,IAAI,EAAE;6BACrD,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;kBACrF,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAErB,OAAO;0BACW,CAAC,CAAC,SAAS;4BACT,CAAC,CAAC,KAAK;gCACH,CAAC,CAAC,KAAK;;;yCAGE,CAAC,CAAC,EAAE;yCACJ,CAAC,CAAC,EAAE;yCACJ,CAAC,CAAC,EAAE;;;6BAGhB,IAAI;;mBAEd,CAAC;IAChB,CAAC;CACJ,CAAC"}
|
package/package.json
CHANGED
package/src/emailSections.ts
CHANGED
|
@@ -9,6 +9,7 @@ type SectionEvent = {
|
|
|
9
9
|
activityType: string,
|
|
10
10
|
location?: string,
|
|
11
11
|
id?: string,
|
|
12
|
+
image?: string,
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
type SectionOpportunity = {
|
|
@@ -53,7 +54,7 @@ function sectionStyles(color: string) {
|
|
|
53
54
|
export const upcomingEventsSection: EmailSectionConfig = {
|
|
54
55
|
id: "upcomingEvents",
|
|
55
56
|
title: "Upcoming Events",
|
|
56
|
-
description: "A
|
|
57
|
+
description: "A grid of upcoming school and institute events that employers can sign up to attend.",
|
|
57
58
|
forTemplates: ["employersEmailCampaign"],
|
|
58
59
|
render: ({placeholder, events, oId, primaryColor: pc}: EmailSectionRenderProps) => {
|
|
59
60
|
const color = (pc as string) || PRIMARY_COLOUR;
|
|
@@ -61,35 +62,67 @@ export const upcomingEventsSection: EmailSectionConfig = {
|
|
|
61
62
|
|
|
62
63
|
const displayEvents: SectionEvent[] = placeholder ? [
|
|
63
64
|
{title: "Mock Interviews Day", startDate: "15 May 2025", activityType: "mockInterviews", location: "School Main Hall"},
|
|
64
|
-
{title: "Annual Careers Fair", startDate: "22 May 2025", activityType: "workExperience", location: "Town Hall"},
|
|
65
|
-
{title: "Mentoring Programme", startDate: "5 June 2025", activityType: "mentoring"
|
|
65
|
+
{title: "Annual Careers Fair", startDate: "22 May 2025", endDate: "23 May 2025", activityType: "workExperience", location: "Town Hall"},
|
|
66
|
+
{title: "Mentoring Programme", startDate: "5 June 2025", activityType: "mentoring"},
|
|
67
|
+
{title: "Workplace Visit Day", startDate: "12 June 2025", activityType: "workplaceVisits", location: "City Centre"},
|
|
66
68
|
] : ((events as SectionEvent[]) || []);
|
|
67
69
|
|
|
68
70
|
if (!displayEvents.length) return "";
|
|
69
71
|
|
|
70
|
-
const
|
|
72
|
+
const hexToRgba = (hex: string, alpha: number) => {
|
|
73
|
+
try {
|
|
74
|
+
const clean = hex.replace("#", "");
|
|
75
|
+
const r = parseInt(clean.slice(0, 2), 16);
|
|
76
|
+
const g = parseInt(clean.slice(2, 4), 16);
|
|
77
|
+
const b = parseInt(clean.slice(4, 6), 16);
|
|
78
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
79
|
+
} catch {
|
|
80
|
+
return `rgba(57,125,242,${alpha})`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
71
83
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
const bgColor = hexToRgba(color, 0.75);
|
|
85
|
+
|
|
86
|
+
const makeCard = (event: SectionEvent) => {
|
|
87
|
+
const dateStr = event.endDate && event.endDate !== event.startDate
|
|
88
|
+
? `${event.startDate} – ${event.endDate}`
|
|
89
|
+
: event.startDate;
|
|
90
|
+
const eventLink = oId ? `https://careerthread.co.uk/publicEvents/${oId}` : "#";
|
|
91
|
+
const imgStyle = event.image
|
|
92
|
+
? `height:140px;background-image:url('${event.image}');background-size:cover;background-position:center;`
|
|
93
|
+
: `height:140px;background-color:${bgColor};`;
|
|
94
|
+
|
|
95
|
+
return `
|
|
96
|
+
<div style="border-radius:12px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,0.12);background:#ffffff;">
|
|
97
|
+
<div style="${imgStyle}"></div>
|
|
98
|
+
<div style="padding:12px 14px 14px;">
|
|
99
|
+
<p style="font-weight:bold;font-size:14px;margin:0 0 3px 0;font-family:nunito,sans-serif;color:#333;line-height:1.3;">${event.title}</p>
|
|
100
|
+
<p style="font-size:12px;color:#888;margin:0 0 12px 0;font-family:nunito,sans-serif;">${dateStr}</p>
|
|
101
|
+
<a href="${eventLink}" style="display:block;background-color:${color};color:#ffffff;text-align:center;padding:9px 12px;border-radius:6px;text-decoration:none;font-size:13px;font-family:nunito,sans-serif;font-weight:bold;">View Event</a>
|
|
102
|
+
</div>
|
|
103
|
+
</div>`;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const cardRows: string[] = [];
|
|
107
|
+
for (let i = 0; i < displayEvents.length; i += 2) {
|
|
108
|
+
const second = displayEvents[i + 1];
|
|
109
|
+
cardRows.push(`
|
|
110
|
+
<tr>
|
|
111
|
+
<td class="evt-col" style="width:50%;vertical-align:top;padding:0 6px 16px 0;">
|
|
112
|
+
${makeCard(displayEvents[i])}
|
|
113
|
+
</td>
|
|
114
|
+
<td class="evt-col" style="width:50%;vertical-align:top;padding:0 0 16px 6px;">
|
|
115
|
+
${second ? makeCard(second) : ""}
|
|
116
|
+
</td>
|
|
117
|
+
</tr>`);
|
|
118
|
+
}
|
|
79
119
|
|
|
80
120
|
return `
|
|
81
121
|
<div style="${s.container}">
|
|
122
|
+
<style>@media(max-width:600px){.evt-col{width:100%!important;display:block!important;padding:0 0 12px 0!important;}}</style>
|
|
82
123
|
<p style="${s.title}">Upcoming Events</p>
|
|
83
|
-
<table style="
|
|
84
|
-
|
|
85
|
-
<tr>
|
|
86
|
-
<th style="${s.th}">Event</th>
|
|
87
|
-
<th style="${s.th}">Date</th>
|
|
88
|
-
<th style="${s.th}">Type</th>
|
|
89
|
-
${hasLocation ? `<th style="${s.th}">Location</th>` : ""}
|
|
90
|
-
</tr>
|
|
91
|
-
</thead>
|
|
92
|
-
<tbody>${rows}</tbody>
|
|
124
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
125
|
+
${cardRows.join("")}
|
|
93
126
|
</table>
|
|
94
127
|
${oId ? `<p style="${s.footer}"><a href="https://careerthread.co.uk/publicEvents/${oId}" style="${s.link}">View all events and sign up →</a></p>` : ""}
|
|
95
128
|
</div>`;
|
|
@@ -145,7 +178,7 @@ export const attendingEventsSection: EmailSectionConfig = {
|
|
|
145
178
|
export const sharedOpportunitiesSection: EmailSectionConfig = {
|
|
146
179
|
id: "sharedOpportunities",
|
|
147
180
|
title: "Your Shared Opportunities",
|
|
148
|
-
description: "A
|
|
181
|
+
description: "A grid of opportunities this employer has submitted, or a prompt to submit one if they haven't.",
|
|
149
182
|
forTemplates: ["employersEmailCampaign"],
|
|
150
183
|
render: ({placeholder, opportunities, oId, primaryColor: pc}: EmailSectionRenderProps) => {
|
|
151
184
|
const color = (pc as string) || PRIMARY_COLOUR;
|
|
@@ -154,6 +187,7 @@ export const sharedOpportunitiesSection: EmailSectionConfig = {
|
|
|
154
187
|
const displayOps: SectionOpportunity[] = placeholder ? [
|
|
155
188
|
{title: "Mock Interview Sessions", description: "Offering 10 mock interview slots for Year 11 students", type: "mockInterviews"},
|
|
156
189
|
{title: "Workplace Visit", description: "Office tour for up to 30 students", type: "workplaceVisits"},
|
|
190
|
+
{title: "Year 10 Work Experience", description: "1-week placement at a local engineering firm", type: "workExperience"},
|
|
157
191
|
] : ((opportunities as SectionOpportunity[]) || []);
|
|
158
192
|
|
|
159
193
|
if (!placeholder && !displayOps.length) {
|
|
@@ -161,30 +195,38 @@ export const sharedOpportunitiesSection: EmailSectionConfig = {
|
|
|
161
195
|
<div style="${s.container}">
|
|
162
196
|
<p style="${s.title}">Share an Opportunity</p>
|
|
163
197
|
<p style="${s.emptyText}">We would love to hear from you! You can share work experience placements, mock interview sessions, workplace visits, and more with our students.</p>
|
|
164
|
-
${oId ? `<p style="font-family:
|
|
198
|
+
${oId ? `<p style="font-family:nunito,sans-serif;margin:12px 0 0 0;"><a href="https://careerthread.co.uk/requestEvent/${oId}" style="background-color:${color};color:white;padding:8px 16px;border-radius:20px;text-decoration:none;font-size:14px;font-family:nunito,sans-serif;">Submit an Opportunity</a></p>` : ""}
|
|
165
199
|
</div>`;
|
|
166
200
|
}
|
|
167
201
|
|
|
168
|
-
const
|
|
169
|
-
<
|
|
170
|
-
<
|
|
171
|
-
<
|
|
172
|
-
<
|
|
173
|
-
</
|
|
202
|
+
const makeCard = (op: SectionOpportunity) => `
|
|
203
|
+
<div style="border-radius:12px;box-shadow:0 2px 10px rgba(0,0,0,0.12);background:#ffffff;padding:16px;">
|
|
204
|
+
<p style="font-size:11px;font-weight:bold;color:${color};text-transform:uppercase;letter-spacing:0.5px;margin:0 0 6px 0;font-family:nunito,sans-serif;">${op.type ? activityTypeLabel(op.type) : "Opportunity"}</p>
|
|
205
|
+
<p style="font-weight:bold;font-size:14px;margin:0 0 6px 0;font-family:nunito,sans-serif;color:#333;line-height:1.3;">${op.title}</p>
|
|
206
|
+
<p style="font-size:12px;color:#888;margin:0;font-family:nunito,sans-serif;line-height:1.5;">${op.description || ""}</p>
|
|
207
|
+
</div>`;
|
|
208
|
+
|
|
209
|
+
const cardRows: string[] = [];
|
|
210
|
+
for (let i = 0; i < displayOps.length; i += 2) {
|
|
211
|
+
const second = displayOps[i + 1];
|
|
212
|
+
cardRows.push(`
|
|
213
|
+
<tr>
|
|
214
|
+
<td class="opp-col" style="width:50%;vertical-align:top;padding:0 6px 16px 0;">
|
|
215
|
+
${makeCard(displayOps[i])}
|
|
216
|
+
</td>
|
|
217
|
+
<td class="opp-col" style="width:50%;vertical-align:top;padding:0 0 16px 6px;">
|
|
218
|
+
${second ? makeCard(second) : ""}
|
|
219
|
+
</td>
|
|
220
|
+
</tr>`);
|
|
221
|
+
}
|
|
174
222
|
|
|
175
223
|
return `
|
|
176
224
|
<div style="${s.container}">
|
|
225
|
+
<style>@media(max-width:600px){.opp-col{width:100%!important;display:block!important;padding:0 0 12px 0!important;}}</style>
|
|
177
226
|
<p style="${s.title}">Your Shared Opportunities</p>
|
|
178
227
|
<p style="${s.emptyText}">Thank you for the opportunities you have shared with our students.</p>
|
|
179
|
-
<table style="
|
|
180
|
-
|
|
181
|
-
<tr>
|
|
182
|
-
<th style="${s.th}">Opportunity</th>
|
|
183
|
-
<th style="${s.th}">Description</th>
|
|
184
|
-
<th style="${s.th}">Type</th>
|
|
185
|
-
</tr>
|
|
186
|
-
</thead>
|
|
187
|
-
<tbody>${rows}</tbody>
|
|
228
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
229
|
+
${cardRows.join("")}
|
|
188
230
|
</table>
|
|
189
231
|
${oId ? `<p style="${s.footer}"><a href="https://careerthread.co.uk/requestEvent/${oId}" style="${s.link}">Submit another opportunity →</a></p>` : ""}
|
|
190
232
|
</div>`;
|