Skip to content

Conversation

Udit-takkar
Copy link
Contributor

@Udit-takkar Udit-takkar commented Jul 15, 2025

What does this PR do?

Screenshot 2025-07-16 at 9 21 00 PM

Follow up:- Add UI tests

Mandatory Tasks (DO NOT REMOVE)

  • 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?

Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

"""

Walkthrough

The changes refactor the BookingListItem component by consolidating multiple separate booking action arrays into grouped arrays generated via helper functions from a new bookingActions module. The cancel action is extracted as a standalone constant with centralized disabling and labeling logic. The component's JSX is simplified by replacing multiple conditional renderings with a streamlined dropdown menu that displays grouped edit and after-event actions or the cancel action depending on booking state and recurrence. Localization keys are updated by removing an obsolete key and adding new keys for "edit_event" and "view_session_details" to reflect updated UI labels. Playwright tests are updated to interact with the new dropdown menu for booking actions. A comprehensive new test suite verifies the behavior of the booking action helpers.

Assessment against linked issues

Objective Addressed Explanation
Refactor booking list item UI to consolidate actions into a dropdown menu ("edit event" and "after event" groups) (#22563, CAL-6112) Actions are grouped into arrays returned by helper functions and rendered inside a dropdown menu, replacing multiple inline arrays and conditional renderings.
Implement explicit disabled logic for actions based on booking/event state (#22563, CAL-6112) Disabled states for actions like cancelling and rescheduling are centralized in helper functions based on booking and event properties.
Update action labels and icons for consistency and clarity (#22563, CAL-6112) Localization keys and labels are updated, including removal of "get_meeting_session_details" and addition of "edit_event" and "view_session_details".
Simplify and unify conditional rendering of booking actions in the component (#22563, CAL-6112) JSX rendering logic is streamlined using dropdown menus and helper functions, reducing complexity and improving maintainability.

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.
"""

Estimated code review effort

3 (~45 minutes)

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/components/booking/bookingActions.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-playwright".

