Skip to content

Comments

feat: upcoming bookings atom#24010

Merged
Ryukemeister merged 20 commits intomainfrom
rajiv/cal-5461-feature-upcoming-bookings-atom
Oct 14, 2025
Merged

feat: upcoming bookings atom#24010
Ryukemeister merged 20 commits intomainfrom
rajiv/cal-5461-feature-upcoming-bookings-atom

Conversation

@Ryukemeister
Copy link
Contributor

@Ryukemeister Ryukemeister commented Sep 23, 2025

What does this PR do?

  • This PR adds ability to display bookings of a user event for calendar view atom

Image Demo (if applicable):

For team events

Screenshot 2025-10-02 at 4 11 18 PM

For individual events

Screenshot 2025-10-02 at 4 14 45 PM

Mandatory Tasks (DO NOT REMOVE)

  • (N/A) I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • (N/A) I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • (N/A) I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

This can be tested in packages/platform/examples/base week view page

@linear
Copy link

linear bot commented Sep 23, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

  • Adds a changeset for @calcom/atoms introducing a feature to display user event bookings in Calendar View.
  • Updates docs: removes isTeamEvent prop, clarifies optional username/teamId usage and when each is required.
  • LargeCalendar now sources overlay events from useBookings instead of overlay store; adds BookingStatus, includes id in event.data, adjusts event mapping/rendering, and defaults events to [].
  • CalendarViewPlatformWrapper derives isTeamEvent from teamId, updates prop types to omit isTeamEvent for team variant, switches to usePrefetch for month prefetching, and updates scheduling/data-fetch logic and atom fetch calls accordingly.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “feat: upcoming bookings atom” concisely indicates the addition of an upcoming bookings feature within the atom framework and directly corresponds to the pull request’s enhancement of displaying user event bookings in the calendar view atom. It highlights the primary change of integrating booking data into the atom in a short, clear phrase.
Description Check ✅ Passed The pull request description clearly explains that this change adds the ability to display bookings for user events in the calendar view atom, includes demo screenshots for both team and individual contexts, and provides testing instructions, making it directly relevant to the implemented changes.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rajiv/cal-5461-feature-upcoming-bookings-atom

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.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Sep 23, 2025
@vercel
Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 13, 2025 0:29am
cal-eu Ignored Ignored Oct 13, 2025 0:29am

@Ryukemeister Ryukemeister marked this pull request as ready for review October 2, 2025 10:57
@Ryukemeister Ryukemeister requested a review from a team October 2, 2025 10:57
@Ryukemeister Ryukemeister requested a review from a team as a code owner October 2, 2025 10:57
@Ryukemeister
Copy link
Contributor Author

merge this only after #24123

@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking ✨ feature New feature or request labels Oct 2, 2025
Copy link
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

🧹 Nitpick comments (1)
packages/features/calendar-view/LargeCalendar.tsx (1)

59-60: Prefer stable booking identifiers.

Using the loop index as the event id will reshuffle identities whenever the list changes length/order, which can confuse the calendar rendering. We already receive booking.id; please use that (or another stable unique key) instead.

-        id: idx,
+        id: booking.id ?? idx,
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7505b3b and 1b65fa6.

