Skip to content
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

Merged
merged 6 commits into from
Jan 2, 2025
Merged

Minor enhancements #9631

merged 6 commits into from
Jan 2, 2025

Conversation

Jacobjeevan
Copy link
Contributor

@Jacobjeevan Jacobjeevan commented Dec 31, 2024

Proposed Changes

  • UserSelector mobile responsiveness
  • Hide Tab Selector/Filter on Files

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • UI Improvements

    • Enhanced UserSelector component with improved modal functionality and customizable styling.
    • Updated LinkFacilityUserSheet component with refined dropdown positioning and layout adjustments.
  • Functionality Enhancements

    • Improved encounter retrieval logic in EncounterList component for better handling of specific encounters.
  • Code Refactoring

    • Adjusted tab management in EncounterFilesTab component.

@Jacobjeevan Jacobjeevan requested a review from a team as a code owner December 31, 2024 13:38
Copy link
Contributor

coderabbitai bot commented Dec 31, 2024

Walkthrough

This pull request introduces several modifications to enhance the user interface and functionality of various components. Key changes include the addition of a popoverClassName property to the UserSelector component, adjustments to the Popover behavior, and updates to the query handling in the EncounterList component. Additionally, the structure of the EncounterFilesTab has been modified to change tab management, and styling improvements have been made to the LinkFacilityUserSheet component.

Changes

File Change Summary
src/components/Common/UserSelector.tsx - Added popoverClassName to Props interface
- Set modal property to true for Popover
- Updated PopoverTrigger to use popoverClassName
- Enhanced PopoverContent with new width and alignment properties
src/pages/Encounters/EncounterList.tsx - Removed encounter_id from query parameters
- Added a new query to fetch a specific encounter based on encounter_id
- Updated enabled condition for the first query
src/pages/Encounters/tabs/EncounterFilesTab.tsx - Removed TabsList and TabsTrigger imports and usage, indicating a change in tab management
src/pages/FacilityOrganization/components/LinkFacilityUserSheet.tsx - Enhanced SheetContent with additional class names
- Updated SelectContent with positioning and collision avoidance properties
src/pages/Organization/components/LinkUserSheet.tsx - Added popoverClassName property to UserSelector component

Possibly related PRs

Suggested labels

tested, P1

Suggested reviewers

  • rithviknishad
  • nihal467

Poem

🐰 In a world of code where rabbits play,
We style the popovers in a whimsical way.
With tabs that twinkle and selectors that shine,
Hopping through changes, all is divine!
Let's celebrate the updates, oh what a delight! 🎉


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Dec 31, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 1826231
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6776510baa0cb9000877e2a1
😎 Deploy Preview https://deploy-preview-9631--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
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)
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:

  1. Improve code organization
  2. Make the logic reusable
  3. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 80fe44f and b00fbbf.

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

src/pages/Encounters/EncounterList.tsx Show resolved Hide resolved
src/components/Common/UserSelector.tsx Outdated Show resolved Hide resolved
Copy link
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6584282 and 1826231.

📒 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 prop

The optional popoverClassName prop enhances component reusability by allowing custom styling from parent components.


44-44: LGTM: Clean prop implementation

Proper destructuring of the new prop in the component parameters.


60-60: LGTM: Modal behavior addresses scroll issues

Setting modal={true} implements the suggested fix for the scroll in sheet issue, improving mobile experience.


61-61: LGTM: Flexible trigger styling

The popoverClassName is correctly applied to the trigger, allowing width customization as needed.


Line range hint 60-86: Great mobile responsiveness improvements

The combined changes effectively enhance mobile UX through:

  1. Modal behavior preventing scroll issues
  2. Responsive width handling
  3. Proper positioning with offset

These improvements align well with the PR objectives for better mobile responsiveness.

Comment on lines +82 to +86
<PopoverContent
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]"
align="start"
sideOffset={4}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
<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}
>

@bodhish bodhish merged commit b57e25c into ohcnetwork:develop Jan 2, 2025
20 checks passed
Copy link

github-actions bot commented Jan 2, 2025

@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! 🙌

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.

3 participants