Skip to content

Commit f62fea6

Browse files
committed
chore: update package.json and pnpm-lock.yaml with new dependencies and build script
- Modified the build script in package.json to include webpack. - Added new dependencies: @react-email/render, embla-carousel-autoplay, micromark-extension-gfm-table, and react-markdown. - Updated pnpm-lock.yaml to reflect the new package versions and dependencies.
1 parent bb193a4 commit f62fea6

File tree

11 files changed

+2306
-107
lines changed

11 files changed

+2306
-107
lines changed

app/(dashboard)/layout.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ export default async function DashboardLayout({
88
}: {
99
children: React.ReactNode;
1010
}) {
11-
const supabase = await createClient();
12-
const {
13-
data: { user },
14-
} = await supabase.auth.getUser();
11+
const hasSupabase =
12+
process.env.NEXT_PUBLIC_SUPABASE_URL &&
13+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
14+
15+
let user = null;
16+
if (hasSupabase) {
17+
const supabase = await createClient();
18+
const { data } = await supabase.auth.getUser();
19+
user = data?.user ?? null;
20+
}
1521

1622
if (!user) {
1723
return <>{children}</>;

app/api/sponsorship/route.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ const sanityWriteClient = createClient({
1616
useCdn: false,
1717
});
1818

19-
const resend = new Resend(process.env.RESEND_SPONSORSHIP_API_KEY);
20-
2119
const rateLimitStore: Record<string, { count: number; timestamp: number }> = {};
2220

2321
const RATE_LIMIT_COUNT = 2; // 2 requests
@@ -115,9 +113,12 @@ export async function POST(request: Request) {
115113
}
116114

117115
try {
118-
console.log("Sending email with Resend");
119-
const { data, error } = await resend.emails.send({
120-
from: "Sponsorships <onboarding@resend.dev>",
116+
const resendApiKey = process.env.RESEND_SPONSORSHIP_API_KEY;
117+
if (resendApiKey) {
118+
console.log("Sending email with Resend");
119+
const resend = new Resend(resendApiKey);
120+
const { data, error } = await resend.emails.send({
121+
from: "Sponsorships <onboarding@resend.dev>",
121122
to: ["alex@codingcat.dev"],
122123
subject: "New Sponsorship Request",
123124
html: await render(
@@ -129,11 +130,14 @@ export async function POST(request: Request) {
129130
message,
130131
}),
131132
),
132-
});
133-
console.log("Resend response:", { data, error });
134-
if (error) {
135-
console.error("Failed to send email:", error);
136-
return NextResponse.json({ message: error.message }, { status: 400 });
133+
});
134+
console.log("Resend response:", { data, error });
135+
if (error) {
136+
console.error("Failed to send email:", error);
137+
return NextResponse.json({ message: error.message }, { status: 400 });
138+
}
139+
} else {
140+
console.warn("RESEND_SPONSORSHIP_API_KEY not set — skipping email");
137141
}
138142
} catch (error) {
139143
console.error("Error sending email with Resend:", error);

lib/sponsor/email-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Resend } from 'resend'
22

3-
const resend = new Resend(process.env.RESEND_API_KEY)
4-
53
const FROM_EMAIL = 'Alex Patterson <alex@codingcat.dev>'
64

75
/**
@@ -20,6 +18,7 @@ export async function sendSponsorEmail(
2018
}
2119

2220
try {
21+
const resend = new Resend(process.env.RESEND_API_KEY)
2322
const { data, error } = await resend.emails.send({
2423
from: FROM_EMAIL,
2524
to: [to],

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"scripts": {
44
"dev": "next dev --turbo",
5-
"build": "next build",
5+
"build": "next build --webpack",
66
"start": "next start",
77
"lint": "biome check .",
88
"predev": "npm run typegen",
@@ -46,6 +46,7 @@
4646
"@radix-ui/react-toggle": "^1.1.10",
4747
"@radix-ui/react-toggle-group": "^1.1.11",
4848
"@radix-ui/react-tooltip": "^1.2.8",
49+
"@react-email/render": "^2.0.4",
4950
"@remotion/cli": "^4.0.431",
5051
"@remotion/lambda": "^4.0.431",
5152
"@sanity/assist": "^5.0.4",
@@ -67,6 +68,7 @@
6768
"clsx": "^2.1.1",
6869
"cmdk": "^1.1.1",
6970
"date-fns": "^4.1.0",
71+
"embla-carousel-autoplay": "^8.6.0",
7072
"embla-carousel-react": "^8.6.0",
7173
"feed": "^5.2.0",
7274
"googleapis": "^171.4.0",
@@ -75,6 +77,7 @@
7577
"jwt-decode": "^4.0.0",
7678
"lucide-react": "^0.576.0",
7779
"micromark": "^4.0.2",
80+
"micromark-extension-gfm-table": "^2.0.0",
7881
"next": "^16.1.6",
7982
"next-cloudinary": "^6.17.5",
8083
"next-sanity": "^12.1.0",
@@ -92,6 +95,7 @@
9295
"react-inlinesvg": "^4.2.0",
9396
"react-instantsearch": "^7.26.0",
9497
"react-instantsearch-nextjs": "^1.1.0",
98+
"react-markdown": "^9.0.1",
9599
"react-resizable-panels": "^4.7.0",
96100
"react-syntax-highlighter": "^16.1.1",
97101
"react-twitter-embed": "^4.0.4",

0 commit comments

Comments
 (0)