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

Fixed the misalignments in the mobile view of /encounter/encounterId/updates page #9782

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

Utkarsh-Anandani
Copy link

@Utkarsh-Anandani Utkarsh-Anandani commented Jan 6, 2025

Proposed Changes

Before
image

After
image

@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

  • Style

    • Updated layout and styling of the patient information card.
    • Adjusted padding and spacing of badge containers.
    • Modified grid and container alignments for improved visual presentation.
    • Enhanced layout of the page title component for better breadcrumb handling.
    • Updated class names for improved layout dynamics.
    • Implemented responsive design for plot display based on screen size.
    • Introduced horizontal scrolling for the tabs list component.
  • New Features

    • Added new properties to the PageTitle component for enhanced breadcrumb functionality.
    • Integrated responsive column display for plots based on screen size.

@Utkarsh-Anandani Utkarsh-Anandani requested a review from a team as a code owner January 6, 2025 08:29
Copy link
Contributor

coderabbitai bot commented Jan 6, 2025

Walkthrough

The pull request modifies the PatientInfoCard.tsx, PageTitle.tsx, and EncounterPlotsTab.tsx components, focusing on layout and styling adjustments as well as enhancements to properties. In PatientInfoCard.tsx, changes include increased top padding, adjustments to badge container spacing and alignment, and updates to grid container spacing. In PageTitle.tsx, new properties were added to the PageTitleProps interface to improve breadcrumb functionality, along with a minor layout adjustment. The EncounterPlotsTab.tsx introduces responsive design by implementing a hook for dynamic column adjustments based on screen size.

Changes

File Change Summary
src/components/Patient/PatientInfoCard.tsx - Increased top padding from pt-2 to pt-4
- Changed badge container justification from justify-evenly to justify-items-start
- Added gap-5 to badge container
- Removed ml-3 from patient name display
- Updated grid container with mt-2 and px-2
src/components/Common/PageTitle.tsx - Added new properties to PageTitleProps: hideBack, backUrl, hideTitleOnPage, onBackClick
- Removed items-center class from flex container
src/pages/Encounters/tabs/EncounterPlotsTab.tsx - Imported useBreakpoints hook for responsive column display
- Updated gridCols in ObservationVisualizer to use dynamic plotColumns
- Wrapped TabsList in a div for horizontal scrolling

Assessment against linked issues

