diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-20 14:40:42 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-20 14:40:42 +0900 |
| commit | 94ab71628261cd310abd786df5c7217c2fccabcd (patch) | |
| tree | baf8c5496ed0c74a43130394b2d41c8b45348482 /src/components/ScheduleInteractive.astro | |
| parent | 9c058f6ecc00bff0b69fcc2c963c749531f85ec9 (diff) | |
ScheduleInteractive.astro: カテゴリ変更時に選択日を移動しない
- 絞り込みで選択中の日付に該当がなくても、当月先頭の日付へ自動で移らないようにする
- 該当がない日は「この日の予定はありません。」と表示する
- 未使用になった ensureVisibleSelection を削除
Diffstat (limited to 'src/components/ScheduleInteractive.astro')
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index e409475..b7c8481 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -163,20 +163,6 @@ return list.filter(matchesCategory); } - function ensureVisibleSelection() { - if (selectedDate && visibleEntries(selectedDate).length > 0) return; - // 絞り込みで選択中の日付が空になったら、当月の最初の該当日へ移動する。 - // 当月に該当日がなければ、最初の該当日へ移動する。 - const inMonth = dateKeys.filter( - (k) => k.startsWith(currentMonth) && visibleEntries(k).length > 0 - ); - const any = dateKeys.filter((k) => visibleEntries(k).length > 0); - const fallback = inMonth[0] || any[0]; - if (!fallback) return; - selectedDate = fallback; - currentMonth = fallback.slice(0, 7); - } - function renderCalendar() { const index = months.indexOf(currentMonth); const [year, month] = currentMonth.split('-').map(Number); @@ -492,7 +478,7 @@ b.setAttribute('aria-pressed', String(b.dataset.category === activeCategory)); }); applyFilter(); - ensureVisibleSelection(); + // カテゴリを変えても、選択中の日付は動かさない(その日に該当がなければ「予定はありません」と出す)。 renderCalendar(); if (selectedDate) showDayDetails(selectedDate); } |
