Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add email templates

Tim Wilson991da0b0c284
diff --git a/packages/email/src/templates/new-message-from-partner.tsx b/packages/email/src/templates/new-message-from-partner.tsx
new file mode 100644
index 0000000000..e901c53271
--- /dev/null
+++ b/packages/email/src/templates/new-message-from-partner.tsx
@@ -0,0 +1,129 @@
+import { DUB_WORDMARK, OG_AVATAR_URL } from "@dub/utils";
+import {
+ Body,
+ Column,
+ Container,
+ Head,
+ Heading,
+ Html,
+ Img,
+ Link,
+ Preview,
+ Row,
+ Section,
+ Tailwind,
+ Text,
+} from "@react-email/components";
+import { Footer } from "../components/footer";
+
+const MAX_DISPLAYED_MESSAGES = 3;
+
+export default function NewMessageFromPartner({
+ workspaceSlug = "acme",
+ partner = {
+ id: "pn_xxx",
+ name: "Marvin Ta",
+ image: null,
+ },
+ messages = [
+ {
+ text: "Am I eligible for that one bounty?",
+ createdAt: new Date(Date.now() - 1000 * 60 * 5),
+ },
+ // {
+ // text: "Pls respond",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "Pls respond",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "Pls respond",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "Pls respond",
+ // createdAt: new Date(),
+ // },
+ ],
+ email = "[email protected]",
+}: {
+ workspaceSlug: string;
+ partner: {
+ id: string;
+ name: string;
+ image: string | null;
+ };
+ messages: {
+ text: string;
+ createdAt: Date;
+ }[];
+ email: string;
+}) {
+ return (
+ <Html>
+ <Head />
+ <Preview>Bounty completed</Preview>
+ <Tailwind>
+ <Body className="mx-auto my-auto bg-white font-sans">
+ <Container className="mx-auto my-8 max-w-[600px] px-8 py-8">
+ <Section className="mt-8">
+ <Img src={DUB_WORDMARK} height="32" alt="Dub" />
+ </Section>
+
+ <Section className="my-8">
+ <Heading className="my-0 text-lg font-semibold text-black">
+ {messages.length > 1
+ ? `${messages.length} new messages`
+ : "New message"}{" "}
+ from {partner.name}
+ </Heading>
+ <Link
+ className="text-[13px] font-medium text-neutral-500 underline"
+ href={`https://app.dub.co/${workspaceSlug}/program/partners?partnerId=${partner.id}`}
+ >
+ View profile in Dub
+ </Link>
+ </Section>
+
+ <Section className="rounded-xl border border-solid border-neutral-200 p-6">
+ {messages.slice(0, MAX_DISPLAYED_MESSAGES).map((message, idx) => (
+ <Row className={idx > 0 ? "pt-3" : ""}>
+ <Column className="align-bottom">
+ <Img
+ src={partner.image || `${OG_AVATAR_URL}${partner.name}`}
+ width="32"
+ height="32"
+ alt={partner.name}
+ className="rounded-full"
+ />
+ </Column>
+ <Column className="w-full pl-2">
+ <Text className="my-0 rounded-lg rounded-bl-none bg-neutral-100 px-4 py-2.5 text-sm leading-5 text-neutral-800">
+ {message.text}
+ </Text>
+ </Column>
+ </Row>
+ ))}
+ {messages.length > MAX_DISPLAYED_MESSAGES && (
+ <Text className="mt-4 text-center text-[12px] text-neutral-500">
+ {messages.length - MAX_DISPLAYED_MESSAGES} more messages from{" "}
+ {partner.name}
+ </Text>
+ )}
+ <Link
+ className="mt-4 block rounded-lg bg-neutral-900 px-6 py-3 text-center text-[13px] font-medium text-white no-underline"
+ href={`https://app.dub.co/${workspaceSlug}/program/messages/${partner.id}`}
+ >
+ View in Dub
+ </Link>
+ </Section>
+
+ <Footer email={email} />
+ </Container>
+ </Body>
+ </Tailwind>
+ </Html>
+ );
+}
diff --git a/packages/email/src/templates/new-message-from-program.tsx b/packages/email/src/templates/new-message-from-program.tsx
new file mode 100644
index 0000000000..b57e75adee
--- /dev/null
+++ b/packages/email/src/templates/new-message-from-program.tsx
@@ -0,0 +1,154 @@
+import { DUB_WORDMARK, OG_AVATAR_URL } from "@dub/utils";
+import {
+ Body,
+ Column,
+ Container,
+ Head,
+ Heading,
+ Html,
+ Img,
+ Link,
+ Preview,
+ Row,
+ Section,
+ Tailwind,
+ Text,
+} from "@react-email/components";
+import { Footer } from "../components/footer";
+
+const MAX_DISPLAYED_MESSAGES = 3;
+
+export default function NewMessageFromProgram({
+ user = {
+ name: "Brendan Urie",
+ image: null,
+ },
+ program = {
+ name: "Acme",
+ slug: "acme",
+ logo: "https://assets.dub.co/misc/acme-logo.png",
+ },
+ messages = [
+ {
+ text: "You are for sure eligible. We'll most likely make those changes within the next day or two. Stay tuned.",
+ createdAt: new Date(Date.now() - 1000 * 60 * 5),
+ },
+ // {
+ // text: "You're all set now!",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "You're all set now!",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "You're all set now!",
+ // createdAt: new Date(),
+ // },
+ // {
+ // text: "You're all set now!",
+ // createdAt: new Date(),
+ // },
+ ],
+ email = "[email protected]",
+}: {
+ user: {
+ name: string;
+ image: string | null;
+ };
+ program: {
+ name: string;
+ slug: string;
+ logo: string | null;
+ };
+ messages: {
+ text: string;
+ createdAt: Date;
+ }[];
+ email: string;
+}) {
+ return (
+ <Html>
+ <Head />
+ <Preview>Bounty completed</Preview>
+ <Tailwind>
+ <Body className="mx-auto my-auto bg-white font-sans">
+ <Container className="mx-auto my-8 max-w-[600px] px-8 py-8">
+ <Section className="mt-8">
+ <Img src={DUB_WORDMARK} height="32" alt="Dub" />
+ </Section>
+
+ <Section className="my-8">
+ <div className="flex items-center">
+ <Img
+ src={program.logo || "https://assets.dub.co/logo.png"}
+ width="32"
+ height="32"
+ alt={program.name}
+ className="rounded-full"
+ />
+ <Section className="ml-4">
+ <Heading className="my-0 text-lg font-semibold text-black">
+ {program.name} sent{" "}
+ {messages.length > 1
+ ? `${messages.length} messages`
+ : "a message"}
+ </Heading>
+ <Link
+ className="text-[13px] font-medium text-neutral-500 underline"
+ href={`https://partners.dub.co/programs/${program.slug}`}
+ >
+ View program in Dub
+ </Link>
+ </Section>
+ </div>
+ </Section>
+
+ <Section className="rounded-xl border border-solid border-neutral-200 p-6">
+ {messages.slice(0, MAX_DISPLAYED_MESSAGES).map((message, idx) => (
+ <Row className={idx > 0 ? "pt-3" : ""}>
+ <Column className="align-bottom">
+ <Img
+ src={user.image || `${OG_AVATAR_URL}${user.name}`}
+ width="32"
+ height="32"
+ alt={user.name}
+ className="rounded-full"
+ />
+ </Column>
+ <Column className="w-full pl-2">
+ <Text className="my-0 text-[12px] font-medium text-neutral-500">
+ <span className="text-neutral-700">{user.name}</span>
+ &nbsp;&nbsp;
+ {message.createdAt.toLocaleTimeString("en-US", {
+ hour: "numeric",
+ minute: "numeric",
+ })}
+ </Text>
+ <Text className="my-0 rounded-lg rounded-bl-none bg-neutral-100 px-4 py-2.5 text-sm leading-5 text-neutral-800">
+ {message.text}
+ </Text>
+ </Column>
+ </Row>
+ ))}
+ {messages.length > MAX_DISPLAYED_MESSAGES && (
+ <Text className="mt-4 text-center text-[12px] text-neutral-500">
+ {messages.length - MAX_DISPLAYED_MESSAGES} more messages from{" "}
+ {program.name}
+ </Text>
+ )}
+ <Link
+ className="mt-4 block rounded-lg bg-neutral-900 px-6 py-3 text-center text-[13px] font-medium text-white no-underline"
+ href={`https://partners.dub.co/messages/${program.slug}`}
+ >
+ Reply in Dub
+ </Link>
+ </Section>
+
+ <Footer email={email} />
+ </Container>
+ </Body>
+ </Tailwind>
+ </Html>
+ );
+}