From 9c058f6ecc00bff0b69fcc2c963c749531f85ec9 Mon Sep 17 00:00:00 2001
From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>
Date: Fri, 20 Nov 2026 14:38:18 +0900
Subject: ScheduleInteractive.astro: 愛称投票を日別一覧のパブコメ直上に表示
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 独立した段落(Campaigns.astro)は廃止し、日別一覧に1件の予定として出す
- campaigns.json は ScheduleInteractive から読み込み、今日から締切までの日に表示
- 外部リンク(投票フォーム)はスクロール処理の対象外にする
- 冒頭に「内容に誤りがある場合があります」を追記
---
src/components/Campaigns.astro | 42 --------------------------------
src/components/ScheduleInteractive.astro | 35 ++++++++++++++++++++------
src/content/docs/kodaira/events.mdx | 5 +---
3 files changed, 28 insertions(+), 54 deletions(-)
delete mode 100644 src/components/Campaigns.astro
(limited to 'src')
diff --git a/src/components/Campaigns.astro b/src/components/Campaigns.astro
deleted file mode 100644
index e0437e9..0000000
--- a/src/components/Campaigns.astro
+++ /dev/null
@@ -1,42 +0,0 @@
----
-// 期間限定の投票・意見募集(パブリックコメント以外)。
-// データは src/data/schedule/campaigns.json から読む。
-// 期間中(today <= to)だけ表示し、終わったら何も出さない。
-import campaigns from '@/data/schedule/campaigns.json';
-
-const pad = (n: number) => String(n).padStart(2, '0');
-const now = new Date();
-const todayKey = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
-
-const reiwa = (iso: string) => {
- const [y, m, d] = iso.split('-').map(Number);
- const year = y - 2018 === 1 ? '令和元年' : `令和${y - 2018}年`;
- return `${year}${m}月${d}日`;
-};
-
-type Campaign = {
- title: string;
- to: string;
- from?: string;
- url?: string;
- contact: string;
- note?: string;
-};
-
-const active = (campaigns as Campaign[]).filter(
- (c) => todayKey <= c.to && (!c.from || c.from <= todayKey),
-);
----
-
-{
- active.length > 0 && (
- 募集中(投票・意見募集)
-
- {active.map((c) => (
-
-
📝 パブリックコメント受付中
${activePubcomments @@ -346,7 +362,7 @@ document.dispatchEvent(new CustomEvent('schedule:day', { detail })); if (list.length === 0) { - detailsEl.innerHTML = `
-小平市のイベントと審議会等・市議会の開催予定を、カレンダー・地図・一覧表でまとめています。[多くの情報源](#情報源)から取得したものです。延期・中止・会場変更の可能性もありますので、最新状況は、それぞれのお問い合わせ先へご確認ください。このページに問い合わせ先の記載がないものは、市報こだいらや市の[「各課の電話番号一覧」](https://www.city.kodaira.tokyo.jp/contact-info/index.html)などをご覧ください。
+小平市のイベントと審議会等・市議会の開催予定を、カレンダー・地図・一覧表でまとめています。[多くの情報源](#情報源)から取得したものです。内容に誤りがある場合があります。また、延期・中止・会場変更となることもあります。最新状況は、それぞれのお問い合わせ先へご確認ください。このページに問い合わせ先の記載がないものは、市報こだいらや市の[「各課の電話番号一覧」](https://www.city.kodaira.tokyo.jp/contact-info/index.html)などをご覧ください。
@@ -61,8 +60,6 @@ import Campaigns from '../../../components/Campaigns.astro';
-
-
## イベントカレンダー
カテゴリと日付を選ぶと、その日の小平市のイベント等一覧と会場地図が下に表示されます。
--
cgit v1.3.1
${title}
${pubcommentHtml}この日の予定はありません。
`; + detailsEl.innerHTML = `${title}
${campaignHtml}${pubcommentHtml}この日の予定はありません。
`; return; } @@ -359,10 +375,13 @@ }) .join(''); - detailsEl.innerHTML = `${title}
${pubcommentHtml}${items}
`; + detailsEl.innerHTML = `${title}
${campaignHtml}${pubcommentHtml}${items}
`; detailsEl.querySelectorAll('a.schedule-day-link').forEach((a) => { a.addEventListener('click', () => { - const row = document.getElementById(a.getAttribute('href').slice(1)); + const href = a.getAttribute('href') ?? ''; + // 外部リンク(投票フォームなど)はそのまま開く + if (/^https?:/i.test(href)) return; + const row = document.getElementById(href.slice(1)); if (!row) return; row.classList.add('schedule-row-highlight'); window.setTimeout(() => row.classList.remove('schedule-row-highlight'), 3000); diff --git a/src/content/docs/kodaira/events.mdx b/src/content/docs/kodaira/events.mdx index 5dd03d4..a0756f0 100644 --- a/src/content/docs/kodaira/events.mdx +++ b/src/content/docs/kodaira/events.mdx @@ -43,11 +43,10 @@ import ScheduleSeo from '../../../components/ScheduleSeo.astro'; import ScheduleTable from '../../../components/ScheduleTable.astro'; import ScheduleMonthLinks from '../../../components/ScheduleMonthLinks.astro'; import Pubcomments from '../../../components/Pubcomments.astro'; -import Campaigns from '../../../components/Campaigns.astro';