-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: Service point drop down responsive issue #16258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ export const ServicePointsDropDown = () => { | |
| const [isOpen, setIsOpen] = useState(false); | ||
| const { assignedServicePointIds, allServicePoints, toggleServicePoint } = | ||
| useQueueServicePoints(); | ||
| const defaultServicePoints = useBreakpoints({ default: 4, sm: 6 }); | ||
| const defaultServicePoints = useBreakpoints({ default: 4, sm: 2, lg: 4 }); | ||
|
|
||
| if (!allServicePoints) { | ||
| return ( | ||
|
|
@@ -35,13 +35,13 @@ export const ServicePointsDropDown = () => { | |
|
|
||
| return ( | ||
| <div className="flex"> | ||
| <div className="flex w-full sm:w-auto gap-1 rounded-r-none border border-r-0 border-gray-300 rounded-l-md p-1 bg-white"> | ||
| <div className="flex w-full gap-1 rounded-r-none border border-r-0 border-gray-300 rounded-l-md p-1 bg-white"> | ||
| {assignedServicePointIds.length === 0 ? ( | ||
| <span className="text-sm font-medium"> | ||
| {t("assign_service_points")} | ||
| </span> | ||
| ) : ( | ||
| <div className="flex gap-1 items-center justify-center"> | ||
| <div className="flex flex-col lg:flex-row gap-1 items-center justify-center w-full"> | ||
| {allServicePoints | ||
| .filter((subQueue) => | ||
| assignedServicePointIds.includes(subQueue.id), | ||
|
|
@@ -51,10 +51,10 @@ export const ServicePointsDropDown = () => { | |
| return ( | ||
| <div | ||
| key={subQueue.id} | ||
| className="flex w-48 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 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" /> | ||
| <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"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a tooltip for truncated service point names. At Line 57, 💡 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 |
||
| {subQueue.name} | ||
| </span> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ohcnetwork/care_fe
Length of output: 1315
🏁 Script executed:
cat -n src/pages/Facility/queues/ServicePointsDropDown.tsx | head -50Repository: ohcnetwork/care_fe
Length of output: 2322
🏁 Script executed:
cat -n src/pages/Facility/queues/ServicePointsDropDown.tsx | tail -n +50Repository: 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 (eachw-full) while medium screens show 2 chips (eachw-20). This causes layout tension on small viewports where 4 full-width chips withgap-1will wrap or overflow. Follow the mobile-first approach by ensuring the progression is monotonic:defaultshould be ≤sm≤lg. Consider changingdefaultto2to prevent small-screen overflow.🤖 Prompt for AI Agents