From 7a0f89c4c02d908f504f2bdbc41e3fbea6f83f96 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 7 Feb 2026 21:42:24 +0000 Subject: [PATCH] feat: add mention email template --- packages/email/src/sendEmail.tsx | 6 +- packages/email/src/templates/mention.tsx | 108 +++++++++++++++++++++++ 2 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 packages/email/src/templates/mention.tsx diff --git a/packages/email/src/sendEmail.tsx b/packages/email/src/sendEmail.tsx index a087606c..1a696c62 100644 --- a/packages/email/src/sendEmail.tsx +++ b/packages/email/src/sendEmail.tsx @@ -3,14 +3,16 @@ import nodemailer from "nodemailer"; import JoinWorkspaceTemplate from "./templates/join-workspace"; import MagicLinkTemplate from "./templates/magic-link"; +import MentionTemplate from "./templates/mention"; import ResetPasswordTemplate from "./templates/reset-password"; -type Templates = "MAGIC_LINK" | "JOIN_WORKSPACE" | "RESET_PASSWORD"; +type Templates = "MAGIC_LINK" | "JOIN_WORKSPACE" | "RESET_PASSWORD" | "MENTION"; -const emailTemplates: Record = { +const emailTemplates: Record> = { MAGIC_LINK: MagicLinkTemplate, JOIN_WORKSPACE: JoinWorkspaceTemplate, RESET_PASSWORD: ResetPasswordTemplate, + MENTION: MentionTemplate, }; const transporter = nodemailer.createTransport({ diff --git a/packages/email/src/templates/mention.tsx b/packages/email/src/templates/mention.tsx new file mode 100644 index 00000000..5d97760f --- /dev/null +++ b/packages/email/src/templates/mention.tsx @@ -0,0 +1,108 @@ +import { Body } from "@react-email/body"; +import { Button } from "@react-email/button"; +import { Container } from "@react-email/container"; +import { Head } from "@react-email/head"; +import { Heading } from "@react-email/heading"; +import { Hr } from "@react-email/hr"; +import { Html } from "@react-email/html"; +import { Link } from "@react-email/link"; +import { Preview } from "@react-email/preview"; +import { Text } from "@react-email/text"; +import { env } from "next-runtime-env"; +import * as React from "react"; + +export const MentionTemplate = ({ + commenterName, + boardName, + cardTitle, + cardUrl, +}: { + commenterName: string; + boardName: string; + cardTitle: string; + cardUrl: string; +}) => ( + + + + {commenterName} mentioned you in a comment on {cardTitle} + + + + + kan.bn + + + You were mentioned in a comment + + + {commenterName} mentioned you in a comment on the + card {cardTitle} in the board {boardName}. + + +
+ + + Kan + + , the open source Trello alternative. + +
+ + +); + +export default MentionTemplate; +