Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2376eb5281 | |||
| a1a648b518 | |||
| c94b4a1c21 | |||
| 0e6eef1ea7 | |||
| 7255f17957 | |||
| f0917a5baa | |||
| 73600ac83b | |||
| eab1faa6f3 | |||
| bec4b93fdd | |||
| 7c4ccb073a |
@@ -16,10 +16,30 @@ export default function LandingPage() {
|
||||
const [isReserving, setIsReserving] = useState(false);
|
||||
const [email, setEmail] = useState("");
|
||||
const [mobile, setMobile] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
const [guests, setGuests] = useState("2");
|
||||
|
||||
const handleReserve = () => {
|
||||
const message = encodeURIComponent(`Hello, I would like to book a table. Email: ${email}, Mobile: ${mobile}`);
|
||||
window.open(`https://wa.me/91XXXXXXXXXX?text=${message}`, '_blank');
|
||||
const handleReserve = async () => {
|
||||
const message = encodeURIComponent(`Hello, I would like to book a table at Shaffa. \nName: ${name}\nEmail: ${email}\nMobile: ${mobile}\nGuests: ${guests}`);
|
||||
|
||||
// Send email via API request
|
||||
try {
|
||||
const response = await fetch('/api/send-booking', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ name, email, mobile, guests, to: 'isittrueorjust@gmail.com' }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("Server error during booking submission");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to send email", e);
|
||||
}
|
||||
|
||||
window.open(`https://wa.me/919876543210?text=${message}`, '_blank');
|
||||
setIsReserving(false);
|
||||
};
|
||||
|
||||
@@ -46,7 +66,7 @@ export default function LandingPage() {
|
||||
{ name: "Contact", id: "contact" },
|
||||
]}
|
||||
button={{
|
||||
text: "Reserve", onClick: () => setIsReserving(true)
|
||||
text: "Book a table", onClick: () => setIsReserving(true)
|
||||
}}
|
||||
brandName="Shaffa"
|
||||
/>
|
||||
@@ -58,7 +78,7 @@ export default function LandingPage() {
|
||||
description="Authentic flavors of North India, crafted for families and couples in the heart of Sec 26B, Chandigarh."
|
||||
buttons={[
|
||||
{
|
||||
text: "Reserve on WhatsApp", onClick: () => setIsReserving(true),
|
||||
text: "Book a table", onClick: () => setIsReserving(true),
|
||||
},
|
||||
]}
|
||||
imageSrc="http://img.b2bpic.net/free-photo/vegetable-salad-with-herbs-cheese_140725-44342.jpg?_wi=1"
|
||||
@@ -69,7 +89,13 @@ export default function LandingPage() {
|
||||
{isReserving && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4">
|
||||
<div className="bg-white p-8 rounded-lg shadow-xl w-full max-w-sm">
|
||||
<h2 className="text-xl font-bold mb-4 text-black">Reserve a Table</h2>
|
||||
<h2 className="text-xl font-bold mb-4 text-black">Book a Table</h2>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Full Name"
|
||||
className="w-full p-2 mb-4 border rounded text-black"
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
<input
|
||||
type="email"
|
||||
placeholder="Email Address"
|
||||
@@ -82,9 +108,12 @@ export default function LandingPage() {
|
||||
className="w-full p-2 mb-4 border rounded text-black"
|
||||
onChange={(e) => setMobile(e.target.value)}
|
||||
/>
|
||||
<select className="w-full p-2 mb-4 border rounded text-black" onChange={(e) => setGuests(e.target.value)} value={guests}>
|
||||
{[1,2,3,4,5,6].map(i => <option key={i} value={i}>{i} Guests</option>)}
|
||||
</select>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => setIsReserving(false)} className="flex-1 p-2 bg-gray-200 rounded">Cancel</button>
|
||||
<button onClick={handleReserve} className="flex-1 p-2 bg-blue-600 text-white rounded">Complete Booking</button>
|
||||
<button onClick={() => setIsReserving(false)} className="flex-1 p-2 bg-gray-200 rounded text-black">Cancel</button>
|
||||
<button onClick={handleReserve} className="flex-1 p-2 bg-blue-600 text-white rounded">Confirm Reservation</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,6 +125,9 @@ export default function LandingPage() {
|
||||
textboxLayout="default"
|
||||
gridVariant="three-columns-all-equal-width"
|
||||
useInvertedBackground={false}
|
||||
buttons={[
|
||||
{ text: "Book a Table", onClick: () => setIsReserving(true) }
|
||||
]}
|
||||
products={[
|
||||
{ id: "m1", name: "Butter Chicken", price: "₹450", variant: "Popular", imageSrc: "http://img.b2bpic.net/free-photo/top-close-view-delicious-bright-cake-with-cream-cracker-cookies-dark-wall-cake-biscuit-pie-sugar-sweet-photo-cookie_140725-53987.jpg?_wi=1" },
|
||||
{ id: "m2", name: "Tandoori Platter", price: "₹650", variant: "Premium", imageSrc: "http://img.b2bpic.net/free-photo/top-view-assortment-different-pakistan-goodies_23-2148821568.jpg?_wi=1" },
|
||||
@@ -163,7 +195,7 @@ export default function LandingPage() {
|
||||
title="Shaffa - Sec 26B, Chandigarh"
|
||||
description="Visit us for an unforgettable North Indian dining experience. Use WhatsApp to reserve your table today."
|
||||
imageSrc="http://img.b2bpic.net/free-photo/miami-bayside-landscape_23-2151636382.jpg"
|
||||
buttonText="Reserve Now"
|
||||
buttonText="Book a Table"
|
||||
onSubmit={() => setIsReserving(true)}
|
||||
/>
|
||||
</div>
|
||||
@@ -175,7 +207,7 @@ export default function LandingPage() {
|
||||
columns={[
|
||||
{ title: "Shaffa", items: [{ label: "About", href: "#about" }, { label: "Menu", href: "#menu" }] },
|
||||
{ title: "Reservation", items: [{ label: "WhatsApp Booking", onClick: () => setIsReserving(true), href: "#" }, { label: "Directions", href: "https://maps.google.com" }] },
|
||||
{ title: "Contact", items: [{ label: "Sec 26B, Chandigarh", href: "#" }, { label: "+91-XXXXXXXXXX", href: "tel:+91XXXXXXXXXX" }] },
|
||||
{ title: "Contact", items: [{ label: "Sec 26B, Chandigarh", href: "#" }, { label: "+91-9876543210", href: "tel:+919876543210" }] },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user