Skip to content

feat: Visual Indicator for AM/PM ( with respect to the phases of the day )#28801

Open
vishalkumargeed wants to merge 2 commits intocalcom:mainfrom
vishalkumargeed:VisualIndicator
Open

feat: Visual Indicator for AM/PM ( with respect to the phases of the day )#28801
vishalkumargeed wants to merge 2 commits intocalcom:mainfrom
vishalkumargeed:VisualIndicator

Conversation

@vishalkumargeed
Copy link
Copy Markdown

What does this PR do?

Here is the detailed walkthrough this PR

Note : I checked the open PR and with resepect to that I guess this is most visual indicator and possibly the correct UI enhancement , as I'm not adding any kind of icon , just adding a small color div at the bottom of the button component

  1. Rendered the color with respect to these phases of time (No need to convert to 24hr format ) as it’s being handled by the day.js part computedDateWithUsersTimezone.format(timeFormat)

Result

Without “Overlay my calender”

image image

With “Overlay my calender”

image image

Other Possibilities

1. Placing the color bar just at the bottom of the button component and has a fixed size of h-[2px] this looks even more good but but but

<div className="pointer-events-none absolute right-0 bottom-0 left-0 flex justify-center" aria-hidden="true"> <span className={classNames("block h-[2px] rounded-t-full", bottomBarColor)} style={{ width: ${Math.max(bottomBarWidthCh ?? 0, formattedTime.length)}ch }} /> </div>

Uneven height of the color component . Pattern : the even sequence button (2,4,6..) height decrease and for odd sequence of button the height is maintained
image

Similarly goes with when switched to column view
image

Uneven height of the color component . Pattern : the even sequence button (2,4,6..) height decrease and for odd sequence of button the height is maintained
For this the height is reduced for odd number of sequence button (if you carefully observe ! )

2. Uses more good approach by placing the color bar just above the bottom of the button and increase the bar thickness (height)

  • Note :
    • h-1 is the ideal height of the color bar as if we reduce the height to h-0.5 it will act same as the Possibility-1
    • Same goes with the bottom-0 not bottom-px as px will create a spacing of 1px which looks somewhat appered (which In my opinion doesn’t align with the UI theme )
image image image image

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • 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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?


Manual

  1. Open a booking page that uses the default time-slot list UI (not the redesigned detailed calendar view).
  2. In that you can see the visual feedback with respect to the am and pm
  3. Morning: 6 AM to 11:59 AM , yellow color
  4. Afternoon: 12 PM to 5:59 PM, deeper orange to represent the afternoon/evening sun'
  5. defaulting to sky color which is at night when there is moon

Checklist

  • I have read the contributing guide.
  • My code follows the style guidelines of this project.
  • [x]I have checked that my changes generate no new blocking warnings.
  • My PR is scoped and reasonably small.

@github-actions github-actions bot added consumer High priority Created by Linear-GitHub Sync ✨ feature New feature or request labels Apr 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 57711b24-b2c1-4487-954d-6b5d30a9b2af

📥 Commits

Reviewing files that changed from the base of the PR and between c8acbdf and 571c2a7.

📒 Files selected for processing (1)
  • apps/web/modules/bookings/components/AvailableTimes.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/modules/bookings/components/AvailableTimes.tsx

📝 Walkthrough

Walkthrough

The change extends SlotItemProps with optional bottomBarWidthCh and threads it into SlotItem. Time rendering now uses computedDateWithUsersTimezone.format(timeFormat) and places the result in a tabular-nums span. A bottom-bar color is chosen from the slot hour (morning → bg-yellow-400, afternoon/evening → bg-orange-400, default bg-sky-500). The Button gains relative and overflow-hidden, and an absolutely positioned bottom bar uses Math.max(bottomBarWidthCh ?? 0, formattedTime.length)ch for width. AvailableTimes computes bottomBarWidthCh via useMemo by reducing non-away slots and passes it to each SlotItem.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main feature: adding a visual indicator for AM/PM phases with color-coded bars on time slots.
Description check ✅ Passed The description provides detailed context about the changes, references linked issues, includes testing instructions and screenshots demonstrating the feature.
Linked Issues check ✅ Passed The PR implementation meets the linked issue #28086 requirement by adding visual indicators (colored bars) to distinguish AM/PM time slots, reducing booking confusion.
Out of Scope Changes check ✅ Passed All changes are focused on implementing the visual AM/PM indicator in the AvailableTimes component; no out-of-scope modifications detected.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

🧹 Nitpick comments (1)
apps/web/modules/bookings/components/AvailableTimes.tsx (1)

116-123: Consider computing slot display metadata once in AvailableTimes and passing it down.

Right now timezone formatting runs in both parent (for width) and child (for label/hour). Precomputing formattedTime (+ slotHour) once per slot would reduce duplicate work and simplify SlotItem.

Also applies to: 305-313

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/modules/bookings/components/AvailableTimes.tsx` around lines 116 -
123, Compute display metadata once inside AvailableTimes by creating shared
values (e.g., computedDateWithUsersTimezone, formattedTime, and slotHour) for
each slot and pass them into SlotItem as props; update the mapping where slots
are rendered (the code using computedDateWithUsersTimezone.format(timeFormat)
and any other timezone-based calculations in lines ~305-313) to use these
precomputed values instead of recomputing in both the parent and SlotItem, and
remove duplicate timezone/format logic from SlotItem so it solely uses the
provided formattedTime and slotHour props.
🤖 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/web/modules/bookings/components/AvailableTimes.tsx`:
- Around line 142-155: The color-selection block currently contains "what"
comments that restate behavior; remove the redundant comments around the
slotHour checks and assignments (the block using
computedDateWithUsersTimezone.hour() and bottomBarColor) and keep only brief
rationale comments if needed (e.g., explaining why specific color choices map to
time-of-day) so the code reads clearly without noise.

---

Nitpick comments:
In `@apps/web/modules/bookings/components/AvailableTimes.tsx`:
- Around line 116-123: Compute display metadata once inside AvailableTimes by
creating shared values (e.g., computedDateWithUsersTimezone, formattedTime, and
slotHour) for each slot and pass them into SlotItem as props; update the mapping
where slots are rendered (the code using
computedDateWithUsersTimezone.format(timeFormat) and any other timezone-based
calculations in lines ~305-313) to use these precomputed values instead of
recomputing in both the parent and SlotItem, and remove duplicate
timezone/format logic from SlotItem so it solely uses the provided formattedTime
and slotHour props.
🪄 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: d492c081-3935-4ed3-bcd0-1e318e00c3d8

📥 Commits

Reviewing files that changed from the base of the PR and between f3e07c5 and c8acbdf.

📒 Files selected for processing (1)
  • apps/web/modules/bookings/components/AvailableTimes.tsx

@vishalkumargeed
Copy link
Copy Markdown
Author

With the slots or additional information shown to the user with the colors they can somewhat subconciously identify the slots

image

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

Labels

consumer ✨ feature New feature or request High priority Created by Linear-GitHub Sync size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearer visual indicators of which time slots are AM and which are PM

1 participant