📒 Files selected for processing (4)
  • .changeset/eighty-walls-send.md (1 hunks)
  • docs/platform/atoms/calendar-view.mdx (2 hunks)
  • packages/features/calendar-view/LargeCalendar.tsx (4 hunks)
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx (7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/features/calendar-view/LargeCalendar.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/calendar-view/LargeCalendar.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/calendar-view/LargeCalendar.tsx
  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
🧠 Learnings (1)
📚 Learning: 2025-09-18T13:38:50.958Z
Learnt from: hariombalhara
PR: calcom/cal.com#23913
File: packages/features/bookings/Booker/components/hooks/usePrefetch.ts:43-50
Timestamp: 2025-09-18T13:38:50.958Z
Learning: In usePrefetch hook in packages/features/bookings/Booker/components/hooks/usePrefetch.ts, the !isNaN() checks before comparing monthAfterAdding1Month !== monthAfterAddingExtraDaysColumnView are intentional to prevent the NaN !== NaN issue where NaN values would incorrectly be considered different, leading to wrong monthCount calculations.

Applied to files:

  • packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx
🧬 Code graph analysis (2)
packages/features/calendar-view/LargeCalendar.tsx (2)
packages/features/bookings/types.ts (1)
  • BookerEvent (34-69)
packages/platform/atoms/index.ts (1)
  • useBookings (16-16)
packages/platform/atoms/calendar-view/wrappers/CalendarViewPlatformWrapper.tsx (2)
packages/platform/atoms/booker/types.ts (2)
  • BookerPlatformWrapperAtomPropsForIndividual (91-95)
  • BookerPlatformWrapperAtomPropsForTeam (97-102)
packages/features/bookings/Booker/components/hooks/usePrefetch.ts (1)
  • usePrefetch (16-56)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache

Comment on lines +58 to +60
| eventSlug | Yes | Unique slug created for a particular event |
| username | Optional | Username of the person whose schedule is to be displayed, required only for individual events | | |
| teamId | Optional | Id of the team for which the event is created, required only for team events | No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix table column delimiters.

The username row now has two extra | delimiters, which breaks the three-column layout when rendered. Please drop the trailing separators so the table stays well-formed.

-| username                   | Optional     | Username of the person whose schedule is to be displayed, required only for individual events                                          |                                             |                                        |
+| username                   | Optional     | Username of the person whose schedule is to be displayed, required only for individual events |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| eventSlug | Yes | Unique slug created for a particular event |
| username | Optional | Username of the person whose schedule is to be displayed, required only for individual events | | |
| teamId | Optional | Id of the team for which the event is created, required only for team events |
| eventSlug | Yes | Unique slug created for a particular event |
| username | Optional | Username of the person whose schedule is to be displayed, required only for individual events |
| teamId | Optional | Id of the team for which the event is created, required only for team events |
🤖 Prompt for AI Agents
In docs/platform/atoms/calendar-view.mdx around lines 58 to 60, the markdown
table row for "username" contains extra pipe characters that create a fourth
empty column and break the three-column layout; remove the two trailing '|'
delimiters from that row so it has exactly three pipe-separated columns (column
name, requirement, description) matching the other rows and keep the table
aligned.

Comment on lines +60 to +61
title: booking.title ?? `Busy`,
start: new Date(booking.start),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Localize the “Busy” label.

Frontend strings should be wrapped with t() per our TSX guideline. Please move this fallback through the translation layer (e.g. t("busy")) to keep the atom localizable.

As per coding guidelines

Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

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

Good stuff - have some comments and questions.

I also think it would be good that Sean reviews this since it affects consumer component.

id: idx,
title: booking.title ?? `Busy`,
start: new Date(booking.start),
end: new Date(booking.end),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we switching to new Date from dayjs(event.end).toDate() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no real reason tbh, just for consistency with trouble shooter component here for consistency

skip: 0,
status: ["upcoming", "past", "recurring"],
eventTypeId: event?.data?.id,
afterStart: startDate.toISOString(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Question - the start and end dates here refer to 1 week or we would fetch for whole month?
Question 2- what if someone has more than 50 bookings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the start and end dates here refer to 1 week or we would fetch for whole month

for 1 week because, that way we reduce the load to the server and only fetch data that's needed, which the user clicks the next week button that's when we fetch bookings for that particular the user is on

what if someone has more than 50 bookings?

hmm not sure here, should we increase the number of bookings then to 150? I think ideally its really hard to have 150 bookings for just for one week, what do you think about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated bookings fetch count to 150

@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 13, 2025
Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

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

Good stuff!

@github-actions
Copy link
Contributor

E2E results are ready!

@Ryukemeister Ryukemeister merged commit 09ee39a into main Oct 14, 2025
61 of 62 checks passed
@Ryukemeister Ryukemeister deleted the rajiv/cal-5461-feature-upcoming-bookings-atom branch October 14, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking core area: core, team members only ✨ feature New feature or request platform Anything related to our platform plan ready-for-e2e size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants