The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
edited project invite email
Steven Teyd5f5e991a949
diff --git a/components/app/modals/accept-invite-modal.tsx b/components/app/modals/accept-invite-modal.tsxindex 2136f786d3..fcd4cf0d7f 100644--- a/components/app/modals/accept-invite-modal.tsx+++ b/components/app/modals/accept-invite-modal.tsx@@ -47,7 +47,7 @@ function AcceptInviteModal({<span className="font-mono text-purple-600">{slug || "......"}</span>{" "}- team on Dub+ project on Dub</p></div><div className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16">diff --git a/emails/TeamInvite.tsx b/emails/ProjectInvite.tsxsimilarity index 84%rename from emails/TeamInvite.tsxrename to emails/ProjectInvite.tsxindex 90d0855f7f..f5bf730feb 100644--- a/emails/TeamInvite.tsx+++ b/emails/ProjectInvite.tsx@@ -13,7 +13,7 @@ import Head from "./components/Head";import Header from "./components/Header";import { purple } from "./components/theme";-export default function TeamInvite({ url }: { url: string }): JSX.Element {+export default function ProjectInvite({ url }: { url: string }): JSX.Element {return (<Mjml><Head />@@ -23,12 +23,13 @@ export default function TeamInvite({ url }: { url: string }): JSX.Element {<MjmlSection cssClass="smooth"><MjmlColumn><MjmlText cssClass="paragraph">- You've been invited to join a team on Dub+ You've been invited to join a project on Dub!</MjmlText><MjmlText cssClass="paragraph">- Please click the magic link below to sign in to your account.+ You can use the magic link below to sign in to Dub and join the+ project.</MjmlText>- <ButtonPrimary link={url} uiText="Sign In" />+ <ButtonPrimary link={url} uiText="Join Project" /><MjmlText cssClass="paragraph">If you're on a mobile device, you can also copy the link belowand paste it into the browser of your choice.diff --git a/emails/previews/Account.tsx b/emails/previews/Account.tsxindex 724045291c..fdc37a6683 100644--- a/emails/previews/Account.tsx+++ b/emails/previews/Account.tsx@@ -1,5 +1,5 @@import { default as LoginLinkEmail } from "../LoginLink";-import { default as TeamInviteEmail } from "../TeamInvite";+import { default as ProjectInviteEmail } from "../ProjectInvite";import { default as WelcomeEmailChild } from "../WelcomeEmail";export function LoginLink() {@@ -8,9 +8,9 @@ export function LoginLink() {);}-export function TeamInvite() {+export function ProjectInvite() {return (- <TeamInviteEmail url="http://app.localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]" />+ <ProjectInviteEmail url="http://app.localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]" />);}diff --git a/pages/api/projects/[slug]/invite/index.tsx b/pages/api/projects/[slug]/invite/index.tsxindex 51fab976aa..240d3e908b 100644--- a/pages/api/projects/[slug]/invite/index.tsx+++ b/pages/api/projects/[slug]/invite/index.tsx@@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";import { withProjectAuth } from "@/lib/auth";import prisma from "@/lib/prisma";import sendMail from "emails";-import TeamInvite from "emails/TeamInvite";+import ProjectInvite from "emails/ProjectInvite";import { randomBytes, createHash } from "crypto";import { ProjectProps } from "@/lib/types";@@ -63,6 +63,8 @@ export default withProjectAuth(const expires = new Date(Date.now() + ONE_WEEK_IN_SECONDS * 1000);// create a project invite record and a verification request token that lasts for a week+ // here we use a try catch to account for the case where the user has already been invited+ // for which `prisma.projectInvite.create()` will throw a unique constraint errortry {await prisma.projectInvite.create({data: {@@ -91,7 +93,7 @@ export default withProjectAuth(sendMail({subject: "You've been invited to join a project on Dub",to: email,- component: <TeamInvite url={url} />,+ component: <ProjectInvite url={url} />,});return res.status(200).json({ message: "Invite sent" });