From 68d6ab6382ea6c7f39b3e84328c36e968549c533 Mon Sep 17 00:00:00 2001 From: development Date: Tue, 13 Jan 2026 13:49:19 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/app/page.tsx b/src/app/page.tsx index 344705e..29a5d56 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -20,6 +20,8 @@ const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY export default function LandingPage() { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); + const [email, setEmail] = useState(''); + const [smsPhone, setSmsPhone] = useState(''); const handlePayment = async () => { try { @@ -61,6 +63,37 @@ export default function LandingPage() { } }; + const handleSignup = async (e: React.FormEvent) => { + e.preventDefault(); + try { + setLoading(true); + setError(null); + + const response = await fetch('/api/send-sms', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + email, + phone: smsPhone, + }), + }); + + if (!response.ok) { + throw new Error('Failed to send SMS'); + } + + setEmail(''); + setSmsPhone(''); + // Show success message or redirect as needed + } catch (err) { + setError(err instanceof Error ? err.message : 'Signup error occurred'); + } finally { + setLoading(false); + } + }; + return ( { + // Handle newsletter signup + console.log('Newsletter signup:', email); + }} ariaLabel="Newsletter signup section" className="py-20 md:py-28" titleClassName="text-3xl md:text-5xl font-semibold" @@ -325,6 +362,48 @@ export default function LandingPage() { /> +
+
+
+

Sign Up & Get SMS Notification

+

Join our community and receive cooking updates via SMS.

+
+
+
+ setEmail(e.target.value)} + required + className="w-full px-4 py-2 bg-secondary-cta text-foreground rounded-full border border-accent/30 focus:outline-none focus:ring-2 focus:ring-primary-cta" + /> +
+
+ setSmsPhone(e.target.value)} + required + className="w-full px-4 py-2 bg-secondary-cta text-foreground rounded-full border border-accent/30 focus:outline-none focus:ring-2 focus:ring-primary-cta" + /> +
+ + {error && ( +

{error}

+ )} +
+

We'll send you a welcome SMS and cooking updates

+
+
+
-- 2.49.1