Skip to content

feat(calendar): add date navigation (prev/next day) to calendar sidebar#39936

Open
VedantGupta-DTU wants to merge 1 commit intoRocketChat:developfrom
VedantGupta-DTU:feat/outlook-date-navigation
Open

feat(calendar): add date navigation (prev/next day) to calendar sidebar#39936
VedantGupta-DTU wants to merge 1 commit intoRocketChat:developfrom
VedantGupta-DTU:feat/outlook-date-navigation

Conversation

@VedantGupta-DTU
Copy link
Copy Markdown

@VedantGupta-DTU VedantGupta-DTU commented Mar 28, 2026

Proposed changes

Currently, the Calendar sidebar (specifically OutlookEventsList) is hardcoded to only fetch and display events for the current day using useOutlookCalendarListForToday. 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:

  • Date State: Introduced a currentDate React state and swapped the fetch hook to the dynamic useOutlookCalendarList(currentDate).
  • Navigation Controls: Rendered a sticky horizontal navigation bar containing <IconButton> chevrons to increment/decrement the date, alongside a localized Intl.DateTimeFormat display of the active date.
  • Cache Invalidation: React Query elegantly handles the background fetches as the date state changes, maintaining the correct query keys cleanly.

Issue(s)

Addresses the missing functionality of jumping to different dates inside the Calendar Contextual Bar.

Steps to test or reproduce

  1. Go to the Rocket.Chat UI and open the Calendar (Outlook) sidebar.
  2. Observe the current date rendered underneath the header.
  3. Click the > (Next Day) chevron arrow.
  4. Verify that the date text updates correctly and the agenda list re-fetches to load the events scheduled for tomorrow.
  5. Click < (Previous Day) to navigate backwards.

Further comments

The usage of Intl.DateTimeFormat ensures that the date format is completely native, accessible, and requires no heavy external libraries like Moment.js to format properly.

Summary by CodeRabbit

  • New Features
    • Added date navigation to the Outlook Calendar events list, enabling users to view events for different dates using left and right navigation buttons.
    • Displays the currently selected date with a formatted label.

@VedantGupta-DTU VedantGupta-DTU requested a review from a team as a code owner March 28, 2026 20:22
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 28, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 28, 2026

⚠️ No Changeset found

Latest commit: cf0ce0f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

Walkthrough

The 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

Cohort / File(s) Summary
Outlook Calendar Date Navigation
apps/meteor/client/views/outlookCalendar/OutlookEventsList/OutlookEventsList.tsx
Replaced useOutlookCalendarListForToday hook with parameterized useOutlookCalendarList(currentDate). Added state management for date selection, memoized day navigation handlers, and UI controls (chevron buttons and date label) to enable browsing events across different dates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

type: feature

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding date navigation (prev/next day) functionality to the Outlook calendar sidebar, which is the core purpose of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the type: feature Pull requests that introduces new feature label Mar 28, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4235cd9 and cf0ce0f.

📒 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 Date object creation, and the useCallback handlers correctly manipulate dates with proper month/year boundary handling via the Date constructor.


74-103: Conditional rendering logic is correct.

The state handling for isPending, isError, and isSuccess properly covers all query states, and the empty-state check at line 83 correctly guards against showing "No history" while still loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant