feat: Add event collection and event page structure
All checks were successful
SteamWarCI Build successful
All checks were successful
SteamWarCI Build successful
- Introduced a new events collection in config.ts with schema validation. - Created a new event markdown file for the WarGear event. - Updated German translations to include new event-related strings. - Modified PageLayout to support a wide layout option. - Enhanced announcements page to improve tag filtering and post rendering. - Implemented dynamic event pages with detailed event information and fight plans. - Added an index page for events to list all upcoming events.
This commit is contained in:
36
src/pages/events/index.astro
Normal file
36
src/pages/events/index.astro
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
import type { ExtendedEvent } from "@components/types/event";
|
||||
import PageLayout from "@layouts/PageLayout.astro";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
const events = await Promise.all(
|
||||
(await getCollection("events")).map(async (event) => ({
|
||||
...event,
|
||||
data: {
|
||||
...event.data,
|
||||
event: (await fetch(import.meta.env.PUBLIC_API_SERVER + "/events/" + event.data.eventId).then((value) => value.json())) as ExtendedEvent,
|
||||
},
|
||||
}))
|
||||
);
|
||||
---
|
||||
|
||||
<PageLayout title="Events">
|
||||
{
|
||||
events.map((event) => (
|
||||
<article class="mb-8">
|
||||
<h2 class="text-2xl font-bold mb-2">
|
||||
<a href={`/events/${event.slug}/`} class="text-blue-600 hover:underline">
|
||||
{event.data.event.event.name ?? "Hello, World!"}
|
||||
</a>
|
||||
</h2>
|
||||
<p class="text-gray-600 mb-1">
|
||||
{new Date(event.data.event.event.start).toLocaleDateString(undefined, {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})}
|
||||
</p>
|
||||
</article>
|
||||
))
|
||||
}
|
||||
</PageLayout>
|
||||
Reference in New Issue
Block a user