From 8c2b29f889c75d1d3962d5a3a7b8f9536aebddbe Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Wed, 18 Nov 2026 00:09:09 +0900 Subject: Pubcomments.astro: パブコメ欄をJSONから自動生成するように統合 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本文のパブコメ欄と日別一覧の「受付中」表示が同じ pubcomments.json を参照するようにした。募集中・これからの募集・終了した募集はビルド日から自動で振り分ける。 --- src/components/Pubcomments.astro | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/components/Pubcomments.astro (limited to 'src/components') diff --git a/src/components/Pubcomments.astro b/src/components/Pubcomments.astro new file mode 100644 index 0000000..73521cd --- /dev/null +++ b/src/components/Pubcomments.astro @@ -0,0 +1,62 @@ +--- +// パブリックコメントの一覧。データは src/data/schedule/pubcomments.json から生成する +// (日別一覧の「受付中」表示も同じJSONを使う)。 +import pubcomments from '@/data/schedule/pubcomments.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}日`; +}; + +const items = pubcomments.map((p) => ({ + ...p, + state: todayKey < p.from ? 'upcoming' : todayKey > p.to ? 'ended' : 'open', + toLabel: + p.from.slice(0, 4) === p.to.slice(0, 4) ? reiwa(p.to).replace(/^令和\d+年|^令和元年/, '') : reiwa(p.to), + noteText: p.note ? (p.note.endsWith('。') ? p.note : `${p.note}。`) : '', +})); + +const groups = [ + { key: 'open', label: '募集中' }, + { key: 'upcoming', label: 'これからの募集' }, + { key: 'ended', label: '終了した募集' }, +] as const; +--- + +

+ 市は、計画や条例の案について市民の意見を募るパブリックコメント(市民意見公募手続)を行っています。最新の募集状況は、市のパブリックコメントのページでご確認ください。 +

+ +{ + groups.map((group) => { + const list = items.filter((item) => item.state === group.key); + if (list.length === 0) return null; + return ( + <> +

+ {group.label} +

+ + + ); + }) +} + +

提出方法や、素案を閲覧できる場所は、それぞれのページをご覧ください。

+

(注){reiwa(todayKey)}時点の情報です。

-- cgit v1.3.1