// Import ========================================================================================================================
import App from '@/layouts/aia/app-layout';
import SectionLanding from '@/components/aia/section-landing';
import Impact from '@/components/aia/our-impact';
import Discover from '@/components/aia/discover';
import Latest from '@/components/aia/latest';
import AiaPartner from '@/components/aia/aia-partner';
import ContactUsForm from '@/components/aia/contact-us-form';
import { index } from '@/js/index.js';
import { wheelController } from '@/js/extends';
import React from 'react';
import { Head } from '@inertiajs/react';


type HomeProps = {
    landingEvents: Array<{
        eventCardTitle: string;
        eventCardType: string;
        eventCardDate: string;
        eventCardLocation: string;
        eventCardImage: string;
        eventCardLink: string;
        eventCardLinkText: string;
    }>;
    lastests: Array<{
        eventCardTitle: string;
        eventCardType: string;
        eventCardDate: string;
        eventCardLocation: string;
        eventCardImage: string;
        eventCardLink: string;
        eventCardLinkText: string;
    }>;
};

export default function Home(
    { landingEvents, lastests }: HomeProps
) {
    // console.log('@@@@@@@@@', landingEvents);
    React.useEffect(() => {
        index();
        wheelController();

        // 使用 setTimeout 延遲執行,確保所有 carousel 初始化完成
        const timer = setTimeout(() => {
            window.scrollTo({
                top: 0,
                behavior: 'auto'
            });
        }, 300); // 延遲 300ms,配合 carousel.js 的 200ms timeout
    }, []);
    return (

        <App
            section={null}
        >
            <Head title="Home" />
            <SectionLanding
                landingEvents={landingEvents}
            />
            <div className="pageStickyContainer">
                <Impact />
            </div>
            <Discover />
            <Latest
                landingEvents={lastests}
            />
            <div className="pageBottomSection">
                <div className="pageStickyContainer">
                    <AiaPartner />
                </div>
                <ContactUsForm />
            </div>

        </App>

    );
}
