diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 14:24:06 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 14:24:06 +0900 |
| commit | 0459cc71cd7081d03e51db10e6ae65cb73f9a4f2 (patch) | |
| tree | 69fbdf1570a8b19a672e07343c481f52e0f1c1a6 /src | |
| parent | fd377d1df26df4643f8028677b027327d397f121 (diff) | |
events: アーカイブの説明文を期間に合わせて出し分け
過去の月にも未来の月にも「開催日が過ぎたものも掲載」と書いていた。
すべて過去・今日を含む・すべて未来の3通りに分け、descriptionも
あわせて切り替える。
Diffstat (limited to 'src')
| -rw-r--r-- | src/content/docs/kodaira/events.mdx | 2 | ||||
| -rw-r--r-- | src/pages/kodaira/events/[period].astro | 31 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/content/docs/kodaira/events.mdx b/src/content/docs/kodaira/events.mdx index b3636bc..5374177 100644 --- a/src/content/docs/kodaira/events.mdx +++ b/src/content/docs/kodaira/events.mdx @@ -97,7 +97,7 @@ import ScheduleMonthLinks from '../../../components/ScheduleMonthLinks.astro'; ## 月別のアーカイブ -過去の月の予定は、月ごとのページで見られます。年度ごとの一覧もあります。 +月ごと・年度ごとのページに分けて、それぞれの期間の予定を見られます。 <ScheduleMonthLinks /> diff --git a/src/pages/kodaira/events/[period].astro b/src/pages/kodaira/events/[period].astro index 7ef4599..084760c 100644 --- a/src/pages/kodaira/events/[period].astro +++ b/src/pages/kodaira/events/[period].astro @@ -59,20 +59,41 @@ const eventRows = const months = kind === 'fiscal' ? monthsInFiscalYear(key) : []; const url = (period: string) => `${SCHEDULE_BASE_PATH}${period}/`; + +// 期間がすべて過去か、すべて未来か、今日を含むかで説明文を変える。 +// (過去の月に「今後の予定です」と書いたり、未来の月に「終了分も掲載」と書いたりしない) +const pad = (n: number) => String(n).padStart(2, '0'); +const now = new Date(); +const currentMonth = `${now.getFullYear()}-${pad(now.getMonth() + 1)}`; +const periodMonths = kind === 'fiscal' ? monthsInFiscalYear(key) : [key]; +const firstMonth = periodMonths[0] ?? key; +const lastMonth = periodMonths[periodMonths.length - 1] ?? key; +const isAllPast = lastMonth < currentMonth; +const isAllFuture = firstMonth > currentMonth; + +const lead = isAllPast + ? `${label}の小平市のイベントと、審議会等・市議会の予定を、記録として掲載しています。` + : isAllFuture + ? `${label}の小平市のイベントと、審議会等・市議会の開催予定です。` + : `${label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものもあわせて掲載しています。`; +const caution = isAllPast + ? '掲載内容は、掲載時点のものです。' + : '変更になることがありますので、各問い合わせ先へご確認ください。'; + +const description = isAllPast + ? `${label}に開催された小平市のイベントと、審議会・市議会の予定の記録です。日程・会場を確認できます。` + : `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`; --- <StarlightPage frontmatter={{ title: `小平市のイベント・行事予定(${label})`, - description: `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`, + description, }} > <p><a href={SCHEDULE_BASE_PATH}>← 小平市のイベント・行事予定カレンダー(今後)に戻る</a></p> - <p> - {label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものも記録として掲載しています。 - 変更になることがありますので、各問い合わせ先へご確認ください。 - </p> + <p>{lead}{caution}</p> { kind === 'fiscal' && ( |
