import { gridForWeek, defaultWeekStart } from "@/db/grid"; import { WeekNav } from "@/components/app/week-nav"; import { ScheduleGrid } from "@/components/app/schedule-grid"; export const metadata = { title: "Schedule" }; /** * Scheduling grid (unit D7). Read-only: rows = instances, cols = positions, * with week navigation via `?week=YYYY-MM-DD` (a Sunday). Defaults to the week * of the earliest upcoming published instance so a seeded DB shows data at once. */ export default async function SchedulePage({ searchParams, }: { searchParams: Promise<{ week?: string }>; }) { const { week: paramWeek } = await searchParams; // Validate the param is a YYYY-MM-DD string; fall back to the default week. const weekStart = typeof paramWeek === "string" && /^\d{4}-\d{2}-\d{2}$/.test(paramWeek) ? paramWeek : await defaultWeekStart(); const week = await gridForWeek(weekStart); return (

Schedule

Service instances for the week and who is on each position.

); }