Objective Addressed Explanation
Improve mobile view design [#9763]

Possibly related PRs

Suggested labels

needs review, needs testing

Suggested reviewers

  • rithviknishad
  • bodhish

Poem

🐰 In the garden of care, layouts bloom bright,
Padding and spacing, a wonderful sight,
Badges now dance with a gap that's just right,
Page titles enhanced, guiding with light,
A rabbit's delight in each pixel's flight! 🌼


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5b3e228 and 36c45e7.

📒 Files selected for processing (1)
  • src/components/Patient/PatientInfoCard.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Patient/PatientInfoCard.tsx

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 Jan 6, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 36c45e7
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/677f7b6518cbfd0008b2ebe5
😎 Deploy Preview https://deploy-preview-9782--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: 0

🧹 Nitpick comments (2)
src/components/Patient/PatientInfoCard.tsx (2)

51-51: Double-check alignment approach
Centering this block might conflict with other design rules, especially on larger screens. Confirm that this won’t misalign elements with future additions.


74-74: Consider a responsive grid layout
Currently, this is locked into three columns on all screen sizes. Using responsive classes like grid-cols-1 md:grid-cols-3 could improve readability on smaller screens.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4318ffd and f20eb02.

📒 Files selected for processing (1)
  • src/components/Patient/PatientInfoCard.tsx (2 hunks)
🔇 Additional comments (5)
src/components/Patient/PatientInfoCard.tsx (5)

42-42: Increase in top padding appears intentional
Seems like a straightforward design improvement to provide more vertical spacing.


45-45: justify-items-start has no effect on flex containers
If the goal is to align items to the left in a flex parent, consider justify-start instead.


53-53: Visibility restricted to smaller screens
This element is now hidden on large viewports. Verify that the redesign calls for this layout shift.


57-57: Minor margin tweak
No issues here; it’s a small stylistic enhancement.


64-64: Confirm that justify-normal is supported
Tailwind doesn’t typically include a “justify-normal” utility class for flex. Verify that this is valid in your Tailwind configuration; otherwise, consider justify-start.

@bodhish
Copy link
Member

bodhish commented Jan 6, 2025

Why not move the page heading also to the left
image

@rithviknishad
Copy link
Member

update the pr's title to something meaningful btw

@Utkarsh-Anandani
Copy link
Author

Why not move the page heading also to the left image

Did the required changes

@Utkarsh-Anandani Utkarsh-Anandani changed the title Issues/#9763/redesigning patient info card componenet Fixed the misalignments in the mobile view of /encounter/encounterId/updates page Jan 6, 2025
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: 0

🧹 Nitpick comments (2)
src/components/Common/PageTitle.tsx (2)

Line range hint 19-22: Add JSDoc or property comments for clarity
The newly introduced props (hideBack, backUrl, hideTitleOnPage, and onBackClick) expand the functionality of breadcrumbs, but it's helpful to add brief comments or JSDoc annotations describing each prop's intended usage. This will improve discoverability and maintainability for future contributors.


Line range hint 37-40: Ensure consistent default parameter ordering
The new props are destructured in the middle of the parameter list. It's good practice to keep related parameters together (e.g., group all breadcrumb-related parameters). This helps readability, especially when the component grows more complex.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f20eb02 and dbcfc7a.

📒 Files selected for processing (1)
  • src/components/Common/PageTitle.tsx (1 hunks)
🔇 Additional comments (1)
src/components/Common/PageTitle.tsx (1)

69-69: Confirm removal of “items-center” or any other alignment classes
You removed the items-center class from the flex container. Verify once more that the new layout matches the intended design. Removing vertical alignment might shift elements in unexpected ways if other spacing/positioning isn’t adjusted.

@vinutv
Copy link
Member

vinutv commented Jan 8, 2025

Screenshot 2025-01-09 at 12 26 12 AM

Plots tab cards are broken. We can switch to a single-column layout for smaller screens.

@Utkarsh-Anandani
Copy link
Author

Screenshot 2025-01-09 at 12 26 12 AM Plots tab cards are broken. We can switch to a single-column layout for smaller screens.

Already being worked upon in a different PR

Screenshot 2025-01-09 at 12 28 25 AM The alignment and spacing on the profile card need to be fixed. Consider reducing the avatar size for smaller screens. Screenshot 2025-01-09 at 12 25 40 AM

Would definitely consider this..

@rithviknishad
Copy link
Member

@Utkarsh-Anandani combine the plots changes here itself and close the other one.

Copy link
Member

@vinutv vinutv left a comment

Choose a reason for hiding this comment

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

Screenshot 2025-01-09 at 12 28 25 AM

The alignment and spacing on the profile card need to be fixed. Consider reducing the avatar size for smaller screens.

Screenshot 2025-01-09 at 12 25 40 AM

…ng' into issues/ohcnetwork#9763/redesigning-PatientInfoCard-Componenet
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: 0

🧹 Nitpick comments (2)
src/pages/Encounters/tabs/EncounterPlotsTab.tsx (2)

50-58: Consider enhancing the scrollable tabs for better accessibility.

While the horizontal scroll implementation works, consider these accessibility improvements:

  1. Add visual indicators for scrollable content
  2. Ensure adequate touch target sizes for mobile users

Consider applying these changes:

-<div className="overflow-x-scroll w-full">
+<div className="overflow-x-auto w-full relative">
+  <div className="absolute bottom-0 left-0 right-0 h-1 bg-gradient-to-r from-transparent via-gray-200 to-transparent opacity-0 transition-opacity md:hidden peer-scroll-x:opacity-100" />
   <TabsList className="min-h-[48px]">
     {data.map((tab) => (
-      <TabsTrigger key={tab.id} value={tab.id}>
+      <TabsTrigger key={tab.id} value={tab.id} className="min-h-[44px] px-4">
         {tab.name}
       </TabsTrigger>
     ))}
   </TabsList>
 </div>

Line range hint 14-66: Well-structured responsive design implementation.

The mobile-first approach with breakpoint-based responsive design is a solid architectural choice. The implementation:

  • Handles mobile view constraints effectively
  • Maintains clean separation of concerns
  • Uses modern React patterns

Consider documenting these responsive design patterns in your team's style guide to maintain consistency across the application.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd2121c and 5b3e228.

📒 Files selected for processing (1)
  • src/pages/Encounters/tabs/EncounterPlotsTab.tsx (3 hunks)
🔇 Additional comments (2)
src/pages/Encounters/tabs/EncounterPlotsTab.tsx (2)

14-15: LGTM! Good implementation of responsive design.

The addition of useBreakpoints hook with a single column layout for mobile screens effectively addresses the layout issues mentioned in the PR discussion.

Also applies to: 26-26


66-66: Verify ObservationVisualizer's grid implementation.

The dynamic grid columns look good. Let's verify that the ObservationVisualizer component properly handles grid column changes.

✅ Verification successful

Grid implementation verified successfully

The ObservationVisualizer component properly handles dynamic grid columns through CSS Grid's repeat() and minmax() functions, ensuring responsive and flexible layouts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for ObservationVisualizer's grid implementation
ast-grep --pattern 'interface ObservationVisualizerProps {
  $$$
  gridCols?: $_
  $$$
}'

# Check for any grid-related styles or components
rg -l "grid.*cols" --type ts --type tsx

Length of output: 684


Script:

#!/bin/bash
# Check ObservationChart implementation
ast-grep --pattern 'const ObservationChart = ({ $$$, gridCols, $$$ }: ObservationVisualizerProps) => {
  $$$
}'

# Fix ripgrep command to handle tsx files
rg -l "grid.*cols" -t typescript -t tsx

# Check for grid-related styles
rg "grid.*cols" -t typescript -t tsx -C 2

Length of output: 269


Script:

#!/bin/bash
# Find component implementation with simpler pattern
ast-grep --pattern 'const ObservationChart = ($_) => {
  $$$
}'

# Search for grid-related code without type filters
rg "gridCols" -C 2

# Search for grid-related styles
rg "grid-cols|gridCols" -C 2

Length of output: 49227

@Jacobjeevan
Copy link
Contributor

image

You can adjust this and the next popup's (class history) align property (Popovercontent).

@Utkarsh-Anandani
Copy link
Author

@Jacobjeevan
The changes are only required for the alignment?

  • A little margin at left for 1st popup
  • Can change alignment to "start" or "end", but it doesn't looks good so no change for now

Does this works??

image
image

@github-actions github-actions bot added needs-triage question Further information is requested labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes required needs-triage question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The design of encounter/:encounterId/updates seems uneven in mobile view
5 participants