Skip to content

fix: Service point drop down responsive issue#16258

Open
NikhilA8606 wants to merge 5 commits intodevelopfrom
feat/service-point-broken
Open

fix: Service point drop down responsive issue#16258
NikhilA8606 wants to merge 5 commits intodevelopfrom
feat/service-point-broken

Conversation

@NikhilA8606
Copy link
Copy Markdown
Member

@NikhilA8606 NikhilA8606 commented Apr 2, 2026

Proposed Changes

Fixes #16257
image
Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

  • Improvements
    • Improved responsiveness of the assigned service points area: items now stack vertically on small screens and align horizontally on larger screens for clearer layout.
    • Updated chip sizing and wrapping so chips occupy full width on narrow viewports, switch to compact sizing on wider screens, and present a clearer "+ more" indicator when items overflow.

Copilot AI review requested due to automatic review settings April 2, 2026 08:57
@NikhilA8606 NikhilA8606 marked this pull request as ready for review April 2, 2026 08:57
@NikhilA8606 NikhilA8606 requested review from a team April 2, 2026 08:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Walkthrough

Updated ServicePointsDropDown responsive behavior: changed visible-chip breakpoints to sm: 2, added lg: 4; outer container remains w-full; chip wrapper stacks vertically on small screens (flex-col) and switches to horizontal at lg (lg:flex-row) with w-full; chips now use w-full default with sm:w-auto and truncation rules.

Changes

