import Navbar from "@/components/Partials/Navbar";
import HeroSection from "@/components/Partials/Hero";
import Tentang from "@/components/Partials/Tentang";
import Pengumuman from "@/components/Partials/Pengumuman";
import Peraturan from "@/components/Partials/Peraturan";
import Undangan from "@/components/Partials/Undangan";
import Footer from "@/components/Partials/Footer";
import { Head, usePage } from "@inertiajs/react";
import Guest from "@/layouts/guest-layout";
import PopupModal from "@/components/Partials/PopupModal";
import { useState } from "react";

export default function Home() {
    const { posts } = usePage().props as any;
    const { undangan } = usePage().props as any;
    const { peraturan } = usePage().props as any;
    const [showPopup, setShowPopup] = useState(true);

    const handleClosePopup = () => {
        setShowPopup(false);
    };

    return (
        <>
            {showPopup && <PopupModal onClose={handleClosePopup} />}
            <Guest>
                <Head title="Home" />
                <Navbar />
                <HeroSection />
                <Tentang />
                <Pengumuman posts={posts || []} />
                <Peraturan peraturan={peraturan || []} />
                <Undangan undangan={undangan || []} />
                <Footer />
            </Guest>
        </>
    );
}
