Update src/app/page.tsx

This commit is contained in:
2026-01-13 13:43:20 +00:00
parent d23d1c5c3b
commit 0a45ac622c

View File

@@ -1,4 +1,4 @@
"use client"
"use client";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleMinimal from '@/components/navbar/NavbarStyleMinimal';
@@ -12,8 +12,55 @@ import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import ContactCenter from '@/components/sections/contact/ContactCenter';
import FooterBaseSocial from '@/components/sections/footer/FooterBaseSocial';
import { Flame, Users, CheckCircle, Heart, Sparkles, Mail, Instagram, Facebook, Youtube, Twitter } from "lucide-react";
import { loadStripe } from '@stripe/stripe-js';
import { useState } from 'react';
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '');
export default function LandingPage() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const handlePayment = async () => {
try {
setLoading(true);
setError(null);
const response = await fetch('/api/create-checkout-session', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 50,
}),
});
if (!response.ok) {
throw new Error('Failed to create checkout session');
}
const { sessionId } = await response.json();
const stripe = await stripePromise;
if (!stripe) {
throw new Error('Stripe failed to load');
}
const { error: redirectError } = await stripe.redirectToCheckout({
sessionId,
});
if (redirectError) {
setError(redirectError.message || 'Payment failed');
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Payment error occurred');
} finally {
setLoading(false);
}
};
return (
<ThemeProvider
defaultButtonVariant="directional-hover"
@@ -278,6 +325,30 @@ export default function LandingPage() {
/>
</div>
<div className="w-full py-20 md:py-28 flex items-center justify-center bg-background">
<div className="w-full max-w-md mx-auto px-6">
<div className="text-center mb-8">
<h2 className="text-3xl md:text-4xl font-semibold mb-4">Premium Experience</h2>
<p className="text-lg text-foreground/80 mb-6">Get exclusive access to premium recipes and advanced meal planning features.</p>
</div>
<div className="bg-card rounded-xl p-8 mb-6">
<div className="text-5xl font-bold text-primary-cta mb-2">$50</div>
<p className="text-foreground/70 mb-8">One-time payment for lifetime access</p>
<button
onClick={handlePayment}
disabled={loading}
className="w-full py-3 px-6 bg-primary-cta text-background font-semibold rounded-full hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity"
>
{loading ? 'Processing...' : 'Unlock Premium - $50'}
</button>
{error && (
<p className="text-red-500 text-sm mt-4 text-center">{error}</p>
)}
</div>
<p className="text-sm text-foreground/60 text-center">Secure payment powered by Stripe</p>
</div>
</div>
<div id="footer" data-section="footer">
<FooterBaseSocial
logoText="FlavourFlow"
@@ -363,4 +434,4 @@ export default function LandingPage() {
</div>
</ThemeProvider>
);
}
}