diff options
Diffstat (limited to 'src/components/ScheduleInteractive.astro')
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index 4c31d99..9b596e2 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -1,6 +1,8 @@ <script> // URLは src/data/schedule/config.ts で一元管理している(ページ移転時はそこだけ変える) import { parseDates, applyExclusions, toKey, keyToDate, entryDates, mainStartMonth, normalizeDigits } from '@/lib/schedule-dates'; + // パブリックコメントの受付期間(日別一覧に「受付中」を出すために使う) + import pubcomments from '@/data/schedule/pubcomments.json'; const CATEGORY_DEFS = [ { icon: '👶', label: '子育て' }, @@ -310,6 +312,26 @@ }); const title = `${date.getMonth() + 1}月${date.getDate()}日(${weekday})の予定`; + // その日がパブリックコメントの受付期間内なら、予定の一覧の上に知らせる。 + const activePubcomments = pubcomments.filter((p) => key >= p.from && key <= p.to); + let pubcommentHtml = ''; + if (activePubcomments.length) { + const until = activePubcomments + .map((p) => p.to) + .sort() + .slice(-1)[0]; + const [, untilMonth, untilDay] = until.split('-').map(Number); + pubcommentHtml = `<div class="schedule-day-pubcomment"> + <p class="schedule-day-pubcomment-title">📝 パブリックコメント受付中(${untilMonth}月${untilDay}日まで)</p> + <ul>${activePubcomments + .map( + (p) => + `<li><a class="schedule-day-pubcomment-link" href="${p.url}" target="_blank" rel="noopener noreferrer">${escapeHtml(p.title)}</a><span class="schedule-day-meta">${escapeHtml(p.contact)}</span></li>`, + ) + .join('')}</ul> + </div>`; + } + // 会場の地図(ScheduleMap)に、その日の予定を知らせる。 const detail = { date: key, @@ -324,7 +346,7 @@ document.dispatchEvent(new CustomEvent('schedule:day', { detail })); if (list.length === 0) { - detailsEl.innerHTML = `<h3>${title}</h3><p>この日の予定はありません。</p>`; + detailsEl.innerHTML = `<h3>${title}</h3>${pubcommentHtml}<p>この日の予定はありません。</p>`; return; } @@ -337,7 +359,7 @@ }) .join(''); - detailsEl.innerHTML = `<h3>${title}</h3><ul>${items}</ul>`; + detailsEl.innerHTML = `<h3>${title}</h3>${pubcommentHtml}<ul>${items}</ul>`; detailsEl.querySelectorAll('a.schedule-day-link').forEach((a) => { a.addEventListener('click', () => { const row = document.getElementById(a.getAttribute('href').slice(1)); |
