Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5fd3ec8e8 | |||
| 3eb21771d1 | |||
| 2f113b3b0f | |||
| f4eeb48f17 | |||
| 26507f4126 | |||
| 0924e85ee7 | |||
| 416688826f | |||
| e80dcca1a8 | |||
| 6b7ca8c352 | |||
| 416ab0fb9c | |||
| fc3c5dbe19 | |||
| a3258ea000 | |||
| 80eda59319 | |||
| 63f1f58dc9 | |||
| 8f96928c52 | |||
| 92065771c3 | |||
| 1792646e60 | |||
| 7d9e3379cc | |||
| a255161583 | |||
| ad8bbfecf6 | |||
| 73710d854b | |||
| 68469d88dd | |||
| 63c8304a3b | |||
| b956958798 | |||
| e91715a197 | |||
| c75dd59c0a |
86
src/app/api/waitlist/route.ts
Normal file
86
src/app/api/waitlist/route.ts
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
|
||||||
|
interface WaitlistEntry {
|
||||||
|
email: string;
|
||||||
|
instagram?: string;
|
||||||
|
tiktok?: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In-memory storage for demonstration
|
||||||
|
// In production, replace with actual database (MongoDB, PostgreSQL, etc.)
|
||||||
|
const waitlistEntries: WaitlistEntry[] = [];
|
||||||
|
|
||||||
|
export async function POST(request: NextRequest) {
|
||||||
|
try {
|
||||||
|
const body = await request.json();
|
||||||
|
const { email, instagram, tiktok } = body;
|
||||||
|
|
||||||
|
// Validate email
|
||||||
|
if (!email || typeof email !== 'string' || !email.includes('@')) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ error: 'Valid email is required' },
|
||||||
|
{ status: 400 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for duplicate email
|
||||||
|
if (waitlistEntries.some(entry => entry.email === email)) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ error: 'Email already registered' },
|
||||||
|
{ status: 409 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create waitlist entry
|
||||||
|
const entry: WaitlistEntry = {
|
||||||
|
email,
|
||||||
|
instagram: instagram || undefined,
|
||||||
|
tiktok: tiktok || undefined,
|
||||||
|
createdAt: new Date().toISOString()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add to in-memory storage
|
||||||
|
waitlistEntries.push(entry);
|
||||||
|
|
||||||
|
// TODO: In production, save to database here
|
||||||
|
// Example for MongoDB:
|
||||||
|
// await db.collection('waitlist').insertOne(entry);
|
||||||
|
|
||||||
|
// TODO: Send confirmation email
|
||||||
|
// Example:
|
||||||
|
// await sendEmail({
|
||||||
|
// to: email,
|
||||||
|
// subject: 'Welcome to Clearance Waitlist',
|
||||||
|
// template: 'waitlist-confirmation'
|
||||||
|
// });
|
||||||
|
|
||||||
|
console.log('Waitlist entry created:', entry);
|
||||||
|
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: true,
|
||||||
|
message: 'Successfully joined the waitlist',
|
||||||
|
data: entry
|
||||||
|
},
|
||||||
|
{ status: 201 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Waitlist API error:', error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{ error: 'Internal server error' },
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
// Optional: Get all waitlist entries (add authentication in production)
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
count: waitlistEntries.length,
|
||||||
|
entries: waitlistEntries
|
||||||
|
},
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -15,6 +15,9 @@ export default function RootLayout({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<script async src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||||
|
</head>
|
||||||
<body className={inter.className}>{children}
|
<body className={inter.className}>{children}
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
@@ -1385,4 +1388,4 @@ export default function RootLayout({
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,26 @@ export default function LandingPage() {
|
|||||||
const [formStatus, setFormStatus] = useState<'idle' | 'success' | 'error'>('idle');
|
const [formStatus, setFormStatus] = useState<'idle' | 'success' | 'error'>('idle');
|
||||||
const contactFormRef = useRef<HTMLDivElement>(null);
|
const contactFormRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const handleWaitlistSubmit = (formData: WaitlistFormData) => {
|
const handleWaitlistSubmit = async (formData: WaitlistFormData) => {
|
||||||
try {
|
try {
|
||||||
|
const response = await fetch('/api/waitlist', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(formData),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorData = await response.json();
|
||||||
|
throw new Error(errorData.error || 'Failed to submit form');
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
setWaitlistData([...waitlistData, formData]);
|
setWaitlistData([...waitlistData, formData]);
|
||||||
setFormStatus('success');
|
setFormStatus('success');
|
||||||
setTimeout(() => setFormStatus('idle'), 3000);
|
setTimeout(() => setFormStatus('idle'), 3000);
|
||||||
console.log('Waitlist submission:', formData);
|
console.log('Waitlist submission successful:', responseData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setFormStatus('error');
|
setFormStatus('error');
|
||||||
console.error('Error submitting waitlist form:', error);
|
console.error('Error submitting waitlist form:', error);
|
||||||
@@ -52,7 +66,6 @@ export default function LandingPage() {
|
|||||||
const handleJoinWaitlistClick = () => {
|
const handleJoinWaitlistClick = () => {
|
||||||
if (contactFormRef.current) {
|
if (contactFormRef.current) {
|
||||||
contactFormRef.current.scrollIntoView({ behavior: 'smooth' });
|
contactFormRef.current.scrollIntoView({ behavior: 'smooth' });
|
||||||
// Focus on the email input after scroll
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const emailInput = contactFormRef.current?.querySelector('input[type="email"]') as HTMLInputElement;
|
const emailInput = contactFormRef.current?.querySelector('input[type="email"]') as HTMLInputElement;
|
||||||
if (emailInput) {
|
if (emailInput) {
|
||||||
@@ -118,13 +131,13 @@ export default function LandingPage() {
|
|||||||
animationType="slide-up"
|
animationType="slide-up"
|
||||||
metrics={[
|
metrics={[
|
||||||
{
|
{
|
||||||
id: "1", value: "Brands", title: "Run Your Content Past Expiry", items: ["No expiration tracking", "Licenses silently expire", "Brands keep profiting—you don't"]
|
id: "1", value: "Brands Use Expired Licenses", title: "Content Keeps Running Past Expiry", items: ["No expiration tracking", "Licenses silently expire", "Brands keep profiting—you don't"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "2", value: "You Never", title: "Invoice the Renewal", items: ["Manual renewal follow-ups", "Easy to forget", "Lost revenue disappears"]
|
id: "2", value: "You Miss Renewal Invoices", title: "Nobody Remembers to Bill", items: ["Manual renewal follow-ups", "Easy to forget", "Lost revenue disappears"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "3", value: "That's Money", title: "You'll Never See", items: ["Average loss: $1,200/creator", "Expires quarterly", "Compounds over time"]
|
id: "3", value: "Revenue Slips Away Silently", title: "Money Lost to Expired Deals", items: ["Average loss: $1,200/creator", "Expires quarterly", "Compounds over time"]
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@@ -316,13 +329,13 @@ function WaitlistFormSection({ onSubmit, formStatus }: { onSubmit: (data: Waitli
|
|||||||
<div className="max-w-4xl mx-auto px-4 py-12">
|
<div className="max-w-4xl mx-auto px-4 py-12">
|
||||||
<div className="bg-card rounded-lg p-8 shadow-sm">
|
<div className="bg-card rounded-lg p-8 shadow-sm">
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h2 className="text-3xl font-bold mb-2">Get Early Access</h2>
|
<h2 className="text-3xl font-bold mb-2 break-words overflow-hidden text-ellipsis">Get Early Access</h2>
|
||||||
<p className="text-foreground/70">Join the waitlist and be among the first to protect your IP revenue. Early adopters get lifetime discounts and 1-on-1 onboarding.</p>
|
<p className="text-foreground/70 break-words overflow-hidden text-ellipsis">Join the waitlist and be among the first to protect your IP revenue. Early adopters get lifetime discounts and 1-on-1 onboarding.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-4">
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="email" className="block text-sm font-medium mb-2">
|
<label htmlFor="email" className="block text-sm font-medium mb-2 break-words overflow-hidden text-ellipsis">
|
||||||
Email Address <span className="text-primary-cta">*</span>
|
Email Address <span className="text-primary-cta">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
@@ -335,7 +348,7 @@ function WaitlistFormSection({ onSubmit, formStatus }: { onSubmit: (data: Waitli
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="instagram" className="block text-sm font-medium mb-2">
|
<label htmlFor="instagram" className="block text-sm font-medium mb-2 break-words overflow-hidden text-ellipsis">
|
||||||
Instagram Handle <span className="text-foreground/50">(optional)</span>
|
Instagram Handle <span className="text-foreground/50">(optional)</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
@@ -347,7 +360,7 @@ function WaitlistFormSection({ onSubmit, formStatus }: { onSubmit: (data: Waitli
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="tiktok" className="block text-sm font-medium mb-2">
|
<label htmlFor="tiktok" className="block text-sm font-medium mb-2 break-words overflow-hidden text-ellipsis">
|
||||||
TikTok Handle <span className="text-foreground/50">(optional)</span>
|
TikTok Handle <span className="text-foreground/50">(optional)</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
@@ -368,22 +381,22 @@ function WaitlistFormSection({ onSubmit, formStatus }: { onSubmit: (data: Waitli
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
{formStatus === 'success' && (
|
{formStatus === 'success' && (
|
||||||
<div className="mt-4 p-4 bg-green-100/20 border border-green-500/30 rounded-lg text-green-700 text-sm">
|
<div className="mt-4 p-4 bg-green-100/20 border border-green-500/30 rounded-lg text-green-700 text-sm break-words overflow-hidden text-ellipsis">
|
||||||
✓ Successfully joined the waitlist! Check your email for confirmation.
|
✓ Successfully joined the waitlist! Check your email for confirmation.
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{formStatus === 'error' && (
|
{formStatus === 'error' && (
|
||||||
<div className="mt-4 p-4 bg-red-100/20 border border-red-500/30 rounded-lg text-red-700 text-sm">
|
<div className="mt-4 p-4 bg-red-100/20 border border-red-500/30 rounded-lg text-red-700 text-sm break-words overflow-hidden text-ellipsis">
|
||||||
× Something went wrong. Please try again.
|
× Something went wrong. Please try again.
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="mt-6 text-xs text-foreground/50 text-center">
|
<p className="mt-6 text-xs text-foreground/50 text-center break-words overflow-hidden text-ellipsis">
|
||||||
We respect your privacy. Unsubscribe anytime. No spam, ever.
|
We respect your privacy. Unsubscribe anytime. No spam, ever.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user