(The package "eslint-plugin-playwright" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-playwright@latest --save-dev

The plugin "eslint-plugin-playwright" was referenced from the config file in ".eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 894991c and de176b2.

📒 Files selected for processing (1)
  • apps/web/components/booking/bookingActions.ts (1 hunks)
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/components/booking/bookingActions.ts
🧠 Learnings (1)
apps/web/components/booking/bookingActions.ts (1)

Learnt from: eunjae-lee
PR: #22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

🧬 Code Graph Analysis (1)
apps/web/components/booking/bookingActions.ts (2)
apps/web/components/booking/BookingListItem.tsx (1)
  • BookingItemProps (73-83)
packages/platform/libraries/index.ts (1)
  • SchedulingType (30-30)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/components/booking/bookingActions.ts
🧠 Learnings (1)
apps/web/components/booking/bookingActions.ts (1)

Learnt from: eunjae-lee
PR: #22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

🧬 Code Graph Analysis (1)
apps/web/components/booking/bookingActions.ts (2)
apps/web/components/booking/BookingListItem.tsx (1)
  • BookingItemProps (73-83)
packages/platform/libraries/index.ts (1)
  • SchedulingType (30-30)
⏰ 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: Security Check
🔇 Additional comments (9)
apps/web/components/booking/bookingActions.ts (9)

1-34: LGTM! Well-structured imports and comprehensive context interface.

The BookingActionContext interface provides a comprehensive set of context properties that cover all booking states and conditions needed for action generation. The interface is well-typed and the imports are clean and necessary.


36-62: LGTM! Proper handling of pending booking actions.

The function correctly handles the different scenarios for pending bookings, including payment requirements and recurring booking labels. The logic for conditional confirm action based on payment state is well-implemented.


64-77: LGTM! Proper centralization of cancel action logic.

The function correctly uses the centralized isActionDisabled helper for determining disabled state, which addresses the concern about consistent cancel logic. The URL construction properly handles recurring bookings and seat references.


79-96: LGTM! Appropriate video action conditions.

The function correctly implements the conditions for video-related actions, ensuring they're only enabled for past, confirmed bookings with Cal video locations. The logic for recordings specifically checks isRecorded status.


98-161: LGTM! Comprehensive edit action generation.

The function effectively handles multiple edit actions with proper conditional rendering using the null-filter pattern. The round-robin scheduling check and reschedule URL construction are well-implemented.


163-186: LGTM! Well-structured after-event action logic.

The function efficiently reuses video actions and properly handles the charge card action for payment holds. The dynamic no-show action labeling based on current attendee state is well-implemented.


188-201: LGTM! Clear and focused helper functions.

These helper functions provide clean boolean logic for conditional rendering decisions. The naming is clear and the logic is straightforward.


224-243: LGTM! Centralized label generation with proper context handling.

The getActionLabel function provides consistent label generation across different action types, properly handling recurring booking scenarios and dynamic states like no-show and charge card statuses.


203-222: Cancel action logic is correctly centralized and requires no changes.

The isActionDisabled implementation for "cancel" properly disables the action when cancellation is explicitly disabled or when the booking is in the past, still pending, and not confirmed. All usages and existing tests align with this behavior.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 3:37pm
cal-eu ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 3:37pm

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Jul 15, 2025
Copy link

delve-auditor bot commented Jul 15, 2025

No security or compliance issues detected. Reviewed everything up to de176b2.

Security Overview
  • 🔎 Scanned files: 8 changed file(s)
Detected Code Changes
Change Type Relevant files
Bug Fix ► BookingListItem.tsx
    Fix cancel button styling and functionality
► bookingActions.ts
    Refactor booking actions handling
► showToast.tsx
    Fix toast icon alignment
Refactor ► lib/server/service
    Rename service files for consistency
► lib/server/repository
    Rename repository files for consistency

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@vercel vercel bot temporarily deployed to Preview – api July 16, 2025 15:52 Inactive
}
});
}
const cancelEventAction: ActionType = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

on recurring tab we just display cancel action and nothing else

Comment on lines 349 to 352
label: t("view_session_details"),
onClick: () => setMeetingSessionDetailsDialogIsOpen(true),
icon: "info",
disabled: !(isBookingInPast && isConfirmed && isCalVideoLocation),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only display when meeting has passed

/>
)}
{isPending && isUpcoming && !isCancelled && <TableActions actions={pendingActions} />}
{!isPending && !(isTabRecurring && isRecurring) && !isCancelled && <BookingActions />}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All actions is added here now.

Copy link

linear bot commented Jul 16, 2025

@Udit-takkar Udit-takkar marked this pull request as ready for review July 16, 2025 15:55
@graphite-app graphite-app bot requested a review from a team July 16, 2025 15:55
@dosubot dosubot bot added ui area: UI, frontend, button, form, input 💻 refactor labels Jul 16, 2025
Copy link

graphite-app bot commented Jul 16, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (07/16/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (07/21/25)

1 label was added to this PR based on Keith Williams's automation.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfc6d6e and 9a2e77c.

📒 Files selected for processing (2)
  • apps/web/components/booking/BookingListItem.tsx (5 hunks)
  • apps/web/public/static/locales/en/common.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
apps/web/components/booking/BookingListItem.tsx (1)
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.341Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
apps/web/public/static/locales/en/common.json (1)

undefined

<retrieved_learning>
Learnt from: bandhan-majumder
PR: #22359
File: packages/lib/server/locales/en/common.json:1336-1339
Timestamp: 2025-07-14T16:31:45.201Z
Learning: When making localization changes for new features, it's often safer to add new strings rather than modify existing ones to avoid breaking existing functionality that depends on the original strings. This approach allows for feature-specific customization while maintaining backward compatibility.
</retrieved_learning>

⏰ 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). (4)
  • GitHub Check: Tests / Unit
  • GitHub Check: Type check / check-types
  • GitHub Check: Linters / lint
  • GitHub Check: Security Check
