Skip to content

Fix slot selecting issue on mobile#154

Merged
zachchong merged 3 commits intomasterfrom
fix/mobile-frontend-issue
Jan 10, 2026
Merged

Fix slot selecting issue on mobile#154
zachchong merged 3 commits intomasterfrom
fix/mobile-frontend-issue

Conversation

@zachchong
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses slot selection issues on mobile devices by adjusting the longPressThreshold parameter and modifying CSS styling to improve clickable areas in the calendar component.

Changes:

  • Added longPressThreshold prop set to 50ms to improve mobile touch responsiveness
  • Introduced a handleSelectSlot wrapper function to handle slot selection events
  • Modified CSS styling to increase clickable areas in month view calendar cells

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
booking-creation-time-slot-selector.tsx Added longPressThreshold={50} prop to BookingCalendar component
booking-calendar.tsx Extracted longPressThreshold and onSelectSlot props, added wrapper function for slot selection
booking-calendar.module.scss Adjusted padding and minimum height for calendar date cells to improve clickability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

:global(.rbc-month-view .rbc-date-cell) {
padding: 0;
min-height: 50px; /* Adjust height based on your design */
padding-bottom: 10px; /* Ensures space below existing events is clickable */
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

Removing padding: 0 and replacing it with padding-bottom: 10px will also add default padding to other sides of the element. If the intent was to only have bottom padding, consider using padding: 0 0 10px 0 to be more explicit and avoid unintended padding on other sides.

Suggested change
padding-bottom: 10px; /* Ensures space below existing events is clickable */
padding: 0 0 10px 0; /* Ensures space below existing events is clickable */

Copilot uses AI. Check for mistakes.
const { onRepeatSlot, onSelectSlot, longPressThreshold, ...calendarProps } =
props;

const handleSelectSlot = (slotInfo: any) => {
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The parameter type should be explicitly typed instead of using any. Based on the react-big-calendar library, this should be typed as SlotInfo which includes properties like start, end, slots, and action.

Copilot uses AI. Check for mistakes.
Comment on lines +93 to +94
onSelectSlot={handleSelectSlot}
{...calendarProps}
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The handleSelectSlot wrapper function doesn't add any meaningful logic - it only conditionally calls onSelectSlot if it exists. However, spreading calendarProps after explicitly setting onSelectSlot on line 93 means that if onSelectSlot exists in calendarProps, it will override this wrapper. This could bypass the wrapper entirely and may cause unexpected behavior. Consider either removing the wrapper if it's unnecessary, or ensure onSelectSlot is excluded from calendarProps when spreading.

Copilot uses AI. Check for mistakes.
height: 100%;
padding: 0.25rem 0.5rem;
text-align: left;
padding-bottom: 150px;
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The magic number 150px for padding-bottom is unusually large and lacks explanation. This seems excessive for ensuring clickable space and could cause significant layout issues. Please either add a comment explaining why 150px is needed, or verify this value is correct. If the goal is to make space clickable, a more reasonable value like 10-20px would typically suffice.

Suggested change
padding-bottom: 150px;
padding-bottom: 10px; /* Provide extra clickable space without distorting layout */

Copilot uses AI. Check for mistakes.
onDrillDown={onDrillDown}
onRepeatSlot={onRepeatSlot}
selectable
longPressThreshold={50}
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The magic number 50 for longPressThreshold is duplicated between this file (line 226) and the default value in booking-calendar.tsx (line 67). Consider extracting this to a named constant to ensure consistency and make it easier to adjust this value across the codebase if needed.

Copilot uses AI. Check for mistakes.
@zachchong zachchong merged commit b5e3a69 into master Jan 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants