diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-23 21:55:36 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-23 21:55:36 +0900 |
| commit | cd44454bdebc8bf101ec4e43c458c0357f00bcd2 (patch) | |
| tree | 1bbc4581779f36d9844006e0405d4a63131f2d12 /src/components/ScheduleInteractive.astro | |
| parent | 3167cd828969cc8e2fa49e9c8c8e853ee614a239 (diff) | |
hp-archive: 市Xの新着と終了表示を反映
- 市公式Xの10月22日・23日の新着を追加
- 終了した予定に「終了」バッジを表示
- LoGoフォームの猫の譲渡会を追加し、一覧の注意書きを追記
- 教育委員会の追加議事日程、西部出張所の移転を反映
- 10月19日開催の予定を削除
Diffstat (limited to 'src/components/ScheduleInteractive.astro')
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index 5fb058b..bc26e0a 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -206,6 +206,24 @@ const months = [...new Set(dateKeys.map((k) => k.slice(0, 7)))].sort(); const today = new Date(); const todayKey = toKey(today.getFullYear(), today.getMonth() + 1, today.getDate()); + + // 開催日がすべて過去のものは「終了」と表示する。 + // 複数回の催しで未来の回が残っているものは対象外。 + for (const entry of entries) { + if (entry.dateText.includes('申込開始')) continue; + if (entry.dates.length === 0) continue; + if (!entry.dates.every((d) => d < todayKey)) continue; + const row = document.getElementById(entry.rowId); + if (!row) continue; + row.classList.add('is-ended'); + if (!row.querySelector('.schedule-ended-badge') && row.cells[0]) { + const badge = document.createElement('span'); + badge.className = 'schedule-ended-badge'; + badge.textContent = '終了'; + row.cells[0].appendChild(badge); + } + } + let selectedDate = byDate.has(todayKey) ? todayKey : dateKeys[0]; let currentMonth = selectedDate.slice(0, 7); let activeCategory = 'all'; |
