Skip to content

Commit 1dbd60f

Browse files
authored
Merge pull request #592 from trycompai/main
[comp] Production Deploy
2 parents 59f1d2f + b2f1159 commit 1dbd60f

File tree

6 files changed

+97
-85
lines changed

6 files changed

+97
-85
lines changed

apps/app/src/components/magic-link.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export function MagicLinkSignIn({ className, inviteCode }: Props) {
4444

4545
const { data, error } = await authClient.signIn.magicLink({
4646
email: email,
47-
})
47+
callbackURL: `/setup?inviteCode=${inviteCode}`,
48+
});
4849

4950
if (error) {
5051
toast.error(t("auth.email.error"));

apps/app/src/utils/auth.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ export const auth = betterAuth({
7474
}),
7575
magicLink({
7676
sendMagicLink: async ({ email, url }, request) => {
77+
const urlWithInviteCode = `${url}`;
7778
await sendEmail({
7879
to: email,
7980
subject: "Login to Comp AI",
80-
react: MagicLinkEmail({ email, url }),
81+
react: MagicLinkEmail({
82+
email,
83+
url: urlWithInviteCode,
84+
}),
8185
});
8286
},
8387
}),
Lines changed: 85 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,104 @@
11
import {
2-
Body,
3-
Button,
4-
Container,
5-
Font,
6-
Heading,
7-
Html,
8-
Link,
9-
Preview,
10-
Section,
11-
Tailwind,
12-
Text,
2+
Body,
3+
Button,
4+
Container,
5+
Font,
6+
Heading,
7+
Html,
8+
Link,
9+
Preview,
10+
Section,
11+
Tailwind,
12+
Text,
1313
} from "@react-email/components";
1414
import { Footer } from "../components/footer";
1515
import { Logo } from "../components/logo";
1616

1717
interface Props {
18-
email: string;
19-
url: string;
18+
email: string;
19+
url: string;
20+
inviteCode?: string;
2021
}
2122

22-
export const MagicLinkEmail = ({ email, url }: Props) => {
23-
return (
24-
<Html>
25-
<Tailwind>
26-
<head>
27-
<Font
28-
fontFamily="Geist"
29-
fallbackFontFamily="Helvetica"
30-
webFont={{
31-
url: "https://cdn.jsdelivr.net/npm/@fontsource/[email protected]/files/geist-sans-latin-400-normal.woff2",
32-
format: "woff2",
33-
}}
34-
fontWeight={400}
35-
fontStyle="normal"
36-
/>
23+
export const MagicLinkEmail = ({ email, url, inviteCode }: Props) => {
24+
return (
25+
<Html>
26+
<Tailwind>
27+
<head>
28+
<Font
29+
fontFamily="Geist"
30+
fallbackFontFamily="Helvetica"
31+
webFont={{
32+
url: "https://cdn.jsdelivr.net/npm/@fontsource/[email protected]/files/geist-sans-latin-400-normal.woff2",
33+
format: "woff2",
34+
}}
35+
fontWeight={400}
36+
fontStyle="normal"
37+
/>
3738

38-
<Font
39-
fontFamily="Geist"
40-
fallbackFontFamily="Helvetica"
41-
webFont={{
42-
url: "https://cdn.jsdelivr.net/npm/@fontsource/[email protected]/files/geist-sans-latin-500-normal.woff2",
43-
format: "woff2",
44-
}}
45-
fontWeight={500}
46-
fontStyle="normal"
47-
/>
48-
</head>
39+
<Font
40+
fontFamily="Geist"
41+
fallbackFontFamily="Helvetica"
42+
webFont={{
43+
url: "https://cdn.jsdelivr.net/npm/@fontsource/[email protected]/files/geist-sans-latin-500-normal.woff2",
44+
format: "woff2",
45+
}}
46+
fontWeight={500}
47+
fontStyle="normal"
48+
/>
49+
</head>
4950

50-
<Preview>Login Link for Comp AI</Preview>
51+
<Preview>Login Link for Comp AI</Preview>
5152

52-
<Body className="bg-[#fff] my-auto mx-auto font-sans">
53-
<Container
54-
className="border-transparent md:border-[#E8E7E1] my-[40px] mx-auto p-[20px] max-w-[600px]"
55-
style={{ borderStyle: "solid", borderWidth: 1 }}
56-
>
57-
<Logo />
58-
<Heading className="mx-0 my-[30px] p-0 text-[24px] font-normal text-[#121212] text-center">
59-
Your login link for Comp AI
60-
</Heading>
53+
<Body className="bg-[#fff] my-auto mx-auto font-sans">
54+
<Container
55+
className="border-transparent md:border-[#E8E7E1] my-[40px] mx-auto p-[20px] max-w-[600px]"
56+
style={{ borderStyle: "solid", borderWidth: 1 }}
57+
>
58+
<Logo />
59+
<Heading className="mx-0 my-[30px] p-0 text-[24px] font-normal text-[#121212] text-center">
60+
Your login link for Comp AI
61+
</Heading>
6162

62-
<Text className="text-[14px] leading-[24px] text-[#121212]">
63-
Your login link for Comp AI
64-
</Text>
65-
<Section className="mb-[42px] mt-[32px] text-center">
66-
<Button
67-
className="bg-transparent text-primary text-[14px] text-[#121212] font-medium no-underline text-center px-6 py-3 border border-solid border-[#121212]"
68-
href={url}
69-
>
70-
Login now
71-
</Button>
72-
</Section>
63+
<Text className="text-[14px] leading-[24px] text-[#121212]">
64+
Your login link for Comp AI
65+
</Text>
66+
<Section className="mb-[42px] mt-[32px] text-center">
67+
<Button
68+
className="bg-transparent text-primary text-[14px] text-[#121212] font-medium no-underline text-center px-6 py-3 border border-solid border-[#121212]"
69+
href={url}
70+
>
71+
Login now
72+
</Button>
73+
</Section>
7374

74-
<Text className="text-[14px] leading-[24px] text-[#707070] break-all">
75-
or copy and paste this URL into your browser{" "}
76-
<Link href={url} className="text-[#707070] underline">
77-
{url}
78-
</Link>
79-
</Text>
75+
<Text className="text-[14px] leading-[24px] text-[#707070] break-all">
76+
or copy and paste this URL into your browser{" "}
77+
<Link
78+
href={url}
79+
className="text-[#707070] underline"
80+
>
81+
{url}
82+
</Link>
83+
</Text>
8084

81-
<br />
82-
<Section>
83-
<Text className="text-[12px] leading-[24px] text-[#666666]">
84-
this login link was intended for{" "}
85-
<span className="text-[#121212] ">{email}</span>.{" "}
86-
</Text>
87-
</Section>
85+
<br />
86+
<Section>
87+
<Text className="text-[12px] leading-[24px] text-[#666666]">
88+
this login link was intended for{" "}
89+
<span className="text-[#121212] ">{email}</span>
90+
.{" "}
91+
</Text>
92+
</Section>
8893

89-
<br />
94+
<br />
9095

91-
<Footer />
92-
</Container>
93-
</Body>
94-
</Tailwind>
95-
</Html>
96-
);
96+
<Footer />
97+
</Container>
98+
</Body>
99+
</Tailwind>
100+
</Html>
101+
);
97102
};
98103

99104
export default MagicLinkEmail;

packages/email/lib/magic-link.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import { sendEmail } from "@comp/email/lib/resend";
44
export const sendMagicLinkEmail = async (params: {
55
url: string;
66
email: string;
7+
inviteCode?: string;
78
}) => {
8-
const { url, email } = params;
9+
const { url, email, inviteCode } = params;
910

1011
const emailTemplate = MagicLinkEmail({
1112
email,
1213
url: url,
14+
inviteCode,
1315
});
16+
1417
try {
1518
await sendEmail({
1619
to: email,

release.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ module.exports = {
66
[
77
"semantic-release-discord-notifier",
88
{
9-
webhookUrl: "${DISCORD_WEBHOOK_URL}",
109
embedJson: {
11-
title: "New Release: ${nextRelease.version}",
10+
title: "New Release of Comp AI: ${nextRelease.version}",
1211
description: "${nextRelease.notes}",
1312
color: 5814783,
1413
},

0 commit comments

Comments
 (0)