import React, { useState, useEffect, useCallback } from 'react'; import { Link } from 'react-router-dom'; import { ArrowRight, ChevronLeft, ChevronRight } from 'lucide-react'; import { useKeenSlider } from 'keen-slider/react'; import { motion, useScroll, useTransform } from 'framer-motion'; import ParticlesBackground from '../components/ParticlesBackground'; import Gallery from '../components/Gallery'; import TrustElements from '../components/TrustElements'; import StatisticsCounter from '../components/StatisticsCounter'; import BookingForm from '../components/BookingForm'; import VideoSection from '../components/VideoSection'; import InstagramFeed from '../components/InstagramFeed'; import PortfolioSlider from '../components/PortfolioSlider'; import TypeWriter from '../components/TypeWriter'; import UpcomingEventCard, { UpcomingEventProps as CardData } from '../components/UpcomingEventCard'; import { supabase } from '../lib/supabase'; import 'keen-slider/keen-slider.min.css'; import { toast } from 'react-hot-toast'; import { Helmet } from "react-helmet"; const sliderImages = [ { url: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20Pics/Wedding%20Services/jayesh-jalodara-bWQ6-0c_ZcM-unsplash.jpg?updatedAt=1743541372625', title: 'Elegant Weddings', subtitle: 'Creating Magical Moments', }, { url: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/WhatsApp%20Image%202025-04-01%20at%2013.45.56.jpeg?updatedAt=1743544568911', title: 'Premium Decor', subtitle: 'Memorable Events', }, { url: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/Screenshot%202025-04-02%20083804.png?updatedAt=1743563681035', title: 'Corporate Events', subtitle: 'Professional Excellence', }, { url: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/Screenshot%202025-04-02%20084232.png?updatedAt=1743563677502', title: 'Social Gatherings', subtitle: 'Get Together, Make Memories', }, ]; const services = [ { title: 'Wedding Services', description: 'Complete wedding planning and execution', items: ['Wedding', 'Reception','Engagement', 'Haldi', 'Mehendi', 'Sangeet / Mayra'], image: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/WhatsApp%20Image%202025-04-01%20at%2013.40.28.jpeg?updatedAt=1743544574186', icon: Wedding Rings, }, { title: 'Corporate Events', description: 'Professional corporate event management', items: ['Conference', 'Seminar', 'Inauguration', "Product Launch", 'Annual Function', 'Speech Function', 'Award Ceremony'], image: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/Screenshot%202025-04-02%20083701.png?updatedAt=1743563669866', icon: Corporate Event, }, { title: 'Social Gatherings', description: 'Making every occasion special', items: ['Anniversary', 'Birthday', 'Janeu', 'Grih Pravesh', 'Freshers Party', 'Farewell Party', 'Family Reunion'], image: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/WhatsApp%20Image%202025-03-19%20at%2014.09.13.jpeg?updatedAt=1743543342725', icon: Social Gathering, }, ]; const teamMembers = [ { name: 'Nandita Singh', position: 'Creative Head', image: 'https://ik.imagekit.io/PROIMG92/Team/tm-2-1.jpg?updatedAt=1743896911621', bio: `Education: M.B.A in Event Management from NAEMD Mumbai Experience: 6 Years of work experience with top event companies of Mumbai - DNA Network - Wizcraft - 70 EMG - Bookmyshow - KYC events - SFA 3 Years of Experience in Events As A Team Member: - Sula Vineyard Fest (Nasik) - Category Handler - Bryan Adams concert (Hyderabad) - Category Handler - MAMI (Mumbai Academy of Moving Image) - Category Handler - Khelo India (Indian Commonwealth Game) - Category Handler - Akash Ambani and Shloka Ambani Wedding - Category Handler - Wiz Khalifa concert (Mumbai) - Category Handler - IIFA - India Idol`, expertise: [ 'Wedding & Productions', 'Theme & Concept Designing', 'Artist Management', 'Large-scale Event Management' ] }, { name: 'Mohit Ranjan', position: 'Senior Project Head', image: 'https://ik.imagekit.io/PROIMG92/Team/mohit%20portrait.jpg?updatedAt=1743896911690', bio: `Experience: - 3 Years of expertise in event management - Specialized in Weddings and Engagements - Expert in Musical & Fashion Events coordination Key Projects: - Large-scale Wedding Events - Fashion Shows - Musical Concerts - Corporate Events`, expertise: [ 'Venue Management', 'Event Management', 'Vendors Management', 'Budget Planning' ] }, { name: 'Rahul Yadav', position: 'PR & Modelling Manager', image: 'https://ik.imagekit.io/PROIMG92/2.%20Content-cover/Content%20B/Team/tm-2-3.jpg?updatedAt=1743565635524', bio: `Education: Bachelor of Science in Information Technology (BSC IT) Experience: - 3 Years of experience at Amoeba Productions - Handled numerous PR campaigns and modelling events - Managed social media presence and digital marketing initiatives`, expertise: [ 'Social Media & Digital Marketing', 'Artist Management', 'Model Coordination', 'Public Relations', 'Event Planning' ] }, { name: 'Abhishek Kumar', position: 'Web UI/UX', image: 'https://ik.imagekit.io/PROIMG92/Team/tm-2-2.jpg?updatedAt=1743896911617', bio: `Education: Electronics & Automation Engineering from M.S. Ramaiah Institute of Technology, Bangalore. Experience: - Programmer Analyst at Cognizant - Business Development Manager at Aspirus Medical Services Pvt. Ltd.`, expertise: [ 'Web Designing', 'Client Relations', 'Event Productions', 'Budget Planning' ] }, { name: 'Abhinash Kumar', position: 'Manager', image: 'https://ik.imagekit.io/PROIMG92/T%20-%20Avi.jpg?updatedAt=1743674209833', bio: `Experience: - 3 Years with Amoeba Productions - Specialized in Operations Management - Expert in Vendor Relations and Event Documentation`, expertise: [ 'Checklist Management', 'Event Reporting', 'Vendor Coordinatotion' ] }, { name: 'Aman Prakash', position: 'Artist Manager', image: 'https://ik.imagekit.io/PROIMG92/Team/tm-2-5.jpg?updatedAt=1743896911541', bio: `Education: Computer Science from DSIT, Bangalore Experience: - Lead Choreographer at Flipkart Fashion Show, Bangalore - Choreographer at Myntra Fashion Show, Bangalore Key Projects: - Fashion Shows - Dance Events - Corporate Events Performances`, expertise: [ 'Dance Choreography', 'Fashion Choreography', 'Event Production', 'Performance Direction' ] } ]; // Define the state type including likeCount and images type EventState = CardData; const Home = () => { const [selectedMember, setSelectedMember] = useState(null); const [isBookingOpen, setIsBookingOpen] = useState(false); const { scrollY } = useScroll(); const y = useTransform(scrollY, [0, 500], [0, 150]); const [upcomingEvents, setUpcomingEvents] = useState([]); const [sectionVisible, setSectionVisible] = useState(true); const [loading, setLoading] = useState(true); const [sliderRef, instanceRef] = useKeenSlider({ loop: true, slides: sliderImages.length, initial: 0, slideChanged(slider) { // setCurrentSlide(slider.track.details.rel); }, }); // Auto-typing phrases const typingPhrases = [ "We bring your events to life.", "Expert planning saves you time and stress.", "Customized solutions for your unique vision.", "End-to-end coordination for seamless events.", "Creative excellence is our promise." ]; // Use useCallback for fetch function const loadUpcomingEvents = useCallback(async () => { try { setLoading(true); // Check section visibility const { data: sectionData, error: sectionError } = await supabase .from('upcoming_events_section') .select('is_visible') .eq('id', 1) .maybeSingle(); if (sectionError && sectionError.code !== 'PGRST116') { console.error('Error loading section visibility:', sectionError); // Decide how to handle this - maybe proceed assuming visible? } const isSectionVisible = !sectionData || sectionData.is_visible; setSectionVisible(isSectionVisible); if (!isSectionVisible) { setUpcomingEvents([]); // Clear events if section is hidden setLoading(false); return; } // Load visible events, including like_count const { data: eventData, error: eventError } = await supabase .from('upcoming_events') .select('*') // Select all columns, including like_count .eq('is_visible', true) .order('display_order', { ascending: true }); if (eventError) { console.error('Error loading upcoming events:', eventError); throw eventError; // Throw to be caught by outer catch } if (eventData && eventData.length > 0) { // Fetch images (consider optimizing this N+1 later) const eventsWithDetails = await Promise.all(eventData.map(async (event) => { const { data: imageData, error: imageError } = await supabase .from('upcoming_event_images') .select('image_url') .eq('event_id', event.id) .order('display_order', { ascending: true }); return { ...event, images: imageError ? [] : imageData?.map(img => img.image_url) || [], date_type: event.date_type, date: event.date, location: event.location, price: event.price, showCountdown: event.show_countdown, isClickable: event.is_clickable, eventPageUrl: event.event_page_url, likeCount: event.like_count || 0 }; })); setUpcomingEvents(eventsWithDetails as EventState[]); } else { setUpcomingEvents([]); } } catch (error) { console.error('Error in loadUpcomingEvents:', error); toast.error('Failed to load upcoming events.'); // Show toast on error } finally { setLoading(false); } }, []); // Empty dependency array if it doesn't depend on props/state outside useEffect(() => { loadUpcomingEvents(); }, [loadUpcomingEvents]); // Depend on the memoized function // Add the handleLike function const handleLike = useCallback(async (eventId: string) => { // 1. Optimistic UI update setUpcomingEvents(currentEvents => currentEvents.map(event => event.id === eventId ? { ...event, likeCount: (event.likeCount || 0) + 1 } : event ) ); // Add a slight delay before calling the function to let the UI update visually await new Promise(resolve => setTimeout(resolve, 100)); try { // 2. Call the Edge Function const { error } = await supabase.functions.invoke('increment-event-like', { body: { eventId }, }); if (error) { throw error; // Trigger the catch block } // Success: Maybe show a subtle success feedback if desired // toast.success('Liked!'); // Optional: uncomment for success message } catch (error) { console.error('Failed to increment like count:', error); toast.error('Failed to like event.'); // 3. Revert optimistic update on failure setUpcomingEvents(currentEvents => currentEvents.map(event => event.id === eventId ? { ...event, likeCount: Math.max(0, (event.likeCount || 1) - 1) } // Revert increment : event ) ); } }, []); // Empty dependency array as it only uses supabase client return (
AMOEBA PRODUCTIONS & STUDIO | Best Event Management Company in Patna {/* Hero Section */}
{/* Video Section */}
{sliderImages.map((slide, idx) => (
{slide.title} {slide.subtitle} setIsBookingOpen(true)} className="px-8 py-3 bg-primary text-white rounded-full hover:bg-primary-dark transition-colors duration-200" > Book Now
))}
{/* Upcoming Events */} {sectionVisible && (

Upcoming Events

{loading ? (

Loading events...

) : upcomingEvents.length === 0 ? (

No upcoming events at the moment.

Check back soon for exciting events!

) : (
{upcomingEvents.map((event) => ( ))}
)}
)} {/* Services */}

Our Services

{services.map((service, idx) => (
{service.title}
{service.icon}

{service.title}

{service.description}

    {service.items.map((item, itemIdx) => (
  • {item}
  • ))}
{/* Contextual links to Gallery and Contact */}
See our Gallery Contact Us
))}
{/* Auto Typing Section */}

Why Hire an Event Planner?

Time Saving Expert Network Budget Control Stress Relief
setIsBookingOpen(true)} className="px-8 py-3 bg-white text-primary font-medium rounded-full hover:bg-gray-100 transition-colors duration-200" whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }} > Book a Consultation
{/* Portfolio Section */} {/* Team Section */}

Meet Our Team

{teamMembers.map((member, idx) => (
{member.name}

{member.name}

{member.position}

))}
{/* Gallery Section */} {/* Trust Elements Section */} {/* Statistics Counter Section */} {/* Instagram Feed Section */} {/* Bio Modal */} {selectedMember !== null && (

{teamMembers[selectedMember].name}

{teamMembers[selectedMember].position}

{teamMembers[selectedMember].bio}

Areas of Expertise:

    {teamMembers[selectedMember].expertise.map((skill, idx) => (
  • {skill}
  • ))}
)} setIsBookingOpen(false)} />
); }; export default Home;