feat: implement event listing and styling for public events

Added a new EventListPage component to display published events in a grid layout, enhancing the user interface for event visibility. Updated styles in app.css for public events, including hover effects and improved layout. Modified the main application logic to handle multiple published events and adjusted tests to verify the new functionality and display behavior.
This commit is contained in:
blake committed 2026-11-02 11:36:22 -06:00
1 parent e7fc1e03ae
commit 019f61bc4a
6 files changed
+221 -11

No files matched your search

+13
View File
@@ -90,6 +90,19 @@ const SHIFT_FROM = `
LEFT JOIN signups su ON su.shift_id = s.id
`;
/** Published events in title order. Each entry uses the same upcoming-shift window as its own page. */
export function listPublishedEvents(db: Database.Database, now: string): PublicEvent[] {
const rows = db
.prepare(`SELECT slug AS slug FROM events WHERE published = 1 ORDER BY title COLLATE NOCASE, id`)
.all() as { slug: string }[];
const events: PublicEvent[] = [];
for (const row of rows) {
const event = getPublishedEvent(db, row.slug, now);
if (event) events.push(event);
}
return events;
}
export function getPublishedEvent(db: Database.Database, slug: string, now: string): PublicEvent | null {
const event = db
.prepare(