From 7b6d3e5f4c114fe9d7170c6c4d7cd57ee228e28c Mon Sep 17 00:00:00 2001 From: Maximilian Kaske Date: Sat, 4 Jan 2025 21:03:13 +0100 Subject: [PATCH] chore: add monitor deactivation --- .../emails/emails/monitor-deactivation.tsx | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 packages/emails/emails/monitor-deactivation.tsx diff --git a/packages/emails/emails/monitor-deactivation.tsx b/packages/emails/emails/monitor-deactivation.tsx new file mode 100644 index 00000000..44e0c1cb --- /dev/null +++ b/packages/emails/emails/monitor-deactivation.tsx @@ -0,0 +1,68 @@ +/** @jsxImportSource react */ + +import { + Body, + Button, + Head, + Heading, + Html, + Preview, + Text, +} from "@react-email/components"; +import { z } from "zod"; +import { Layout } from "./_components/layout"; +import { styles } from "./_components/styles"; + +export const MonitorDeactivationSchema = z.object({ + lastLogin: z.coerce.date(), + deactivateAt: z.coerce.date(), + reminder: z.boolean().optional(), +}); + +export type MonitorDeactivationProps = z.infer< + typeof MonitorDeactivationSchema +>; + +const MonitorDeactivationEmail = ({ + lastLogin, + deactivateAt, + reminder, +}: MonitorDeactivationProps) => { + return ( + + + + {reminder ? "[REMINDER] " : ""}Deactivation of your monitor(s) + + + + Deactivation of the your monitor(s) + Your last login was {lastLogin.toDateString()}. + + To avoid having stale monitors and reduce the number of testing + accounts, we will deactivate your monitor(s) at{" "} + {deactivateAt.toDateString()}. + + + If you would like to keep your monitor(s) active, please login to + your account or upgrade your plan. + + + + + + + + ); +}; + +MonitorDeactivationEmail.PreviewProps = { + lastLogin: new Date(new Date().setDate(new Date().getDate() - 100)), + deactivateAt: new Date(new Date().setDate(new Date().getDate() + 7)), + reminder: true, +} satisfies MonitorDeactivationProps; + +export { MonitorDeactivationEmail }; +export default MonitorDeactivationEmail; -- 2.51.2