Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Show location and meeting details in event emails (#3404)

Luke Vella05e1bb444b92
diff --git a/apps/web/public/images/email/calendar.png b/apps/web/public/images/email/calendar.png
new file mode 100644
index 000000000..344213f1b
Binary files /dev/null and b/apps/web/public/images/email/calendar.png differ
diff --git a/apps/web/public/images/email/google-meet.png b/apps/web/public/images/email/google-meet.png
new file mode 100644
index 000000000..5bb725654
Binary files /dev/null and b/apps/web/public/images/email/google-meet.png differ
diff --git a/apps/web/public/images/email/map-pin.png b/apps/web/public/images/email/map-pin.png
new file mode 100644
index 000000000..d7a3bf9b3
Binary files /dev/null and b/apps/web/public/images/email/map-pin.png differ
diff --git a/apps/web/public/images/email/microsoft-teams.png b/apps/web/public/images/email/microsoft-teams.png
new file mode 100644
index 000000000..9d7633424
Binary files /dev/null and b/apps/web/public/images/email/microsoft-teams.png differ
diff --git a/apps/web/public/images/email/phone.png b/apps/web/public/images/email/phone.png
new file mode 100644
index 000000000..e89548522
Binary files /dev/null and b/apps/web/public/images/email/phone.png differ
diff --git a/apps/web/public/images/email/video.png b/apps/web/public/images/email/video.png
new file mode 100644
index 000000000..c068c73b6
Binary files /dev/null and b/apps/web/public/images/email/video.png differ
diff --git a/apps/web/public/images/email/zoom.png b/apps/web/public/images/email/zoom.png
new file mode 100644
index 000000000..96de3426e
Binary files /dev/null and b/apps/web/public/images/email/zoom.png differ
diff --git a/apps/web/src/emails/conferencing.ts b/apps/web/src/emails/conferencing.ts
new file mode 100644
index 000000000..99da97794
--- /dev/null
+++ b/apps/web/src/emails/conferencing.ts
@@ -0,0 +1,14 @@
+import type { EmailConferencing } from "@rallly/emails";
+
+import type { Conferencing } from "@/features/conferencing/schema";
+import { getConferencingUri } from "@/features/conferencing/utils";
+
+export function toEmailConferencing(
+ conferencing: Conferencing,
+): EmailConferencing {
+ return {
+ provider: conferencing.provider,
+ label: conferencing.provider === "custom" ? conferencing.label : undefined,
+ url: getConferencingUri(conferencing),
+ };
+}
diff --git a/apps/web/src/features/scheduled-event/actions.ts b/apps/web/src/features/scheduled-event/actions.ts
index f0d9fe572..9ce61652a 100644
--- a/apps/web/src/features/scheduled-event/actions.ts
+++ b/apps/web/src/features/scheduled-event/actions.ts
@@ -7,6 +7,7 @@ import { headers } from "next/headers";
import { after } from "next/server";
import * as z from "zod";
import { getSpaceBranding } from "@/emails/branding";
+import { toEmailConferencing } from "@/emails/conferencing";
import { parseConferencing } from "@/features/conferencing/data";
import { getConferencingUri } from "@/features/conferencing/utils";
import { parseLocation } from "@/features/location/data";
@@ -140,7 +141,7 @@ async function sendRsvpConfirmation({
);
}
- const { day, dow, date, time } = formatEventDateTime({
+ const { date, time } = formatEventDateTime({
start: event.start,
end: event.end,
allDay: event.allDay,
@@ -167,11 +168,12 @@ async function sendRsvpConfirmation({
title: event.title,
hostName: event.user.name,
response: status,
- day,
- dow,
date,
time,
- location: locationText ?? conferencingUri,
+ location: locationText,
+ conferencing: conferencing
+ ? toEmailConferencing(conferencing)
+ : undefined,
},
});
}
diff --git a/apps/web/src/features/scheduled-event/utils.test.ts b/apps/web/src/features/scheduled-event/utils.test.ts
index a2a1d682a..b43e3125a 100644
--- a/apps/web/src/features/scheduled-event/utils.test.ts
+++ b/apps/web/src/features/scheduled-event/utils.test.ts
@@ -20,8 +20,6 @@ describe("formatEventDateTime", () => {
});
expect(result).toEqual({
date: "June 26, 2026",
- day: "26",
- dow: "Fri",
time: undefined,
});
});
diff --git a/apps/web/src/features/scheduled-event/utils.ts b/apps/web/src/features/scheduled-event/utils.ts
index 3f2eda133..d26dbd56a 100644
--- a/apps/web/src/features/scheduled-event/utils.ts
+++ b/apps/web/src/features/scheduled-event/utils.ts
@@ -1,9 +1,5 @@
import type { Prisma, ScheduledEventStatus } from "@rallly/database";
-import {
- formatDateParts,
- formatDateTime,
- formatDateTimeRange,
-} from "@/lib/datetime/format";
+import { formatDateTime, formatDateTimeRange } from "@/lib/datetime/format";
import type { TimeFormat } from "@/lib/datetime/types";
import {
calendarDateToUTCMidnight,
@@ -12,8 +8,6 @@ import {
export interface FormattedEventDateTime {
date: string;
- day: string;
- dow: string;
/** Undefined for all-day events; the email templates render a localized "All day" label. */
time?: string;
}
@@ -53,19 +47,12 @@ export const formatEventDateTime = ({
}: FormatEventDateTimeOptions): FormattedEventDateTime => {
const displayTimeZone =
allDay || !timeZone ? "UTC" : inviteeTimeZone || timeZone;
- const { weekday, day } = formatDateParts(start, {
- locale,
- timeZone: displayTimeZone,
- });
-
return {
date: formatDateTime(start, {
preset: "dateLong",
locale,
timeZone: displayTimeZone,
}),
- day,
- dow: weekday,
time: allDay
? undefined
: formatDateTimeRange(start, end, {
diff --git a/apps/web/src/trpc/routers/events.ts b/apps/web/src/trpc/routers/events.ts
index 0547acf3a..ae2f918fb 100644
--- a/apps/web/src/trpc/routers/events.ts
+++ b/apps/web/src/trpc/routers/events.ts
@@ -5,6 +5,7 @@ import { TRPCError } from "@trpc/server";
import { after } from "next/server";
import * as z from "zod";
import { getInstanceBranding } from "@/emails/branding";
+import { toEmailConferencing } from "@/emails/conferencing";
import { parseConferencing } from "@/features/conferencing/data";
import { getConferencingUri } from "@/features/conferencing/utils";
import { parseLocation } from "@/features/location/data";
@@ -169,7 +170,7 @@ export const events = router({
for (const invite of updatedEvent.invites) {
if (invite.status !== "declined") {
- const { day, dow, date, time } = formatEventDateTime({
+ const { date, time } = formatEventDateTime({
start: updatedEvent.start,
end: updatedEvent.end,
allDay: updatedEvent.allDay,
@@ -191,10 +192,16 @@ export const events = router({
props: {
title: updatedEvent.title,
hostName: ctx.user.name,
- day,
- dow,
date,
time,
+ location: cancelLocationText,
+ // The meeting may no longer exist, so its link is dropped.
+ conferencing: cancelConferencing
+ ? {
+ ...toEmailConferencing(cancelConferencing),
+ url: undefined,
+ }
+ : undefined,
},
}),
);
diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.ts
index 38779cf24..47593df11 100644
--- a/apps/web/src/trpc/routers/polls.ts
+++ b/apps/web/src/trpc/routers/polls.ts
@@ -8,6 +8,7 @@ import { TRPCError } from "@trpc/server";
import { after } from "next/server";
import * as z from "zod";
import { getInstanceBranding, getSpaceBranding } from "@/emails/branding";
+import { toEmailConferencing } from "@/emails/conferencing";
import { recordPollActivities } from "@/features/activity/mutations";
import {
getConnectedConferencingProviders,
@@ -1138,6 +1139,9 @@ export const polls = router({
const conferencingUri = conferencing
? getConferencingUri(conferencing)
: undefined;
+ const emailConferencing = conferencing
+ ? toEmailConferencing(conferencing)
+ : undefined;
const event = createIcsEvent({
uid,
sequence: 0,
@@ -1306,7 +1310,7 @@ export const polls = router({
const hostName = poll.user.name;
const hostLocale = poll.user.locale ?? undefined;
- const { date, day, dow, time } = formatEventDateTime({
+ const { date, time } = formatEventDateTime({
start: scheduledEvent.start,
end: scheduledEvent.end,
allDay: scheduledEvent.allDay,
@@ -1329,7 +1333,8 @@ export const polls = router({
props: {
name: hostName,
pollUrl: absoluteUrl(`/poll/${poll.id}`),
- location: poll.location,
+ location: poll.location || undefined,
+ conferencing: emailConferencing,
title: poll.title,
attendees: poll.participants
.filter((p) =>
@@ -1339,15 +1344,13 @@ export const polls = router({
)
.map((p) => p.name),
date,
- day,
- dow,
time,
},
}),
);
for (const p of participantsToEmail) {
- const { date, day, dow, time } = formatEventDateTime({
+ const { date, time } = formatEventDateTime({
start: scheduledEvent.start,
end: scheduledEvent.end,
allDay: scheduledEvent.allDay,
@@ -1371,9 +1374,9 @@ export const polls = router({
pollUrl: shortUrl(`/invite/${poll.id}`),
title: poll.title,
hostName: poll.user?.name ?? "",
+ location: poll.location || undefined,
+ conferencing: emailConferencing,
date,
- day,
- dow,
time,
},
}),
diff --git a/packages/emails/locales/en/emails.json b/packages/emails/locales/en/emails.json
index 8147aab25..b766e20a4 100644
--- a/packages/emails/locales/en/emails.json
+++ b/packages/emails/locales/en/emails.json
@@ -20,6 +20,8 @@
"eventCanceledHeading": "Event canceled",
"eventCanceledPreview": "Event canceled",
"eventCanceledSubject": "Canceled: {title}",
+ "eventConferencingPhone": "Phone",
+ "eventConferencingVideoCall": "Video call",
"eventRsvpConfirmationAcceptedContent": "You accepted the invitation to <b>{title}</b> hosted by <b>{hostName}</b>. The event is scheduled for:",
"eventRsvpConfirmationAcceptedHeading": "You're going",
"eventRsvpConfirmationAcceptedPreview": "You accepted {title}",
diff --git a/packages/emails/src/components/event-details.tsx b/packages/emails/src/components/event-details.tsx
new file mode 100644
index 000000000..59406de26
--- /dev/null
+++ b/packages/emails/src/components/event-details.tsx
@@ -0,0 +1,118 @@
+import { Column, Img, Row, Section } from "@react-email/components";
+
+import { createEmailI18n } from "../i18n";
+import type { EmailConferencing } from "../types";
+import { Link, lightTextColor, Text } from "./styled-components";
+
+const providerIcons: Record<EmailConferencing["provider"], string> = {
+ zoom: "zoom.png",
+ meet: "google-meet.png",
+ teams: "microsoft-teams.png",
+ phone: "phone.png",
+ custom: "video.png",
+};
+
+const providerNames = {
+ zoom: "Zoom",
+ meet: "Google Meet",
+ teams: "Microsoft Teams",
+} as const;
+
+// When and where an event happens, one icon row each. Icons are PNGs served
+// by the instance because most email clients do not render SVG.
+export async function EventDetails({
+ date,
+ time,
+ location,
+ conferencing,
+ baseUrl,
+ locale = "en",
+}: {
+ date: string;
+ time?: string;
+ location?: string;
+ conferencing?: EmailConferencing;
+ baseUrl: string;
+ locale?: string;
+}) {
+ const { t } = await createEmailI18n(locale);
+
+ const conferencingName = (() => {
+ if (!conferencing) {
+ return null;
+ }
+ switch (conferencing.provider) {
+ case "phone":
+ return t("eventConferencingPhone", { defaultValue: "Phone" });
+ case "custom":
+ return (
+ conferencing.label ??
+ t("eventConferencingVideoCall", { defaultValue: "Video call" })
+ );
+ default:
+ return providerNames[conferencing.provider];
+ }
+ })();
+
+ return (
+ <>
+ <DetailRow iconUrl={`${baseUrl}/images/email/calendar.png`}>
+ <Text style={{ margin: 0, fontWeight: 600 }}>{date}</Text>
+ <Text light={true} style={{ margin: 0 }}>
+ {time ?? t("allDay", { defaultValue: "All day" })}
+ </Text>
+ </DetailRow>
+ {location ? (
+ <DetailRow iconUrl={`${baseUrl}/images/email/map-pin.png`}>
+ <Text style={{ margin: 0 }}>{location}</Text>
+ </DetailRow>
+ ) : null}
+ {conferencing ? (
+ <DetailRow
+ iconUrl={`${baseUrl}/images/email/${providerIcons[conferencing.provider]}`}
+ >
+ <Text style={{ margin: 0, fontWeight: 600 }}>{conferencingName}</Text>
+ {conferencing.url ? (
+ <Text small={true} style={{ margin: 0 }}>
+ <Link
+ href={conferencing.url}
+ color={lightTextColor}
+ style={{
+ textDecoration: "underline",
+ wordBreak: "break-all",
+ }}
+ >
+ {conferencing.url.replace(/^tel:/, "")}
+ </Link>
+ </Text>
+ ) : null}
+ </DetailRow>
+ ) : null}
+ </>
+ );
+}
+
+function DetailRow({
+ iconUrl,
+ children,
+}: {
+ iconUrl: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <Section style={{ marginTop: 12 }}>
+ <Row>
+ <Column style={{ width: 32, verticalAlign: "top" }}>
+ <Img
+ src={iconUrl}
+ width="20"
+ height="20"
+ alt=""
+ style={{ marginTop: 2 }}
+ />
+ </Column>
+ <Column style={{ verticalAlign: "top" }}>{children}</Column>
+ </Row>
+ </Section>
+ );
+}
diff --git a/packages/emails/src/components/styled-components.tsx b/packages/emails/src/components/styled-components.tsx
index 67e5c6435..9bc89796e 100644
--- a/packages/emails/src/components/styled-components.tsx
+++ b/packages/emails/src/components/styled-components.tsx
@@ -63,13 +63,19 @@ export const Button = (
textAlign: "center",
margin: "0 auto",
fontSize: "16px",
- fontWeight: "bold",
+ fontWeight: 600,
color: "white",
}}
/>
);
};
+// Emphasis inside copy. Inline weight because <strong> defaults to bold and
+// email clients ignore stylesheet overrides.
+export const Strong = (props: React.ComponentProps<"strong">) => {
+ return <strong {...props} style={{ fontWeight: 600, ...props.style }} />;
+};
+
export const Link = (props: LinkProps & { color?: string }) => {
return (
<UnstyledLink
@@ -103,7 +109,7 @@ export const Heading = (
as={as}
style={{
fontSize: fontSize[as],
- fontWeight: "bold",
+ fontWeight: 600,
...props.style,
}}
/>
@@ -170,7 +176,7 @@ export const Signature = () => {
style={{
fontSize: 16,
margin: 0,
- fontWeight: "bold",
+ fontWeight: 600,
color: darkTextColor,
fontFamily,
}}
diff --git a/packages/emails/src/index.ts b/packages/emails/src/index.ts
index 747a1c8c3..e3721c2b0 100644
--- a/packages/emails/src/index.ts
+++ b/packages/emails/src/index.ts
@@ -8,4 +8,4 @@ export {
type SendRawEmailOptions,
sendRawEmail,
} from "./send";
-export type { EmailBranding } from "./types";
+export type { EmailBranding, EmailConferencing } from "./types";
diff --git a/packages/emails/src/templates/change-email.tsx b/packages/emails/src/templates/change-email.tsx
index 9edcd3c1f..483f7eca8 100644
--- a/packages/emails/src/templates/change-email.tsx
+++ b/packages/emails/src/templates/change-email.tsx
@@ -61,7 +61,7 @@ async function ChangeEmailEmail({
style={{
...trackingWide,
fontSize: "32px",
- fontWeight: "bold",
+ fontWeight: 600,
}}
id="code"
>
diff --git a/packages/emails/src/templates/event-canceled.tsx b/packages/emails/src/templates/event-canceled.tsx
index 17faa8151..d0317b31f 100644
--- a/packages/emails/src/templates/event-canceled.tsx
+++ b/packages/emails/src/templates/event-canceled.tsx
@@ -1,48 +1,40 @@
-import {
- Column,
- Head,
- Hr,
- Html,
- Img,
- Preview,
- Row,
- Section,
-} from "@react-email/components";
+import { Head, Hr, Html, Img, Preview } from "@react-email/components";
import { Trans } from "react-i18next/TransWithoutContext";
import { resolveChrome } from "../chrome";
+import { EventDetails } from "../components/event-details";
import { PoweredBy } from "../components/powered-by";
import { previewChrome } from "../components/preview-chrome";
import {
Body,
- borderColor,
Container,
Heading,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
import type { SendArgs } from "../send";
import { sendRenderedEmail } from "../send";
-import type { EmailChrome } from "../types";
+import type { EmailChrome, EmailConferencing } from "../types";
export type EventCanceledEmailProps = {
locale?: string;
chrome: EmailChrome;
title: string;
hostName: string;
- day: string;
- dow: string;
date: string;
time?: string;
+ location?: string;
+ conferencing?: EmailConferencing;
};
async function EventCanceledEmail({
title,
hostName,
- day,
- dow,
date,
time,
+ location,
+ conferencing,
locale = "en",
chrome,
}: EventCanceledEmailProps) {
@@ -77,48 +69,18 @@ async function EventCanceledEmail({
defaults="<b>{hostName}</b> has canceled <b>{title}</b> that was scheduled for:"
values={{ hostName, title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
/>
</Text>
- <Section data-testid="date-section">
- <Row>
- <Column style={{ width: 48 }}>
- <Section
- style={{
- borderRadius: 5,
- margin: 0,
- width: 48,
- height: 48,
- textAlign: "center",
- border: `1px solid ${borderColor}`,
- }}
- >
- <Text
- style={{ margin: "0 0 4px 0", fontSize: 10, lineHeight: 1 }}
- >
- {dow}
- </Text>
- <Text
- style={{
- fontSize: 20,
- lineHeight: 1,
- fontWeight: "bold",
- margin: 0,
- }}
- >
- {day}
- </Text>
- </Section>
- </Column>
- <Column style={{ paddingLeft: 16 }} align="left">
- <Text style={{ margin: 0, fontWeight: "bold" }}>{date}</Text>
- <Text light={true} style={{ margin: 0 }}>
- {time ?? t("allDay", { defaultValue: "All day" })}
- </Text>
- </Column>
- </Row>
- </Section>
+ <EventDetails
+ date={date}
+ time={time}
+ location={location}
+ conferencing={conferencing}
+ baseUrl={chrome.baseUrl}
+ locale={locale}
+ />
<Hr style={{ margin: "16px 0" }} />
<PoweredBy chrome={chrome} locale={locale} />
</Container>
@@ -130,10 +92,10 @@ async function EventCanceledEmail({
EventCanceledEmail.PreviewProps = {
title: "Untitled Poll",
hostName: "Host",
- day: "12",
- dow: "Fri",
date: "Friday, 12th June 2020",
time: "6:00 PM to 11:00 PM BST",
+ location: "Codfather, 100 Fish Street, London",
+ conferencing: { provider: "meet" },
locale: "en",
chrome: previewChrome,
} as EventCanceledEmailProps;
diff --git a/packages/emails/src/templates/event-rsvp-confirmation.tsx b/packages/emails/src/templates/event-rsvp-confirmation.tsx
index 8ffa4528a..fb33a5730 100644
--- a/packages/emails/src/templates/event-rsvp-confirmation.tsx
+++ b/packages/emails/src/templates/event-rsvp-confirmation.tsx
@@ -1,29 +1,21 @@
-import {
- Column,
- Head,
- Hr,
- Html,
- Img,
- Preview,
- Row,
- Section,
-} from "@react-email/components";
+import { Head, Hr, Html, Img, Preview } from "@react-email/components";
import { Trans } from "react-i18next/TransWithoutContext";
import { resolveChrome } from "../chrome";
+import { EventDetails } from "../components/event-details";
import { PoweredBy } from "../components/powered-by";
import { previewChrome } from "../components/preview-chrome";
import {
Body,
- borderColor,
Container,
Heading,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
import type { SendArgs } from "../send";
import { sendRenderedEmail } from "../send";
-import type { EmailChrome } from "../types";
+import type { EmailChrome, EmailConferencing } from "../types";
export type EventRsvpConfirmationEmailProps = {
locale?: string;
@@ -31,22 +23,20 @@ export type EventRsvpConfirmationEmailProps = {
title: string;
hostName: string;
response: "accepted" | "declined";
- day: string;
- dow: string;
date: string;
time?: string;
location?: string;
+ conferencing?: EmailConferencing;
};
async function EventRsvpConfirmationEmail({
title,
hostName,
response,
- day,
- dow,
date,
time,
location,
+ conferencing,
locale = "en",
chrome,
}: EventRsvpConfirmationEmailProps) {
@@ -92,7 +82,7 @@ async function EventRsvpConfirmationEmail({
defaults="You accepted the invitation to <b>{title}</b> hosted by <b>{hostName}</b>. The event is scheduled for:"
values={{ hostName, title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
/>
) : (
@@ -104,54 +94,19 @@ async function EventRsvpConfirmationEmail({
defaults="You declined the invitation to <b>{title}</b> hosted by <b>{hostName}</b>. The event is scheduled for:"
values={{ hostName, title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
/>
)}
</Text>
- <Section data-testid="date-section">
- <Row>
- <Column style={{ width: 48 }}>
- <Section
- style={{
- borderRadius: 5,
- margin: 0,
- width: 48,
- height: 48,
- textAlign: "center",
- border: `1px solid ${borderColor}`,
- }}
- >
- <Text
- style={{ margin: "0 0 4px 0", fontSize: 10, lineHeight: 1 }}
- >
- {dow}
- </Text>
- <Text
- style={{
- fontSize: 20,
- lineHeight: 1,
- fontWeight: "bold",
- margin: 0,
- }}
- >
- {day}
- </Text>
- </Section>
- </Column>
- <Column style={{ paddingLeft: 16 }} align="left">
- <Text style={{ margin: 0, fontWeight: "bold" }}>{date}</Text>
- <Text light={true} style={{ margin: 0 }}>
- {time ?? t("allDay", { defaultValue: "All day" })}
- </Text>
- </Column>
- </Row>
- </Section>
- {location ? (
- <Text light={true} style={{ margin: "8px 0 0 0" }}>
- {location}
- </Text>
- ) : null}
+ <EventDetails
+ date={date}
+ time={time}
+ location={location}
+ conferencing={conferencing}
+ baseUrl={chrome.baseUrl}
+ locale={locale}
+ />
<Text>
{t("eventRsvpConfirmationAttachmentNote", {
defaultValue:
@@ -170,11 +125,13 @@ EventRsvpConfirmationEmail.PreviewProps = {
title: "Team Offsite",
hostName: "Host",
response: "accepted",
- day: "12",
- dow: "Fri",
date: "Friday, 12th June 2020",
time: "6:00 PM to 11:00 PM BST",
location: "Codfather, 100 Fish Street, London",
+ conferencing: {
+ provider: "meet",
+ url: "https://meet.google.com/oce-zdyd-aoq",
+ },
locale: "en",
chrome: previewChrome,
} as EventRsvpConfirmationEmailProps;
diff --git a/packages/emails/src/templates/finalized-host.tsx b/packages/emails/src/templates/finalized-host.tsx
index 63233b359..6dd070797 100644
--- a/packages/emails/src/templates/finalized-host.tsx
+++ b/packages/emails/src/templates/finalized-host.tsx
@@ -1,41 +1,32 @@
-import {
- Column,
- Head,
- Hr,
- Html,
- Img,
- Preview,
- Row,
- Section,
-} from "@react-email/components";
+import { Head, Hr, Html, Img, Preview } from "@react-email/components";
import { Trans } from "react-i18next/TransWithoutContext";
import { resolveChrome } from "../chrome";
+import { EventDetails } from "../components/event-details";
import { PoweredBy } from "../components/powered-by";
import { previewChrome } from "../components/preview-chrome";
import {
Body,
Button,
- borderColor,
Container,
Heading,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
import type { SendArgs } from "../send";
import { sendRenderedEmail } from "../send";
-import type { EmailChrome } from "../types";
+import type { EmailChrome, EmailConferencing } from "../types";
type FinalizeHostEmailProps = {
locale?: string;
chrome: EmailChrome;
date: string;
- day: string;
- dow: string;
time?: string;
name: string;
title: string;
- location: string | null;
+ location?: string;
+ conferencing?: EmailConferencing;
pollUrl: string;
attendees: string[];
};
@@ -43,10 +34,10 @@ type FinalizeHostEmailProps = {
async function FinalizeHostEmail({
title,
pollUrl,
- day,
- dow,
date,
time,
+ location,
+ conferencing,
locale = "en",
chrome,
}: FinalizeHostEmailProps) {
@@ -80,49 +71,19 @@ async function FinalizeHostEmail({
i18nKey="finalizeHost_content"
values={{ title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
defaults="<b>{title}</b> has been booked for:"
/>
</Text>
- <Section>
- <Row>
- <Column style={{ width: 48 }}>
- <Section
- style={{
- borderRadius: 5,
- margin: 0,
- width: 48,
- height: 48,
- textAlign: "center",
- border: `1px solid ${borderColor}`,
- }}
- >
- <Text
- style={{ margin: "0 0 4px 0", fontSize: 10, lineHeight: 1 }}
- >
- {dow}
- </Text>
- <Text
- style={{
- fontSize: 20,
- lineHeight: 1,
- fontWeight: "bold",
- margin: 0,
- }}
- >
- {day}
- </Text>
- </Section>
- </Column>
- <Column style={{ paddingLeft: 16 }} align="left">
- <Text style={{ margin: 0, fontWeight: "bold" }}>{date}</Text>
- <Text light={true} style={{ margin: 0 }}>
- {time ?? t("allDay", { defaultValue: "All day" })}
- </Text>
- </Column>
- </Row>
- </Section>
+ <EventDetails
+ date={date}
+ time={time}
+ location={location}
+ conferencing={conferencing}
+ baseUrl={chrome.baseUrl}
+ locale={locale}
+ />
<Text>
{t("finalizeHost_content2", {
defaultValue:
@@ -142,12 +103,14 @@ async function FinalizeHostEmail({
FinalizeHostEmail.PreviewProps = {
name: "John Doe",
- location: "Zoom",
+ location: "Codfather, 100 Fish Street, London",
+ conferencing: {
+ provider: "meet",
+ url: "https://meet.google.com/oce-zdyd-aoq",
+ },
title: "Untitled Poll",
pollUrl: "https://rallly.co",
- day: "12",
- dow: "Fri",
date: "Friday, 12th June 2020",
time: "6:00 PM to 11:00 PM BST",
locale: "en",
diff --git a/packages/emails/src/templates/finalized-participant.tsx b/packages/emails/src/templates/finalized-participant.tsx
index 1e0d34cc7..8ae0430a1 100644
--- a/packages/emails/src/templates/finalized-participant.tsx
+++ b/packages/emails/src/templates/finalized-participant.tsx
@@ -1,51 +1,43 @@
-import {
- Column,
- Head,
- Hr,
- Html,
- Img,
- Preview,
- Row,
- Section,
-} from "@react-email/components";
+import { Head, Hr, Html, Img, Preview } from "@react-email/components";
import { Trans } from "react-i18next/TransWithoutContext";
import { resolveChrome } from "../chrome";
+import { EventDetails } from "../components/event-details";
import { PoweredBy } from "../components/powered-by";
import { previewChrome } from "../components/preview-chrome";
import {
Body,
Button,
- borderColor,
Container,
Heading,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
import type { SendArgs } from "../send";
import { sendRenderedEmail } from "../send";
-import type { EmailChrome } from "../types";
+import type { EmailChrome, EmailConferencing } from "../types";
type FinalizeParticipantEmailProps = {
locale?: string;
chrome: EmailChrome;
date: string;
- day: string;
- dow: string;
time?: string;
title: string;
hostName: string;
pollUrl: string;
+ location?: string;
+ conferencing?: EmailConferencing;
};
async function FinalizeParticipantEmail({
title,
hostName,
pollUrl,
- day,
- dow,
date,
time,
+ location,
+ conferencing,
locale = "en",
chrome,
}: FinalizeParticipantEmailProps) {
@@ -80,48 +72,18 @@ async function FinalizeParticipantEmail({
defaults="<b>{hostName}</b> has booked <b>{title}</b> for the following date:"
values={{ hostName, title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
/>
</Text>
- <Section data-testid="date-section">
- <Row>
- <Column style={{ width: 48 }}>
- <Section
- style={{
- borderRadius: 5,
- margin: 0,
- width: 48,
- height: 48,
- textAlign: "center",
- border: `1px solid ${borderColor}`,
- }}
- >
- <Text
- style={{ margin: "0 0 4px 0", fontSize: 10, lineHeight: 1 }}
- >
- {dow}
- </Text>
- <Text
- style={{
- fontSize: 20,
- lineHeight: 1,
- fontWeight: "bold",
- margin: 0,
- }}
- >
- {day}
- </Text>
- </Section>
- </Column>
- <Column style={{ paddingLeft: 16 }} align="left">
- <Text style={{ margin: 0, fontWeight: "bold" }}>{date}</Text>
- <Text light={true} style={{ margin: 0 }}>
- {time ?? t("allDay", { defaultValue: "All day" })}
- </Text>
- </Column>
- </Row>
- </Section>
+ <EventDetails
+ date={date}
+ time={time}
+ location={location}
+ conferencing={conferencing}
+ baseUrl={chrome.baseUrl}
+ locale={locale}
+ />
<Text>
{t("finalizeParticipant_content2", {
defaultValue:
@@ -149,10 +111,13 @@ FinalizeParticipantEmail.PreviewProps = {
title: "Untitled Poll",
hostName: "Host",
pollUrl: "https://rallly.co",
- day: "12",
- dow: "Fri",
date: "Friday, 12th June 2020",
time: "6:00 PM to 11:00 PM BST",
+ location: "Codfather, 100 Fish Street, London",
+ conferencing: {
+ provider: "meet",
+ url: "https://meet.google.com/oce-zdyd-aoq",
+ },
locale: "en",
chrome: previewChrome,
} as FinalizeParticipantEmailProps;
diff --git a/packages/emails/src/templates/new-comment.tsx b/packages/emails/src/templates/new-comment.tsx
index 5b0f00ca5..1723bf1bf 100644
--- a/packages/emails/src/templates/new-comment.tsx
+++ b/packages/emails/src/templates/new-comment.tsx
@@ -12,6 +12,7 @@ import {
Heading,
Link,
Section,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
@@ -75,7 +76,7 @@ async function NewCommentEmail({
ns="emails"
i18nKey="newComment_content"
defaults="<b>{authorName}</b> has commented on <b>{title}</b>."
- components={{ b: <strong /> }}
+ components={{ b: <Strong /> }}
values={{ authorName, title }}
/>
</Text>
diff --git a/packages/emails/src/templates/new-participant-confirmation.tsx b/packages/emails/src/templates/new-participant-confirmation.tsx
index d1f7aa6c5..af3b07ef2 100644
--- a/packages/emails/src/templates/new-participant-confirmation.tsx
+++ b/packages/emails/src/templates/new-participant-confirmation.tsx
@@ -10,6 +10,7 @@ import {
Container,
Heading,
Link,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
@@ -59,7 +60,7 @@ async function NewParticipantConfirmationEmail({
ns="emails"
i18nKey="newParticipantConfirmation_content"
defaults="Your response to <b>{title}</b> has been submitted."
- components={{ b: <strong /> }}
+ components={{ b: <Strong /> }}
values={{ title }}
/>
</Text>
diff --git a/packages/emails/src/templates/new-participant.tsx b/packages/emails/src/templates/new-participant.tsx
index c4e55f241..280d0042f 100644
--- a/packages/emails/src/templates/new-participant.tsx
+++ b/packages/emails/src/templates/new-participant.tsx
@@ -12,6 +12,7 @@ import {
Heading,
Link,
Section,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
@@ -80,7 +81,7 @@ async function NewParticipantEmail({
ns="emails"
i18nKey="newParticipant_content"
defaults="<b>{name}</b> has responded to <b>{title}</b>."
- components={{ b: <strong /> }}
+ components={{ b: <Strong /> }}
values={{ name: participantName, title }}
/>
</Text>
diff --git a/packages/emails/src/templates/new-poll.tsx b/packages/emails/src/templates/new-poll.tsx
index ebf7eb0e4..353f2a681 100644
--- a/packages/emails/src/templates/new-poll.tsx
+++ b/packages/emails/src/templates/new-poll.tsx
@@ -10,6 +10,7 @@ import {
Container,
Heading,
Link,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
@@ -64,7 +65,7 @@ async function NewPollEmail({
i18nKey="newPoll_content"
values={{ title }}
components={{
- b: <strong />,
+ b: <Strong />,
}}
defaults="Your meeting poll titled <b>{title}</b> is ready! Share it using the link below:"
/>
diff --git a/packages/emails/src/templates/poll-invite.tsx b/packages/emails/src/templates/poll-invite.tsx
index 4e05581d8..15796261f 100644
--- a/packages/emails/src/templates/poll-invite.tsx
+++ b/packages/emails/src/templates/poll-invite.tsx
@@ -9,6 +9,7 @@ import {
Button,
Container,
Heading,
+ Strong,
Text,
} from "../components/styled-components";
import { createEmailI18n } from "../i18n";
@@ -60,7 +61,7 @@ async function PollInviteEmail({
i18nKey="pollInvite_content"
defaults="<b>{hostName}</b> is finding a time for <b>{pollTitle}</b> and wants to know when you're available."
values={{ hostName, pollTitle }}
- components={{ b: <strong /> }}
+ components={{ b: <Strong /> }}
/>
</Text>
<Button href={inviteUrl} id="inviteUrl" color={chrome.primaryColor}>
diff --git a/packages/emails/src/templates/register.tsx b/packages/emails/src/templates/register.tsx
index c653c279e..f11477f4d 100644
--- a/packages/emails/src/templates/register.tsx
+++ b/packages/emails/src/templates/register.tsx
@@ -61,7 +61,7 @@ async function RegisterEmail({
style={{
...trackingWide,
fontSize: "32px",
- fontWeight: "bold",
+ fontWeight: 600,
}}
id="code"
>
diff --git a/packages/emails/src/types.ts b/packages/emails/src/types.ts
index 48fe46e34..b087f41a7 100644
--- a/packages/emails/src/types.ts
+++ b/packages/emails/src/types.ts
@@ -20,3 +20,13 @@ export type EmailChrome = EmailBranding & {
domain: string;
supportEmail: string;
};
+
+/**
+ * The meeting an event email shows under its date. `label` names a custom
+ * meeting; `url` is omitted when there is nothing to join.
+ */
+export type EmailConferencing = {
+ provider: "zoom" | "meet" | "teams" | "phone" | "custom";
+ label?: string;
+ url?: string;
+};