D7: read-only schedule grid UI (rows=instances, cols=positions, week nav)

Server-component schedule page backed by a pure data layer (src/db/grid.ts):
gridForWeek() returns positions + instances (->slots->assignments), and
defaultWeekStart() defaults to the earliest upcoming published instance so a
seeded DB shows data on first load. Week nav via ?week=YYYY-MM-DD (server
rendered, no client state).

Fixes two latent bugs that kept the grid empty/incorrect:
- tz: weekdayInTz()/nextSundaysInTz() built Date.UTC(y,mo-1,d) from a LOCAL
  date string and read its weekday; for America/New_York (UTC-5) UTC midnight
  lands the previous evening, so the seed materialized instances on Mondays and
  the default week was off by one. weekdayInTz now builds the local-midnight
  instant via utcOffsetMs; nextSundaysInTz uses weekdayInTz + addDaysISO.
- grid: occursOn (date mode) was run through dateInTimezone(), reinterpreting
  the UTC instant as wall-clock and shifting a day early; now extracts the UTC
  calendar date directly (occursOnISO).
- schedule-grid: <table className=... collapse ...> set visibility: collapse
  (Tailwind 'collapse'), hiding the whole grid server-rendered-but-invisible;
  changed to border-collapse.

E2E: new schedule-grid.spec.ts + shell.spec.ts grid assertion. Full suite green:
tsc, eslint, 178 unit tests, next build, 6/6 Playwright.
This commit is contained in:
Tiel Coder
2026-11-18 16:19:17 +00:00
parent 13aafc231f
commit 6982a8040d
8 changed files with 567 additions and 21 deletions
+4 -2
View File
@@ -40,8 +40,10 @@ test.describe("app shell", () => {
"page",
);
// Empty state renders inside the shell.
await expect(page.getByText("Nothing scheduled yet")).toBeVisible();
// The schedule grid renders (unit D7): role columns and an instance row.
await expect(page.getByText("Audio")).toBeVisible();
await expect(page.getByText("Livestream")).toBeVisible();
await expect(page.getByText("Slides")).toBeVisible();
});
test("shows the desktop rail inside the shell at desktop width", async ({ page }) => {