-
Notifications
You must be signed in to change notification settings - Fork 515
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
Minor enhancements #9631
Minor enhancements #9631
Conversation
WalkthroughThis pull request introduces several modifications to enhance the user interface and functionality of various components. Key changes include the addition of a Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/pages/Encounters/EncounterList.tsx (1)
Line range hint
192-236
: Consider separating encounter fetching logic.The component currently handles both list and single encounter fetching. Consider extracting this logic into a custom hook (e.g.,
useEncounterQueries
) to:
- Improve code organization
- Make the logic reusable
- Simplify testing
Example structure:
// hooks/useEncounterQueries.ts export function useEncounterQueries({ facilityId, encounter_id, filters, propEncounters, }: { facilityId?: string; encounter_id?: string; filters: any; propEncounters?: Encounter[]; }) { const listQuery = useQuery<PaginatedResponse<Encounter>>({...}); const singleQuery = useQuery<Encounter>({...}); return { encounters: propEncounters || listQuery.data?.results || (singleQuery.data ? [singleQuery.data] : []), isLoading: listQuery.isLoading || singleQuery.isLoading, // ... other relevant data }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/Encounters/EncounterList.tsx
(2 hunks)
🔇 Additional comments (2)
src/pages/Encounters/EncounterList.tsx (2)
192-193
: LGTM! Good query optimization.
The condition effectively prevents unnecessary API calls by only enabling the encounters query when no encounters are provided via props and no specific encounter is being queried.
233-236
: Consider data structure consistency when mixing sources.
The current implementation mixes data from different sources (props, paginated query, single query) which could lead to inconsistencies in pagination handling. Consider normalizing the data structure or handling pagination separately for each case.
Run this script to check for pagination handling across the codebase:
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Common/UserSelector.tsx
(3 hunks)src/pages/FacilityOrganization/components/LinkFacilityUserSheet.tsx
(3 hunks)src/pages/Organization/components/LinkUserSheet.tsx
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/pages/Organization/components/LinkUserSheet.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/pages/FacilityOrganization/components/LinkFacilityUserSheet.tsx
🔇 Additional comments (5)
src/components/Common/UserSelector.tsx (5)
36-36
: LGTM: Good addition of configurable styling propThe optional
popoverClassName
prop enhances component reusability by allowing custom styling from parent components.
44-44
: LGTM: Clean prop implementationProper destructuring of the new prop in the component parameters.
60-60
: LGTM: Modal behavior addresses scroll issuesSetting
modal={true}
implements the suggested fix for the scroll in sheet issue, improving mobile experience.
61-61
: LGTM: Flexible trigger stylingThe
popoverClassName
is correctly applied to the trigger, allowing width customization as needed.
Line range hint
60-86
: Great mobile responsiveness improvementsThe combined changes effectively enhance mobile UX through:
- Modal behavior preventing scroll issues
- Responsive width handling
- Proper positioning with offset
These improvements align well with the PR objectives for better mobile responsiveness.
<PopoverContent | ||
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]" | ||
align="start" | ||
sideOffset={4} | ||
> |
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.
Fix CSS variable syntax in max-width
The responsive width adjustments are good, but there's a syntax error in the CSS variable usage:
Apply this fix:
- className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]"
+ className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[var(--radix-popover-content-available-width)]"
The max-width
CSS variable needs to be wrapped in var()
for proper functionality.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<PopoverContent | |
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]" | |
align="start" | |
sideOffset={4} | |
> | |
<PopoverContent | |
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[var(--radix-popover-content-available-width)]" | |
align="start" | |
sideOffset={4} | |
> |
@Jacobjeevan Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
UI Improvements
UserSelector
component with improved modal functionality and customizable styling.LinkFacilityUserSheet
component with refined dropdown positioning and layout adjustments.Functionality Enhancements
EncounterList
component for better handling of specific encounters.Code Refactoring
EncounterFilesTab
component.