// === imports === import Button from '@/components/aia/button'; import EventCard from '@/components/aia/event-card'; import { Carousel } from '@/components/aia/carousel'; import { useState, useEffect, useRef } from 'react'; import { carousel } from '@vendor-web/js/patterns/carousel.js'; type Post = { id: number; title: string; slug: string; excerpt: string; content: string; image_url: string; post_type: string; status: string; published_at: string; date: string; time?: string; address?: string; description?: string; link?: string; categories: Array<{ id: number; name: string; slug: string; }>; }; type SectionLandingProps = { landingEvents: Post[]; }; export default function SectionLanding( { landingEvents }: SectionLandingProps ) { const eventCards = landingEvents.map((post: Post) => { const detailRoute = post.post_type === 'event' ? 'event.show' : 'news.show'; return { eventCardTitle: post.title, eventCardType: post.post_type, eventCardDate: post.date, eventCardLocation: post.address || '', eventCardImage: post.image_url, eventCardLink: route(detailRoute, { post: post.slug }), eventCardLinkText: "for more information", }; }); useEffect(() => { console.log('%%%%%%%', landingEvents); }, []); // 空依賴陣列 -> 僅在初次掛載執行一次 // useEffect(() => { // (async () => { // setEvents(await getNewsData()); // console.log('$$$$$$$', events); // })(); // }, []); // 空依賴陣列 -> 僅在初次掛載執行一次 return (
{/* Landing Background */}

AI for All,
All in AI

Fostering a thriving AI ecosystem in Taiwan

{eventCards.map((card: any, index: number) => ( ))}
); }