34 lines
962 B
TypeScript
34 lines
962 B
TypeScript
import NavigationWrapper from "@/components/NavigationWrapper";
|
|
import HeroSection from "@/components/HeroSection";
|
|
import EventsSection from "@/components/EventsSection";
|
|
import { prisma } from "@/lib/prisma";
|
|
import { getBackgroundImage } from "@/lib/preferences";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function Home() {
|
|
const events = await prisma.event.findMany({
|
|
orderBy: {
|
|
date: "asc",
|
|
},
|
|
take: 3,
|
|
});
|
|
|
|
// Convert Date objects to strings for serialization
|
|
const serializedEvents = events.map((event) => ({
|
|
...event,
|
|
date: event.date.toISOString(),
|
|
}));
|
|
|
|
// Récupérer l'image de fond côté serveur
|
|
const backgroundImage = await getBackgroundImage("home", "/got-2.jpg");
|
|
|
|
return (
|
|
<main className="min-h-screen bg-black relative">
|
|
<NavigationWrapper />
|
|
<HeroSection backgroundImage={backgroundImage} />
|
|
<EventsSection events={serializedEvents} />
|
|
</main>
|
|
);
|
|
}
|