Skip to content

Commit d3f4309

Browse files
feat(web): implement functional Signal Transmission contact UI with Resend
1 parent 117c33d commit d3f4309

5 files changed

Lines changed: 362 additions & 102 deletions

File tree

apps/web/app/actions/contact.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use server';
2+
3+
import { Resend } from 'resend';
4+
5+
const resend = new Resend(process.env.RESEND_API_KEY);
6+
7+
export async function sendContactAction(formData: FormData) {
8+
const name = formData.get('name') as string;
9+
const email = formData.get('email') as string;
10+
const message = formData.get('message') as string;
11+
12+
if (!name || !email || !message) {
13+
return { error: 'All fields are required for transmission.' };
14+
}
15+
16+
try {
17+
const { data, error } = await resend.emails.send({
18+
from: 'Contact Signal <onboarding@resend.dev>',
19+
to: 'fairshare4u@gmail.com',
20+
subject: `New Signal from ${name}`,
21+
replyTo: email,
22+
html: `
23+
<div style="font-family: sans-serif; padding: 20px; color: #333; background: #fafafa; border-radius: 12px;">
24+
<h2 style="color: #7c3aed; margin-bottom: 4px;">Incoming Transmission</h2>
25+
<p style="font-size: 12px; color: #666; margin-bottom: 24px;">Source: ${name} (${email})</p>
26+
27+
<div style="background: white; padding: 20px; border-radius: 8px; border: 1px solid #eee;">
28+
<p style="margin: 0; white-space: pre-wrap;">${message}</p>
29+
</div>
30+
31+
<hr style="border: none; border-top: 1px solid #eee; margin: 24px 0;" />
32+
<p style="font-size: 10px; color: #999; text-transform: uppercase; letter-spacing: 1px;">FairShare Signal Protocol v1.0</p>
33+
</div>
34+
`,
35+
});
36+
37+
if (error) {
38+
console.error('Resend Contact Error:', error);
39+
return { error: 'Transmission interrupted. Please try again.' };
40+
}
41+
42+
return { success: true };
43+
} catch (err) {
44+
console.error('Contact Action Error:', err);
45+
return { error: 'System error. Protocol failure.' };
46+
}
47+
}

apps/web/app/contact/layout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Metadata } from 'next';
2+
3+
export const metadata: Metadata = {
4+
title: 'Contact | FairShare – Hit Us Up',
5+
description: 'Whether you have a bug report or just want to say hi, our squad is standing by. Reach out through our direct transmission channels.',
6+
};
7+
8+
export default function ContactLayout({
9+
children,
10+
}: {
11+
children: React.ReactNode;
12+
}) {
13+
return <>{children}</>;
14+
}

0 commit comments

Comments
 (0)