add pigs to event categories, fallback to those

This commit is contained in:
2024-06-06 02:47:00 +02:00
parent 0d58eeb040
commit ffacc0a8a8
7 changed files with 105 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ import { EventHeader } from "@/components/events/EventHeader";
import { BgPig } from "@/components/general/BgPig";
import { graphql } from "@/gql";
import { EventFragment } from "@/gql/graphql";
import { getEventPig } from "@/lib/event";
import { notFound } from "next/navigation";
export async function generateStaticParams() {
@@ -48,6 +49,7 @@ export default async function Page({ params }: { params: { slug: string } }) {
}
const event = (data?.event ?? {}) as EventFragment;
const eventPig = getEventPig(event);
return (
<>
@@ -60,7 +62,7 @@ export default async function Page({ params }: { params: { slug: string } }) {
<Blocks blocks={event.body} />
</section>
</main>
{event.pig && <BgPig type={event.pig} color="white" />}
{eventPig && <BgPig type={eventPig} color="white" />}
</>
);
}