"use client"; /** * SHAHI KITCHEN HOMEPAGE * Version with advanced Signature Menu + elegant hero (pre full Sultan redesign) */ import React, { useEffect, useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import Lenis from "lenis"; import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; import { Crown, Clock, ArrowRight, UtensilsCrossed } from "lucide-react"; import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; import { useCart } from "@/components/CartContext"; import { useLanguage } from "@/lib/language-context"; import { getTranslation } from "@/lib/translations"; gsap.registerPlugin(ScrollTrigger); export default function ShahiKitchenHomepage() { const { addToCart } = useCart(); const { language } = useLanguage(); const t = getTranslation(language); const [menuFilter, setMenuFilter] = useState<"All" | "Rice" | "Curry" | "Meat" | "Street" | "Roll" | "Sweet">("All"); const [isMobile, setIsMobile] = useState(false); // Mobile video helpers for Signature Menu (duplicated logic, 3s pause) const playMobileVideoSignature = (id: string) => { document.querySelectorAll(".signature-card").forEach((card) => { if (card.dataset.id !== id) return; const media = card.querySelector(".relative.h-48"); if (!media) return; const img = media.querySelector("img"); const video = media.querySelector("video"); const gradient = media.querySelector(".absolute.inset-0.bg-gradient-to-b"); if (img) img.style.opacity = "0"; if (video) { video.style.opacity = "1"; video.play().catch(() => {}); } if (gradient) gradient.style.opacity = "0"; }); }; const pauseAllMobileVideosSignature = () => { document.querySelectorAll(".signature-card").forEach((card) => { const media = card.querySelector(".relative.h-48"); if (!media) return; const img = media.querySelector("img"); const video = media.querySelector("video"); const gradient = media.querySelector(".absolute.inset-0.bg-gradient-to-b"); if (img) img.style.opacity = ""; if (video) { video.style.opacity = "0"; video.pause(); video.currentTime = 0; } if (gradient) gradient.style.opacity = ""; }); }; const findFocusedVideoItemSignature = (): string | null => { const cards = document.querySelectorAll('.signature-card[data-has-video="true"]'); let bestId: string | null = null; let bestScore = 0; const vh = window.innerHeight; const viewportCenter = vh / 2; cards.forEach((card) => { const rect = card.getBoundingClientRect(); if (rect.bottom <= 0 || rect.top >= vh) return; const visibleTop = Math.max(rect.top, 0); const visibleBottom = Math.min(rect.bottom, vh); const visibleHeight = visibleBottom - visibleTop; const intersectionRatio = visibleHeight / rect.height; const cardCenter = rect.top + rect.height / 2; const distFromCenter = Math.abs(cardCenter - viewportCenter); const centerScore = Math.max(0, 1 - distFromCenter / (vh / 2)); const score = intersectionRatio * 0.6 + centerScore * 0.4; if (score > bestScore && score > 0.15) { bestScore = score; bestId = card.dataset.id || null; } }); return bestId; }; // Lenis smooth scroll useEffect(() => { const lenis = new Lenis({ duration: 1.1, easing: (t: number) => Math.min(1, 1.001 * (-Math.pow(2, -10 * t) + 1)), smoothWheel: true, }); const raf = (time: number) => { lenis.raf(time); requestAnimationFrame(raf); }; requestAnimationFrame(raf); return () => lenis.destroy(); }, []); // Mobile detection for signature menu video logic useEffect(() => { const updateMobile = () => setIsMobile(window.innerWidth < 768); updateMobile(); window.addEventListener("resize", updateMobile); return () => window.removeEventListener("resize", updateMobile); }, []); useEffect(() => { if (!isMobile) { pauseAllMobileVideosSignature(); return; } let scrollTimeout: ReturnType | null = null; const onScrollOrTouch = () => { pauseAllMobileVideosSignature(); if (scrollTimeout) clearTimeout(scrollTimeout); scrollTimeout = setTimeout(() => { const focusedId = findFocusedVideoItemSignature(); if (focusedId) { playMobileVideoSignature(focusedId); } }, 3000); }; window.addEventListener("scroll", onScrollOrTouch, { passive: true }); window.addEventListener("touchmove", onScrollOrTouch, { passive: true }); // Initial play after load on mobile (if not scrolling) const initialTimeout = setTimeout(() => { const firstFocused = findFocusedVideoItemSignature(); if (firstFocused) { playMobileVideoSignature(firstFocused); } }, 1500); return () => { window.removeEventListener("scroll", onScrollOrTouch); window.removeEventListener("touchmove", onScrollOrTouch); if (scrollTimeout) clearTimeout(scrollTimeout); clearTimeout(initialTimeout); }; }, [isMobile]); const signatureDishes = [ { id: "chicken-biryani", name: "Chicken Biryani", category: "Rice", price: 149, time: "32 min", desc: "Fragrant aged basmati layered with spiced chicken, saffron & caramelized onions", image: "chicken-biryani-poster.jpg", video: "chicken-biryani.mp4" }, { id: "bong-nihari", name: "Bong Nihari", category: "Curry", price: 199, time: "45 min", desc: "Slow-cooked beef shank in rich aromatic gravy with ginger, lemon & fresh naan", image: "bong-nihari-poster.jpg", video: "bong-nihari.mp4" }, { id: "panipuri", name: "Golgappy / Panipuri", category: "Street", price: 69, time: "15 min", desc: "Crispy hollow puris filled with spiced chickpeas, potatoes & tangy tamarind water", image: "panipuri-poster.jpg", video: "panipuri.mp4" }, { id: "lamm-palak", name: "Lamm Palak", category: "Meat", price: 179, time: "30 min", desc: "Tender lamb cooked with fresh spinach in a flavorful mild gravy", image: "lamm-palak-poster.jpg", video: "lamm-palak.mp4" }, { id: "chicken-karahi", name: "Chicken Karahi", category: "Curry", price: 149, time: "28 min", desc: "Wok-tossed chicken in a robust tomato, chili & ginger gravy", image: "chicken-karahi-poster.jpg", video: "chicken-karahi.mp4" }, { id: "chicken-haleem", name: "Chicken Haleem", category: "Curry", price: 149, time: "35 min", desc: "Slow-cooked shredded chicken with lentils, wheat & aromatic spices", image: "chicken-haleem-poster.jpg", video: "chicken-haleem.mp4" }, { id: "tikka-boti-roll", name: "Tikka Boti Roll", category: "Roll", price: 99, time: "20 min", desc: "Juicy chicken tikka wrapped in soft naan with mint chutney & onions", image: "tikka-boti-roll-poster.jpg", video: "tikka-boti-roll.mp4" }, { id: "jalebi", name: "Jalebi", category: "Sweet", price: 119, time: "12 min", desc: "Crispy golden saffron spirals soaked in fragrant sugar syrup", image: "jalebi-poster.jpg", video: "jalebi.mp4" }, { id: "kulfi", name: "Kulfi", category: "Sweet", price: 39, time: "10 min", desc: "Traditional frozen milk dessert with cardamom, pistachio & saffron", image: "kulfi-poster.jpg", video: "kulfi.mp4" }, ]; const filtered = menuFilter === "All" ? signatureDishes : signatureDishes.filter(d => d.category === menuFilter); const addDish = (d: any) => { addToCart({ id: d.id, name: d.name, price: d.price, image: d.image }); }; // Advanced GSAP effects for signature cards useEffect(() => { const cards = document.querySelectorAll(".signature-card"); gsap.fromTo(cards, { opacity: 0, y: 45 }, { opacity: 1, y: 0, duration: 0.9, ease: "power3.out", stagger: 0.06, scrollTrigger: { trigger: ".signature-menu-grid", start: "top 82%", once: true } } ); cards.forEach((card) => { const image = card.querySelector(".signature-image") as HTMLElement | null; let bounds: DOMRect; const onMouseMove = (e: MouseEvent) => { if (!bounds) bounds = card.getBoundingClientRect(); const x = ((e.clientX - bounds.left) / bounds.width - 0.5) * 2; const y = ((e.clientY - bounds.top) / bounds.height - 0.5) * 2; gsap.to(card, { rotationY: x * 11, rotationX: -y * 8, transformPerspective: 1400, duration: 0.35, ease: "power2.out" }); if (image) gsap.to(image, { x: x * 8, y: y * 6, duration: 0.45, ease: "power2.out" }); }; const onMouseLeave = () => { gsap.to(card, { rotationY: 0, rotationX: 0, duration: 1.1, ease: "elastic.out(1, 0.45)" }); if (image) gsap.to(image, { x: 0, y: 0, scale: 1, duration: 0.9, ease: "power2.out" }); }; const onMouseEnter = () => { if (image) gsap.to(image, { scale: 1.12, duration: 1.1, ease: "power2.out" }); }; card.addEventListener("mousemove", onMouseMove); card.addEventListener("mouseleave", onMouseLeave); card.addEventListener("mouseenter", onMouseEnter); (card as any)._cleanup = () => { card.removeEventListener("mousemove", onMouseMove); card.removeEventListener("mouseleave", onMouseLeave); card.removeEventListener("mouseenter", onMouseEnter); }; }); return () => { cards.forEach(card => (card as any)._cleanup?.()); }; }, [filtered]); return (
{/* HERO - Full Banner Video with responsive framing */}
{/* Banner Video - Responsive sources for proper mobile/iPad visualization (portrait asset) + desktop (landscape). Mobile/iPad (<=1024px) uses the compressed banner_mobile-optimized versions (WebM primary for size/speed, MP4 fallback). These were generated from the provided banner_mobile.mp4 (original kept as source asset). */} {/* Subtle gradient to improve visibility of baked-in text */}
{/* ADVANCED SIGNATURE MENU */} {/* THE SHAHI EXPERIENCE */}
{language === 'sv' ? 'SHAHI-SÄTTET' : 'THE SHAHI WAY'}

{language === 'sv' ? 'Mer än en måltid.\nEtt ögonblick av Shahi.' : 'More than a meal.\nA moment of Shahi.'}

{(language === 'sv' ? [ { title: "Den Legendariska Buffén", desc: "Vår berömda lunchbuffé har över 20 roterande rätter — curry, biryani, färsk naan och sötsaker." }, { title: "Shahi Sötsaker", desc: "Hemgjord mithai dagligen. Från färsk jalebi till rasmalai — det perfekta söta avslutet." }, { title: "Varm Gästfrihet", desc: "Oavsett om du är här för en snabb lunch eller familjefest, behandlas du alltid som shahi." }, ] : [ { title: "The Legendary Buffet", desc: "Our famous lunch buffet features over 20 rotating dishes — curries, biryanis, fresh naan, and sweets." }, { title: "Shahi Sweets", desc: "Homemade mithai made daily. From fresh Jalebi to Rasmalai — the perfect sweet ending." }, { title: "Warm Hospitality", desc: "Whether you're here for a quick lunch or a family celebration, you will always be treated like Shahi." }, ]).map((item, index) => (
0{index + 1}

{item.title}

{item.desc}

))}
); }