🔇 Additional comments (3)
apps/web/public/static/locales/en/common.json (1)

52-53: Add corresponding keys in non-EN locale files

edit_event and view_session_details were added only to the English bundle.
If the project relies on key-parity across locale files, remember to add placeholders (or translations) to the other language JSONs now—otherwise runtime look-ups may fall back to the key string or crash depending on the i18n setup.

Nothing else to change in this snippet.

apps/web/components/booking/BookingListItem.tsx (2)

248-257: Good extraction of cancel action with proper styling and logic

The separation of the cancel action with destructive color and comprehensive disabled logic is well implemented.


740-742: Clean refactoring of action rendering logic

The simplified conditional rendering logic is much clearer and correctly handles all booking states as intended.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – api July 16, 2025 18:19 Inactive
Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

@Udit-takkar I think tests are a must here.

@github-actions github-actions bot marked this pull request as draft July 22, 2025 09:25
@Udit-takkar
Copy link
Contributor Author

@Udit-takkar I think tests are a must here.

Okay. I was planning to add this in a follow up PR. I'll just add it now

@hariombalhara
Copy link
Member

Past unconfirmed bookings will not show any actions. Want to confirm if that is fine?
image

Looks fine to me though.

@hariombalhara
Copy link
Member

Except for the tests, it LGTM !!

@Udit-takkar
Copy link
Contributor Author

Past unconfirmed bookings will not show any actions. Want to confirm if that is fine?

Yes as booking is not confirmed

@Udit-takkar Udit-takkar marked this pull request as ready for review July 22, 2025 15:27
@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Jul 22, 2025
@Udit-takkar
Copy link
Contributor Author

It was getting difficult writing unit tests for BookingListItem so i just refactored the code and created separate file for handling booking actions

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: 1

🧹 Nitpick comments (1)
apps/web/components/booking/bookingActions.ts (1)

108-171: Consider extracting the reschedule disabled logic to reduce duplication.