Cohort / File(s) Summary
Service Points Dropdown Responsive Updates
src/pages/Facility/queues/ServicePointsDropDown.tsx
Updated defaultServicePoints breakpoints from { default: 4, sm: 6 } to { default: 4, sm: 2, lg: 4 }. Removed sm:w-auto from the outer chip container (keeps w-full). Switched chips wrapper from single-row flex to flex-col with lg:flex-row and enforced w-full. Adjusted individual chip sizing from fixed w-48 to responsive w-full, max-w-full, overflow-hidden, with sm:w-auto/sm:max-w-xs, added shrink-0 to dot and min-w-0/truncate to labels.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: Service point drop down responsive issue' accurately describes the main change—fixing responsive layout issues in the service point dropdown component.
Description check ✅ Passed The PR description follows the template structure with 'Proposed Changes' section, issue reference (#16257), screenshot, and team tagging, though lacks specific bullet-point change details and several merge checklist items remain incomplete.
Linked Issues check ✅ Passed The code changes directly address the responsive layout problem reported in #16257 by adjusting breakpoint configurations, responsive chip sizing, and flex layouts to improve display across different screen sizes.
Out of Scope Changes check ✅ Passed All changes in ServicePointsDropDown.tsx are tightly focused on responsive styling adjustments for the service point chips display, with no unrelated 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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/service-point-broken

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

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor

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

Fixes a responsive layout issue in the Queue “Service Points” selector by adjusting how many assigned service points are shown at different breakpoints and changing the selected-service-point “pill” layout to better fit smaller viewports.

Changes:

  • Update breakpoint-based defaultServicePoints count (show fewer on sm, restore on lg).
  • Make the assigned service point pills stack vertically on smaller screens and switch back to a row on medium+ screens.
  • Adjust pill width to be full-width on very small screens and narrower on sm+.
Comments suppressed due to low confidence (1)

src/pages/Facility/queues/ServicePointsDropDown.tsx:58

  • The service point “pill” uses a flex layout with a fixed width at sm (sm:w-20), but the inner text span only has truncate and no min-w-0 / flex sizing. In flexbox, this often prevents the text from shrinking, so ellipsis won’t apply and the name can overflow the pill (reintroducing horizontal overflow on small/medium widths). Consider adding min-w-0 (and typically flex-1) to the text element (or an appropriate wrapper) so truncation reliably works within the constrained pill width.
                    className="flex sm:w-20 w-full items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap"
                  >
                    <div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full" />
                    <span className="text-sm text-gray-950 font-medium truncate">
                      {subQueue.name}

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/Facility/queues/ServicePointsDropDown.tsx (1)

38-54: ⚠️ Potential issue | 🟡 Minor

Add min-w-0 in the chip row to make truncation reliable.

With the new narrow chip widths, long names can still overflow in flex contexts. Add min-w-0 to the flex wrappers (Line 44 / Line 54) so truncate can actually shrink text.

Suggested fix
-          <div className="flex flex-col md:flex-row gap-1 items-center justify-center w-full">
+          <div className="flex min-w-0 w-full flex-col gap-1 items-center justify-center md:flex-row">
...
-                    className="flex sm:w-20 w-full items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap"
+                    className="flex min-w-0 w-full items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap sm:w-20"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` around lines 38 - 54,
The chip row flex containers in ServicePointsDropDown (the JSX that renders when
assignedServicePointIds.length > 0) need the CSS utility min-w-0 added to their
className so text with truncate can actually shrink; update the outer wrapper
(the div with className "flex flex-col md:flex-row gap-1 items-center
justify-center w-full") and the individual chip container (the div with
className "flex sm:w-20 w-full items-center justify-center gap-1 border ...") to
include min-w-0 to prevent overflow of long service point names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/Facility/queues/ServicePointsDropDown.tsx`:
- Line 21: The breakpoint map passed to useBreakpoints in ServicePointsDropDown
(variable defaultServicePoints) is non-monotonic ({ default: 4, sm: 2, lg: 4})
and causes small-screen overflow; update the map to follow mobile-first
progression (ensure default ≤ sm ≤ lg) — for example set default to 2 (e.g., {
default: 2, sm: 2, lg: 4 }) so chip sizing/gap behaves monotonically across
viewports.

---

Outside diff comments:
In `@src/pages/Facility/queues/ServicePointsDropDown.tsx`:
- Around line 38-54: The chip row flex containers in ServicePointsDropDown (the
JSX that renders when assignedServicePointIds.length > 0) need the CSS utility
min-w-0 added to their className so text with truncate can actually shrink;
update the outer wrapper (the div with className "flex flex-col md:flex-row
gap-1 items-center justify-center w-full") and the individual chip container
(the div with className "flex sm:w-20 w-full items-center justify-center gap-1
border ...") to include min-w-0 to prevent overflow of long service point names.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1fddf09b-0dd1-4428-a36c-72cd8237ad85

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac2709 and 15a12e9.

📒 Files selected for processing (1)
  • src/pages/Facility/queues/ServicePointsDropDown.tsx

const { assignedServicePointIds, allServicePoints, toggleServicePoint } =
useQueueServicePoints();
const defaultServicePoints = useBreakpoints({ default: 4, sm: 6 });
const defaultServicePoints = useBreakpoints({ default: 4, sm: 2, lg: 4 });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate useBreakpoints implementation:"
fd -i 'useBreakpoints.ts' src
fd -i 'useBreakpoints.tsx' src

echo
echo "Print hook implementation for semantic check:"
fd -i 'useBreakpoints.ts' src --exec sed -n '1,220p' {}
fd -i 'useBreakpoints.tsx' src --exec sed -n '1,220p' {}

echo
echo "Find breakpoint maps used across repo for consistency:"
rg -n --type=ts --type=tsx -C2 'useBreakpoints\(\s*\{'

Repository: ohcnetwork/care_fe

Length of output: 1315


🏁 Script executed:

cat -n src/pages/Facility/queues/ServicePointsDropDown.tsx | head -50

Repository: ohcnetwork/care_fe

Length of output: 2322


🏁 Script executed:

cat -n src/pages/Facility/queues/ServicePointsDropDown.tsx | tail -n +50

Repository: ohcnetwork/care_fe

Length of output: 3856


Breakpoint map violates mobile-first responsive design principle.

The pattern { default: 4, sm: 2, lg: 4 } is non-monotonic: smallest screens show 4 chips (each w-full) while medium screens show 2 chips (each w-20). This causes layout tension on small viewports where 4 full-width chips with gap-1 will wrap or overflow. Follow the mobile-first approach by ensuring the progression is monotonic: default should be ≤ smlg. Consider changing default to 2 to prevent small-screen overflow.

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

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` at line 21, The
breakpoint map passed to useBreakpoints in ServicePointsDropDown (variable
defaultServicePoints) is non-monotonic ({ default: 4, sm: 2, lg: 4}) and causes
small-screen overflow; update the map to follow mobile-first progression (ensure
default ≤ sm ≤ lg) — for example set default to 2 (e.g., { default: 2, sm: 2,
lg: 4 }) so chip sizing/gap behaves monotonically across viewports.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 3

Metric Count
Total Tests 246
✅ Passed 246
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #8207

@parvathyns-creator
Copy link
Copy Markdown

@nihal467 this looks fine

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 2, 2026

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf94454
Status: ✅  Deploy successful!
Preview URL: https://8e8fb98a.care-preview-a7w.pages.dev
Branch Preview URL: https://feat-service-point-broken.care-preview-a7w.pages.dev

View logs

Copy link
Copy Markdown
Member

@nihal467 nihal467 left a comment

Choose a reason for hiding this comment

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

Image
  • IN SMALLER SCREEN ITS BREAKING

@NikhilA8606
Copy link
Copy Markdown
Member Author

[ENG-11]

Copilot AI review requested due to automatic review settings April 8, 2026 07:25
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines 54 to 57
className="flex sm:w-auto w-full items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap"
>
<div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full" />
<span className="text-sm text-gray-950 font-medium truncate">
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

With sm:w-auto on the chip container, long service point names can expand the chip to its full content width, and the truncate on the inner <span> won’t reliably take effect in a flex row without min-w-0/a max-width constraint. This can reintroduce horizontal overflow on sm+ viewports. Consider adding a max width (responsive if needed) and min-w-0/overflow-hidden so truncation actually works for long names.

Suggested change
className="flex sm:w-auto w-full items-center justify-center gap-1 border border-gray-300 py-0.5 px-1.5 rounded-sm bg-gray-50 whitespace-nowrap"
>
<div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full" />
<span className="text-sm text-gray-950 font-medium truncate">
className="flex w-full max-w-full items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-sm border border-gray-300 bg-gray-50 px-1.5 py-0.5 sm:w-auto sm:max-w-xs"
>
<div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full shrink-0" />
<span className="min-w-0 truncate text-sm font-medium text-gray-950">

Copilot uses AI. Check for mistakes.
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

♻️ Duplicate comments (1)
src/pages/Facility/queues/ServicePointsDropDown.tsx (1)

21-21: ⚠️ Potential issue | 🟠 Major

Use a monotonic mobile-first breakpoint map.

At Line 21, { default: 4, sm: 2, lg: 4 } is non-monotonic and breaks mobile-first behavior (smallest screens render more chips than sm). This can reintroduce cramped/overflow-prone layouts on narrow devices.

💡 Proposed fix
-  const defaultServicePoints = useBreakpoints({ default: 4, sm: 2, lg: 4 });
+  const defaultServicePoints = useBreakpoints({ default: 2, sm: 2, lg: 4 });

As per coding guidelines "Use Tailwind's responsive classes and follow mobile-first approach."

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

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` at line 21, The
breakpoint map passed to useBreakpoints (const defaultServicePoints) is
non‑monotonic ({ default: 4, sm: 2, lg: 4}) which violates mobile‑first
behavior; change it to a monotonic, mobile‑first map (e.g., start with the
smallest count at default and increase or stay same at larger breakpoints) so
narrow screens render fewer chips—update the map used by defaultServicePoints in
ServicePointsDropDown.tsx accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/Facility/queues/ServicePointsDropDown.tsx`:
- Line 57: In the ServicePointsDropDown component, the span with className
"min-w-0 truncate text-sm font-medium text-gray-950" hides the full service
point name — add a title attribute that contains the full label so users can see
the complete name on hover; e.g., set title={servicePoint.label ||
servicePoint.name || option.label} (or the exact prop used where the list is
rendered) and consider mirroring it to aria-label for accessibility.

---

Duplicate comments:
In `@src/pages/Facility/queues/ServicePointsDropDown.tsx`:
- Line 21: The breakpoint map passed to useBreakpoints (const
defaultServicePoints) is non‑monotonic ({ default: 4, sm: 2, lg: 4}) which
violates mobile‑first behavior; change it to a monotonic, mobile‑first map
(e.g., start with the smallest count at default and increase or stay same at
larger breakpoints) so narrow screens render fewer chips—update the map used by
defaultServicePoints in ServicePointsDropDown.tsx accordingly.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fbef5e89-621d-4a62-a405-5b191e81d2c7

📥 Commits

Reviewing files that changed from the base of the PR and between 94ec06b and cf94454.

📒 Files selected for processing (1)
  • src/pages/Facility/queues/ServicePointsDropDown.tsx

<div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full" />
<span className="text-sm text-gray-950 font-medium truncate">
<div className="bg-primary-200 border border-primary-500 w-2 h-2 rounded-full shrink-0" />
<span className="min-w-0 truncate text-sm font-medium text-gray-950">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a tooltip for truncated service point names.

At Line 57, truncate hides full names without a fallback. Add a title so users can read the complete service point label.

💡 Proposed fix
-                    <span className="min-w-0 truncate text-sm font-medium text-gray-950">
+                    <span
+                      title={subQueue.name}
+                      className="min-w-0 truncate text-sm font-medium text-gray-950"
+                    >
                       {subQueue.name}
                     </span>

Based on learnings "When using text truncation (truncate class or similar) in the UI, always add a tooltip to show the full text."

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

In `@src/pages/Facility/queues/ServicePointsDropDown.tsx` at line 57, In the
ServicePointsDropDown component, the span with className "min-w-0 truncate
text-sm font-medium text-gray-950" hides the full service point name — add a
title attribute that contains the full label so users can see the complete name
on hover; e.g., set title={servicePoint.label || servicePoint.name ||
option.label} (or the exact prop used where the list is rendered) and consider
mirroring it to aria-label for accessibility.

Copy link
Copy Markdown
Member

@nihal467 nihal467 left a comment

Choose a reason for hiding this comment

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Responsive issues in service point drop down

4 participants