--- // 行事予定の一覧表。データは src/data/schedule/*.json から読む。 // セルの中身は HTML(リンクを含む)としてそのまま出力する。 import meetings from '@/data/schedule/meetings.json'; import events from '@/data/schedule/events.json'; import { entryDates } from '@/lib/schedule-dates'; type Row = { date: string; title: string; place: string; note: string; source: string }; type TableData = { columns: string[]; rows: Row[] }; const { variant, rows, scope = 'all', } = Astro.props as { variant: 'meeting' | 'event'; rows?: Row[]; scope?: 'all' | 'current' }; const base: TableData = (variant === 'meeting' ? meetings : events) as TableData; // rows を渡された場合はその行だけを表示する(月別・年度別アーカイブ用) let list = rows ?? base.rows; // scope="current" のときは、今月以降に開催される予定だけを表示する。 // 終了した予定は月別アーカイブに移し、メインページが年々肥大化しないようにする。 if (scope === 'current') { const now = new Date(); const monthStart = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-01`; list = list.filter((row) => entryDates(variant, row.date, row.place).some((date) => date >= monthStart), ); } const data: TableData = { columns: base.columns, rows: list }; ---
| {column} | )}||||
|---|---|---|---|---|