diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 14 | ||||
| -rw-r--r-- | src/components/ScheduleMonthLinks.astro | 16 | ||||
| -rw-r--r-- | src/components/ScheduleTable.astro | 6 |
3 files changed, 22 insertions, 14 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index 3dd6048..424b453 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -1,7 +1,7 @@ <script> // URLは src/data/schedule/config.ts で一元管理している(ページ移転時はそこだけ変える) import { scheduleAbsoluteUrl } from '@/data/schedule/config'; - import { parseDates, applyExclusions, toKey, keyToDate } from '@/lib/schedule-dates'; + import { parseDates, applyExclusions, toKey, keyToDate, entryDates } from '@/lib/schedule-dates'; const CATEGORY_DEFS = [ { icon: '👶', label: '子育て' }, @@ -63,17 +63,7 @@ } row.dataset.category = category; - const dates = new Set(parseDates(dateText)); - // 審議会の「毎月1回(11月12日、…も開催)」のように、 - // 時間・会場欄に追加の開催日が書かれている場合がある。 - if (type === 'meeting') { - for (const key of parseDates(timeText)) dates.add(key); - } - // イベントの「(11月4日を除く)」を反映する。 - if (type === 'event') { - // 時間欄の「(11月4日を除く)」を日付セル側の集合に反映する。 - applyExclusions(dates, timeText); - } + const dates = new Set(entryDates(type, dateText, timeText)); entries.push({ type, diff --git a/src/components/ScheduleMonthLinks.astro b/src/components/ScheduleMonthLinks.astro new file mode 100644 index 0000000..8628998 --- /dev/null +++ b/src/components/ScheduleMonthLinks.astro @@ -0,0 +1,16 @@ +--- +// 月別アーカイブのリンク一覧。行事予定ページの下部に置く。 +import { monthCounts, monthKeys, monthLabel } from '@/lib/schedule-months'; +import { scheduleUrl } from '@/data/schedule/config'; +--- + +<ul class="schedule-month-archive"> + { + monthKeys.map((key) => ( + <li> + <a href={scheduleUrl(`${key}/`)}>{monthLabel(key)}の予定</a> + <span class="schedule-month-count">{monthCounts[key]}件</span> + </li> + )) + } +</ul> diff --git a/src/components/ScheduleTable.astro b/src/components/ScheduleTable.astro index 2f4b370..ff13827 100644 --- a/src/components/ScheduleTable.astro +++ b/src/components/ScheduleTable.astro @@ -7,8 +7,10 @@ import events from '@/data/schedule/events.json'; type Row = { date: string; title: string; place: string; note: string; source: string }; type TableData = { columns: string[]; rows: Row[] }; -const { variant } = Astro.props as { variant: 'meeting' | 'event' }; -const data: TableData = (variant === 'meeting' ? meetings : events) as TableData; +const { variant, rows } = Astro.props as { variant: 'meeting' | 'event'; rows?: Row[] }; +const base: TableData = (variant === 'meeting' ? meetings : events) as TableData; +// rows を渡された場合はその行だけを表示する(月別アーカイブ用) +const data: TableData = rows ? { columns: base.columns, rows } : base; --- <table> |