The disabled condition for both reschedule actions (lines 126-128 and 134-136) is identical. Consider extracting it to a variable for better maintainability.

 export function getEditEventActions(context: BookingActionContext): ActionType[] {
   const {
     booking,
     isBookingInPast,
     isDisabledRescheduling,
     isBookingFromRoutingForm,
     getSeatReferenceUid,
     t,
   } = context;
 
+  const isRescheduleDisabled = 
+    (isBookingInPast && !booking.eventType.allowReschedulingPastBookings) || isDisabledRescheduling;
+
   const actions: (ActionType | null)[] = [
     {
       id: "reschedule",
       icon: "clock",
       label: t("reschedule_booking"),
       href: `/reschedule/${booking.uid}${
         booking.seatsReferences.length ? `?seatReferenceUid=${getSeatReferenceUid()}` : ""
       }`,
-      disabled:
-        (isBookingInPast && !booking.eventType.allowReschedulingPastBookings) || isDisabledRescheduling,
+      disabled: isRescheduleDisabled,
     },
     {
       id: "reschedule_request",
       icon: "send",
       iconClassName: "rotate-45 w-[16px] -translate-x-0.5 ",
       label: t("send_reschedule_request"),
-      disabled:
-        (isBookingInPast && !booking.eventType.allowReschedulingPastBookings) || isDisabledRescheduling,
+      disabled: isRescheduleDisabled,
     },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 137acb7 and 894991c.

📒 Files selected for processing (7)
  • apps/web/components/booking/BookingListItem.tsx (7 hunks)
  • apps/web/components/booking/bookingActions.test.ts (1 hunks)
  • apps/web/components/booking/bookingActions.ts (1 hunks)
  • apps/web/playwright/booking-pages.e2e.ts (3 hunks)
  • apps/web/playwright/bookings-list.e2e.ts (1 hunks)
  • apps/web/playwright/dynamic-booking-pages.e2e.ts (2 hunks)
  • apps/web/playwright/reschedule.e2e.ts (3 hunks)
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/playwright/dynamic-booking-pages.e2e.ts
  • apps/web/playwright/reschedule.e2e.ts
  • apps/web/playwright/booking-pages.e2e.ts
  • apps/web/playwright/bookings-list.e2e.ts
  • apps/web/components/booking/bookingActions.test.ts
  • apps/web/components/booking/bookingActions.ts
🧬 Code Graph Analysis (1)
apps/web/components/booking/bookingActions.test.ts (2)
apps/web/components/booking/bookingActions.ts (11)
  • BookingActionContext (6-34)
  • getPendingActions (36-62)
  • getCancelEventAction (64-87)
  • getVideoOptionsActions (89-106)
  • getEditEventActions (108-171)
  • getAfterEventActions (173-196)
  • shouldShowPendingActions (198-201)
  • shouldShowEditActions (203-206)
  • shouldShowRecurringCancelAction (208-211)
  • isActionDisabled (213-231)
  • getActionLabel (233-252)
packages/platform/libraries/index.ts (1)
  • SchedulingType (30-30)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/booking/BookingListItem.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code. Functions like .add, .diff, .isBefore, and .isAfter are slow, especially in timezone mode. Prefer .utc() for better performance. Where possible, replace with native Date and direct .valueOf() comparisons for faster execution. Recommend using native methods or Day.js .utc() consistently in hot paths like loops.

Files:

  • apps/web/playwright/dynamic-booking-pages.e2e.ts
  • apps/web/playwright/reschedule.e2e.ts
  • apps/web/playwright/booking-pages.e2e.ts
  • apps/web/playwright/bookings-list.e2e.ts
  • apps/web/components/booking/bookingActions.test.ts
  • apps/web/components/booking/bookingActions.ts
🧬 Code Graph Analysis (1)
apps/web/components/booking/bookingActions.test.ts (2)
apps/web/components/booking/bookingActions.ts (11)
  • BookingActionContext (6-34)
  • getPendingActions (36-62)
  • getCancelEventAction (64-87)
  • getVideoOptionsActions (89-106)
  • getEditEventActions (108-171)
  • getAfterEventActions (173-196)
  • shouldShowPendingActions (198-201)
  • shouldShowEditActions (203-206)
  • shouldShowRecurringCancelAction (208-211)
  • isActionDisabled (213-231)
  • getActionLabel (233-252)
packages/platform/libraries/index.ts (1)
  • SchedulingType (30-30)
⏰ 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). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Security Check
🔇 Additional comments (22)
apps/web/playwright/dynamic-booking-pages.e2e.ts (2)

39-41: Test correctly updated for dropdown UI pattern.

The test properly reflects the UI refactor where booking actions are now accessed through a dropdown menu. The added step to click the ellipsis menu button before selecting reschedule is correct and maintains the test's effectiveness.


59-61: Consistent test update for cancel action.

The cancel test follows the same pattern as reschedule, correctly implementing the dropdown interaction pattern. This maintains consistency across all booking action tests.

apps/web/playwright/bookings-list.e2e.ts (1)

366-369: Test improvement for dropdown interaction verification.

The test now properly opens the dropdown menu before verifying the cancel option is visible, making it more accurate and specific to the actual user interaction pattern. This is an improvement over the previous approach of just checking for text presence on the page.

apps/web/playwright/booking-pages.e2e.ts (3)

158-159: Reschedule test properly updated for dropdown UI.

The test correctly implements the new interaction pattern by opening the dropdown menu before selecting the reschedule option, maintaining the test's effectiveness while adapting to the UI refactor.


209-211: Cancel test consistently updated with dropdown pattern.

The test properly implements the dropdown interaction pattern for cancellation, maintaining consistency with other booking action tests and ensuring compatibility with the refactored UI.


244-247: Additional cancel test updated for dropdown consistency.

This test follows the same dropdown interaction pattern as other booking action tests, ensuring all cancellation scenarios work correctly with the new UI structure.

apps/web/playwright/reschedule.e2e.ts (4)

36-37: Reschedule request test updated for dropdown UI.

The test correctly opens the dropdown menu before selecting the reschedule request option, maintaining test functionality while adapting to the refactored UI structure.


79-80: Past booking reschedule test adapted for dropdown menu.

The test properly opens the dropdown to verify reschedule options are available for past bookings when explicitly allowed, ensuring the test works with the new UI pattern.


96-97: Dropdown interaction added for disabled state verification.

The test correctly opens the dropdown menu to verify the state of reschedule options after disabling rescheduling for past bookings, ensuring proper testing of the disabled functionality.


99-103: Improved UX behavior: disabled actions remain visible.

The test now correctly verifies that reschedule options are visible but disabled when rescheduling past bookings is disallowed, rather than being hidden entirely. This provides better user experience by showing available actions even when they're not currently usable.

apps/web/components/booking/bookingActions.test.ts (6)

19-130: Well-structured test setup with comprehensive mock context.

The test setup provides a robust foundation with a realistic mock context that covers all required properties. The overrides pattern allows for flexible test variations while maintaining good defaults. The mock translation function is appropriately simple for testing purposes.


133-173: Comprehensive testing of pending actions logic.

The tests thoroughly cover the getPendingActions function, verifying correct action generation for pending vs non-pending bookings, proper labeling for recurring scenarios, and appropriate action properties. Good test coverage ensures the centralized logic works correctly.


175-218: Thorough testing of cancel action logic.

The tests properly verify the getCancelEventAction function across various scenarios, including disabled states, recurring bookings, and edge cases like past pending bookings. The URL construction and label logic are well tested.


220-259: Video options actions properly tested.

The tests effectively verify the getVideoOptionsActions function, covering the various conditions that enable/disable video-related actions like recordings and session details. The logic for Cal video locations and booking states is well tested.


261-323: Edit event actions comprehensively tested.

The tests thoroughly verify the getEditEventActions function, covering all conditional logic for actions like reroute (routing forms), reassign (round robin), and guest management. The disabled state handling for rescheduling restrictions is properly tested.


325-462: Complete test coverage for all helper functions.

The remaining tests provide excellent coverage for after-event actions, boolean helper functions, disabled state logic, and label generation. The tests for no-show handling, charge card actions, and various conditional display logic ensure the helper functions work correctly across all booking scenarios.

apps/web/components/booking/bookingActions.ts (6)

36-62: LGTM! Well-structured pending action generation.

The function correctly implements the business logic for pending bookings, with appropriate conditional logic for payment-enabled bookings.


64-87: LGTM! Comprehensive cancel action implementation.

The function properly handles all edge cases including recurring bookings, seat references, and past pending bookings.


89-106: LGTM! Clear video action conditions.

The function correctly differentiates between recordings (requiring isRecorded flag) and session details availability.


173-196: LGTM! Good reuse of video actions.

The function properly combines video actions with post-event specific actions, with appropriate conditional logic for payment holds.


198-211: LGTM! Clear visibility condition functions.

These helper functions provide clean, testable logic for determining action visibility.


233-252: LGTM! Well-organized label generation.

The function provides consistent, context-aware labels for all action types.

@hariombalhara hariombalhara merged commit 16a7bb7 into main Jul 23, 2025
41 of 42 checks passed
@hariombalhara hariombalhara deleted the refactor/booking-list-item branch July 23, 2025 09:32
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 enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e 💻 refactor ui area: UI, frontend, button, form, input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor booking list item UI
4 participants