fix(calendar): display ICS badge events in calendar views

Previously, ICS events with showType="badge" were being filtered out
completely from the calendar display due to an early return statement.
This prevented badge events from appearing in any calendar view.

The fix removes the blocking early return and instead includes badge
events in the main events array with a badge property to maintain
their special rendering requirements.

Changes:
- Add badge property to CalendarEvent interface
- Remove early return that blocked badge event processing
- Include badge events in main events array with badge flag
- Maintain badge event caching for performance
This commit is contained in:
Quorafind 2025-08-20 12:26:13 +08:00
parent deef893535
commit 84086368b6

View file

@ -41,6 +41,7 @@ export interface CalendarEvent extends Task {
allDay: boolean; // Indicates if the event is an all-day event
// task: Task; // Removed, as properties are now inherited
color?: string; // Optional color for the event
badge?: boolean; // Indicates if this is a badge event (for ICS events with showType="badge")
}
export class CalendarComponent extends Component {
@ -460,11 +461,6 @@ export class CalendarComponent extends Component {
const icsTask = isIcsTask ? (task as IcsTask) : null; // Type assertion for IcsTask
const showAsBadge = icsTask?.icsEvent?.source?.showType === "badge";
// Skip ICS tasks with badge showType - they will be handled separately
if (isIcsTask && showAsBadge) {
return;
}
// Determine the date to use based on priority (dueDate > scheduledDate > startDate)
// This logic might need refinement based on exact requirements in PRD 4.2
let eventDate: number | null = null;
@ -538,6 +534,7 @@ export class CalendarComponent extends Component {
end: end, // Add end date if calculated
allDay: isAllDay,
color: eventColor,
badge: showAsBadge, // Mark badge events for special handling
});
}
// Else: Task has no relevant date, ignore for now (PRD: maybe "unscheduled" panel)
@ -677,6 +674,7 @@ export class CalendarComponent extends Component {
end: icsTask.icsEvent.dtend,
allDay: icsTask.icsEvent.allDay,
color: icsTask.icsEvent.source.color,
badge: true, // Mark as badge event
};
badgeEventsForDate.push(calendarEvent);
}