Refactors all-day event overflow toggle.

Simplifies the all-day event overflow toggle logic by using distinct class names and avoiding direct class switching, improving code readability and maintainability.
This commit is contained in:
Janus C. H. Knudsen 2025-10-02 16:05:11 +02:00
parent 13b72b55b2
commit 0bf369907b

View file

@ -524,14 +524,17 @@ export class AllDayManager {
this.isExpanded = !this.isExpanded;
this.checkAndAnimateAllDayHeight();
let elements = document.querySelectorAll('swp-allday-container swp-event : hasclass max-event-overflow-hide');
elements.forEach(element: HTMLElement => {
element.classList.switch('max-event-overflow-hide', 'max-event-overflow-show');
}
let elements = document.querySelectorAll('swp-allday-container swp-event.max-event-overflow-hide, swp-allday-container swp-event.max-event-overflow-show');
elements.forEach((element) => {
if (element.classList.contains('max-event-overflow-hide')) {
element.classList.remove('max-event-overflow-hide');
element.classList.add('max-event-overflow-show');
} else if (element.classList.contains('max-event-overflow-show')) {
element.classList.remove('max-event-overflow-show');
element.classList.add('max-event-overflow-hide');
}
});
}
/**
* Count number of events in a specific column using ColumnBounds
*/