fix(calendar): prevent empty calendar state from overriding legacy mode

- CalendarManager no longer updates state when no calendars found
- Shows friendly message 'Events displayed in classic mode'
- Integration stays uninitialized, uses legacy fetchEventsCombined
- This ensures existing events always visible without Calendar records
This commit is contained in:
admin i 2026-02-11 11:27:57 +03:00
parent f8a8b3b2f2
commit 13c298e51d

View File

@ -42,6 +42,19 @@ export function initCalendarManager(options = {}) {
try {
calendars = await getMyCalendars();
// Если календарей нет - не обновляем состояние (используем legacy режим)
if (calendars.length === 0) {
console.log('[CalendarManager] No calendars found, keeping legacy mode');
container.innerHTML = `
<div class="text-center text-muted py-3">
<i class="bi-calendar-x mb-2" style="font-size: 2rem;"></i>
<p class="mb-0">Календари не настроены</p>
<small>События отображаются в классическом режиме</small>
</div>
`;
return;
}
// По умолчанию все календари видимы
visibleCalendarIds = new Set(calendars.map(cal => cal.id));