feat(calendar): add date navigation (prev/next day) to calendar sidebar#39936
feat(calendar): add date navigation (prev/next day) to calendar sidebar#39936VedantGupta-DTU wants to merge 1 commit intoRocketChat:developfrom
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughThe component now supports viewing Outlook calendar events for any date, not just today. A parameterized hook replaces the fixed-date variant, with local state tracking the selected date. Navigation buttons allow incrementing/decrementing the date to populate the events list. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx">
<violation number="1" location="apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx:70">
P2: Date header formatting is hardcoded to `en-US`, preventing locale-aware display for non-US users.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx`:
- Around line 69-71: The date formatting is hardcoded to 'en-US' which breaks
i18n; update the Intl.DateTimeFormat usage in OutlookEventsList (the code that
formats currentDate with Intl.DateTimeFormat) to use a dynamic locale (pass
undefined to use the browser locale) or obtain the app locale from Rocket.Chat's
locale context/translation hook and pass that instead so the rendered date
respects user locale settings. Ensure you update the call that currently is new
Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', year: 'numeric'
}).format(currentDate) to use the chosen dynamic locale value.
- Line 48: The query key used by useOutlookCalendarList is missing the passed
date, causing React Query to return cached results for different dates; update
the queryKey inside useOutlookCalendarList (the hook used by OutlookEventsList)
to include the date (e.g. date.toISOString()) so each date produces a distinct
cache entry and the API call uses the correct key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 95bc8f7f-bf44-41e1-8417-b15d18602b06
📒 Files selected for processing (1)
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx
🧠 Learnings (1)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx
🔇 Additional comments (2)
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx (2)
38-48: LGTM – state and handlers are well implemented.The lazy state initializer avoids unnecessary
Dateobject creation, and theuseCallbackhandlers correctly manipulate dates with proper month/year boundary handling via theDateconstructor.
74-103: Conditional rendering logic is correct.The state handling for
isPending,isError, andisSuccessproperly covers all query states, and the empty-state check at line 83 correctly guards against showing "No history" while still loading.
Proposed changes
Currently, the Calendar sidebar (specifically
OutlookEventsList) is hardcoded to only fetch and display events for the current day usinguseOutlookCalendarListForToday. This restricts users from checking events for tomorrow, next week, or past days natively within the Rocket.Chat client.This PR introduces stateful date navigation to the calendar sidebar:
currentDateReact state and swapped the fetch hook to the dynamicuseOutlookCalendarList(currentDate).<IconButton>chevrons to increment/decrement the date, alongside a localizedIntl.DateTimeFormatdisplay of the active date.Issue(s)
Addresses the missing functionality of jumping to different dates inside the Calendar Contextual Bar.
Steps to test or reproduce
>(Next Day) chevron arrow.<(Previous Day) to navigate backwards.Further comments
The usage of
Intl.DateTimeFormatensures that the date format is completely native, accessible, and requires no heavy external libraries like Moment.js to format properly.Summary by CodeRabbit