summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/components/ScheduleInteractive.astro16
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);
}