feat: agenda renderer with day-by-day breakdown and live-now detection

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-02 18:38:29 -05:00
parent 57c9d56d06
commit 7b484e5664
2 changed files with 235 additions and 0 deletions

58
src/render/agenda.test.ts Normal file
View File

@@ -0,0 +1,58 @@
import { describe, it, expect } from "vitest";
import { renderAgenda } from "./agenda";
import type { Show, Preferences } from "../types";
const babShow: Show = {
slug: "bowl-after-bowl",
name: "Bowl After Bowl",
shortDescription: "The flagship Small Group talk show.",
websiteUrl: "https://bowlafterbowl.com",
feedUrl: "",
accentColor: "#f2b705",
hosts: ["Spencer", "DuhLaurien"],
isSmallGroup: true,
isVcr: true,
isActive: true,
schedule: { day: "tuesday", startTime: "22:00", endTime: "01:00+1", timezone: "America/New_York", recurrence: "weekly" },
};
const vcrPrefs: Preferences = { tz: "eastern", theme: "system", mode: "vcr", week: "2026-W45", setCookies: [] };
describe("renderAgenda", () => {
it("returns HTML with agenda class", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("agenda");
});
it("groups shows under day headings", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("Tuesday");
});
it("renders show entries as links", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain('href="/show/bowl-after-bowl');
});
it("includes time display", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toMatch(/10:00\s*PM/i);
});
it("omits days with no shows", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).not.toContain("Wednesday");
expect(html).not.toContain("Thursday");
});
it("applies accent color as border style", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("#f2b705");
});
it("lists overnight shows under their start day", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("Tuesday");
expect(html).not.toMatch(/Wednesday.*Bowl After Bowl/s);
});
});