import NavigationWrapper from "@/components/NavigationWrapper";
import EventsPageSection from "@/components/EventsPageSection";
import { prisma } from "@/lib/prisma";
import { getBackgroundImage } from "@/lib/preferences";

export default async function EventsPage() {
  const events = await prisma.event.findMany({
    orderBy: {
      date: "asc",
    },
  });

  const backgroundImage = await getBackgroundImage("events", "/got-2.jpg");

  return (
    <main className="min-h-screen bg-black relative">
      <NavigationWrapper />
      <EventsPageSection events={events} backgroundImage={backgroundImage} />
    </main>
  );
}
