feat(calendar): Implement Recurring Events with Multi-Day/Date Patterns, Notification Engine and Granular Deletion Options#64
Conversation
This commit introduces a new feature that provides desktop notifications for upcoming calendar events. Changes include: - **Event Notifications:** A background process (useEffect in App.tsx) periodically checks for local events with notifications enabled. If an event is scheduled to start soon (based on `notificationMinutes`), a desktop notification is triggered. - **Calendar Event Properties:** Added `notificationEnabled` and `notificationMinutes` to `CalendarEvent` interface, allowing users to configure notifications per event. - **Calendar Utilities (`calendarUtils.ts`):** Introduced a set of comprehensive utility functions to handle recurring events, calculate specific occurrences on a given date, and retrieve upcoming events. These functions consolidate logic previously spread across multiple components. - **Component Integration:** Updated `KoCalendarPopup` and `KoCalendarWidget` to utilize the new `calendarUtils` for event display and management. - **Internationalization:** Added new translation keys for notification messages and recurrence deletion options. This enhancement significantly improves the user experience by proactively informing them about important events.
The `key` prop for event items rendered within the `KoCalendarPopup` component was updated. Previously, the key was based solely on `ev.id`. This could lead to React warnings about duplicate keys and potential rendering inconsistencies if `ev.id` was not unique for all items in the list.
The key has been updated to `${ev.id}-${ev.startTime}` to provide a more robust and unique identifier for each event item. This ensures rendering stability and prevents React warnings related to non-unique list keys.
|
@eedali I have unit tested the feature. However, I guess you will be better at testing the UI stuffs. And, there are many permutations and combinations possible for this feature. Maybe I missed any, so let me know if you find any. After this PR, I will raise a fix PR for KoCalendar and then proceed with Integration of Google Calendars and other Calendars if possible. |
Hey @arindam-sahoo! 👋 Thanks so much for putting in the work and unit testing this. I will definitely dive in, test the UI, and check all the possible permutations as soon as I can. However, before we move forward with the KoCalendar fixes and the Google Calendar integration, I think it would be best to temporarily pause core feature development and put all our energy into finalizing the new modular plugin ecosystem. I've been making massive changes over in PR #58. I've actually started decoupling our existing core features and turning them into standalone plugins! So far, I have successfully extracted: ClipboardManager PinWindowToTop Screenshot Shortcuts SnippetVault ToDoList The plan is that once I convert all the necessary features into plugins, I am going to open separate, dedicated repositories for each of them under our GitHub organization. I believe continuing development this way will keep the core app incredibly lightweight and make maintaining features much easier. If you're up for it, I would absolutely love for you to jump in and help me finalize PR #58 instead! Once we get this modular architecture rock solid, building out that Google Calendar integration as its own independent plugin is going to be amazing. Let me know what you think about this roadmap! 🚀 |
Description
This pull request implements a comprehensive client-side event recurrence engine for KoCalendar, supporting daily, weekly, monthly, and yearly recurring events.
Key Features:
recurrenceExceptionsso it is omitted without altering other events.App.tsxthat scans for upcoming occurrences of recurring events, scheduling desktop alerts matching user-specified notification offsets. Uses session-level alerting history to guarantee exactly-once delivery.Bug Fixes Included:
prevDay's hours are now set to23:59:59.999local time to preserve the correct boundary when converted to/from ISO string.key={ev.id}keys with unique compositekey={${ev.id}-${ev.startTime}}keys for React's diffing engine.new Date()parses withparseISOfromdate-fnsfor event times to align platform-wide time interpretations.Type of Change
Screenshots / Video
KoBar.PR.64.mp4
Checklist