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 assets configuration page lacks mobile responsiveness #9467

Conversation

modamaan
Copy link
Contributor

@modamaan modamaan commented Dec 16, 2024

Proposed Changes

@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

  • New Features

    • Enhanced layout and styling for the HL7 Monitor component.
    • Conditional rendering of the Ventilator Patient Vitals Monitor based on asset type.
    • Improved responsiveness and layout for the HL7 Patient Vitals Monitor component.
  • Bug Fixes

    • Improved error handling for invalid IP addresses with updated messaging.
  • Chores

    • Updated import paths for the Card and Button components.
    • Replaced the Submit component with the Button component.
    • Adjusted styling for Card components with additional padding and margin.
    • Enhanced spacing and layout for non-waveform data in the Vitals Monitor component.

@modamaan modamaan requested a review from a team as a code owner December 16, 2024 19:42
Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Walkthrough

The pull request modifies the HL7Monitor.tsx, HL7PatientVitalsMonitor.tsx, and VentilatorPatientVitalsMonitor.tsx components, focusing on import statement updates, layout adjustments, and styling enhancements. The changes include updating the import paths for the Card and Button components, improving the responsiveness of the layout, and preparing for future modifications in the handleSubmit function. Additionally, the HL7PatientVitalsMonitor and VentilatorPatientVitalsMonitor components see adjustments in their JSX structures to enhance visual layout and spacing, ensuring better display of vital signs.

Changes

File Change Summary
src/components/Assets/AssetType/HL7Monitor.tsx - Updated Card and Button component import paths
- Modified styling classes for Card components
- Updated handleSubmit function with a comment about future middleware hostname change
- Added conditional rendering for VentilatorPatientVitalsMonitor
src/components/VitalsMonitor/HL7PatientVitalsMonitor.tsx - Enhanced layout with additional classes for responsiveness
- Adjusted styling for waveform data and VitalsNonWaveformContent components
src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.tsx - Enhanced layout with additional classes for responsiveness
- Adjusted styling for nested data display

Assessment against linked issues

Objective Addressed Explanation
Mobile Responsiveness [#9465] Changes made to enhance responsiveness, addressing the issue directly.

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan
  • bodhish

Poem

🐰 A rabbit's tale of code so bright,
Imports shifted left and right,
Cards styled with care and grace,
Mobile views finding their place,
Configuration dancing light! 🖥️


📜 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 0c193b9 and 50620d5.

📒 Files selected for processing (1)
  • src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.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 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 16, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 6e1cb0b
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6772f23a67d5db0008b01c13
😎 Deploy Preview https://deploy-preview-9467--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: 3

🧹 Nitpick comments (1)
src/components/Assets/AssetType/HL7Monitor.tsx (1)

Line range hint 93-164: Overall mobile responsiveness implementation feedback.

The responsive design implementation using Tailwind classes is good, but consider these architectural suggestions for better mobile UX:

  1. Consider implementing a mobile-first approach starting with full width on smaller screens
  2. Test the layout with different content lengths to ensure proper wrapping
  3. Verify that form inputs and buttons are touch-friendly (min 44px tap targets)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 96bc802 and 0fcd48e.

📒 Files selected for processing (1)
  • src/components/Assets/AssetType/HL7Monitor.tsx (4 hunks)
🔇 Additional comments (1)
src/components/Assets/AssetType/HL7Monitor.tsx (1)

Line range hint 154-162: Verify mobile responsiveness of VentilatorPatientVitalsMonitor.

While the component addition looks good, please ensure that the VentilatorPatientVitalsMonitor component itself is mobile-responsive.

✅ Verification successful

VentilatorPatientVitalsMonitor component is properly mobile-responsive

The component implements responsive design through:

  • Flexbox layouts with flex-col that adjust to flex-row on medium screens (md:)
  • Responsive text sizing (text-4xl to md:text-6xl)
  • Mobile-first approach with proper breakpoints
  • Responsive divisions and spacing using Tailwind's responsive modifiers
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for responsive classes in the VentilatorPatientVitalsMonitor component
rg -A 5 "className" "src/components/VitalsMonitor/VentilatorPatientVitalsMonitor"

Length of output: 179


Script:

#!/bin/bash
# First, let's find the correct path for the VentilatorPatientVitalsMonitor component
fd "VentilatorPatientVitalsMonitor" --type f

# Then check for responsive design patterns in the found files
rg -i "className|style|@media|responsive|mobile|width|flex" $(fd "VentilatorPatientVitalsMonitor" --type f)

Length of output: 1743

src/components/Assets/AssetType/HL7Monitor.tsx Outdated Show resolved Hide resolved
src/components/Assets/AssetType/HL7Monitor.tsx Outdated Show resolved Hide resolved
@Jacobjeevan
Copy link
Contributor

Check the failing cypress test; should be related to the button changes.

… to find element: #submit, but never found it.
@modamaan
Copy link
Contributor Author

@Jacobjeevan please check the updation

Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

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

use screen's width as in other pages

image

@modamaan
Copy link
Contributor Author

modamaan commented Dec 18, 2024

@rithviknishad @Jacobjeevan @bodhish how to resolve these cypress errors

Screenshot 2024-12-18 203149

@github-actions github-actions bot added needs-triage question Further information is requested labels Dec 18, 2024
@modamaan
Copy link
Contributor Author

@rithviknishad can you please check the updation

@Jacobjeevan Jacobjeevan removed question Further information is requested needs-triage labels Dec 19, 2024
Copy link
Contributor

@Jacobjeevan Jacobjeevan left a comment

Choose a reason for hiding this comment

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

image

Update the screens as well.

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/VitalsMonitor/HL7PatientVitalsMonitor.tsx (2)

50-50: Consider improving small screen responsiveness

The current width setup (w-[55%]) might be too narrow for small screens before hitting the medium breakpoint. Consider using a more flexible approach for smaller screens.

-    <div className="flex flex-col gap-1 rounded bg-[#020617] p-2 w-[55%] m-1 md:w-full md:m-0">
+    <div className="flex flex-col gap-1 rounded bg-[#020617] p-2 w-full sm:w-[55%] m-1 md:w-full md:m-0">

Line range hint 50-207: Consider accessibility improvements for vital signs

While the responsive layout looks good, consider adding the following accessibility improvements:

  1. Add aria-label attributes to vital sign sections for screen readers
  2. Ensure sufficient color contrast for all vital sign values
  3. Consider adding role="status" to dynamically updating values

Example implementation for the ECG section:

           <NonWaveformData
             label="ECG"
             attr={data.pulseRate?.value ? data.pulseRate : data.heartRate}
             className="text-green-400"
+            aria-label={`ECG ${data.pulseRate?.value || data.heartRate?.value || 'no reading'}`}
+            role="status"
             suffix={
               <span className="animate-pulse font-sans text-red-500">❤️</span>
             }
           />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3a868a2 and b8567f5.

📒 Files selected for processing (1)
  • src/components/VitalsMonitor/HL7PatientVitalsMonitor.tsx (3 hunks)
🔇 Additional comments (2)
src/components/VitalsMonitor/HL7PatientVitalsMonitor.tsx (2)

153-153: Well-implemented responsive layout

The use of flex-wrap with md:flex-nowrap is a good approach for handling responsive layout transitions between mobile and desktop views.


206-206: Verify absolute positioning behavior

While the responsive adjustments look good, the md:absolute positioning could cause layout issues if the parent container's height is not properly constrained. Please verify the following scenarios:

  1. Content overflow behavior when vital signs have long values
  2. Layout stability when switching between mobile and desktop views
  3. Container height consistency across different screen sizes
✅ Verification successful

Let me gather more information about the VitalsNonWaveformContent component and its layout structure.


Let me check the NonWaveformData component to understand the content structure and any potential overflow handling.


Based on the analysis of the code, I can now provide the final response:

Absolute positioning implementation is safe

The absolute positioning implementation is well-constrained and safe because:

  1. The parent container uses relative flex flex-col md:flex-row which properly establishes the positioning context
  2. The NonWaveformData component has a controlled layout with fixed text sizes (text-4xl/text-6xl) and consistent padding
  3. The grid layout with md:grid-cols-1 ensures content stacks vertically on desktop
  4. The inset-y-0 with the parent's relative positioning ensures the height is properly bounded

The responsive behavior will work correctly as:

  • Mobile: Grid-based layout with controlled gaps
  • Desktop: Height-constrained absolute positioning with single column
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for height constraints on parent containers
rg -A 2 "relative flex flex-col.*md:flex-row" src/

Length of output: 1148


Script:

#!/bin/bash
# Check VitalsNonWaveformContent implementation and its layout constraints
ast-grep --pattern 'const VitalsNonWaveformContent = $$$'

# Search for any height-related styles in the component
rg -B 2 -A 2 "VitalsNonWaveformContent" src/

Length of output: 3835


Script:

#!/bin/bash
# Check NonWaveformData implementation for content structure
ast-grep --pattern 'const NonWaveformData = $$$'

# Search for any max-height or overflow handling in related components
rg "max-h|overflow" src/components/VitalsMonitor/

Length of output: 3473

@modamaan
Copy link
Contributor Author

modamaan commented Dec 19, 2024

@Jacobjeevan HL7 monitor
Screenshot 2024-12-19 231415

ventilator monitor
Screenshot 2024-12-19 231330

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 (1)
src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.tsx (1)

28-28: Consider adopting a mobile-first approach with fluid width.

The current implementation uses a fixed desktop-first approach which might cause layout issues. Consider:

  1. Following mobile-first principles by making mobile styles the default
  2. Using fluid width with max-width constraints instead of fixed percentage
- <div className="flex flex-col gap-1 rounded bg-[#020617] p-2 w-[55%] m-1 md:w-full md:m-0">
+ <div className="flex flex-col gap-1 rounded bg-[#020617] p-2 w-full m-0 lg:max-w-[600px] lg:m-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 b8567f5 and 0c193b9.

📒 Files selected for processing (1)
  • src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.tsx (1 hunks)
🔇 Additional comments (2)
src/components/VitalsMonitor/VentilatorPatientVitalsMonitor.tsx (2)

Line range hint 33-65: Verify canvas responsiveness and layout stability.

While the flex-wrap addition improves responsiveness, please verify:

  1. Canvas elements scale properly on different screen sizes
  2. Layout remains stable when switching between online/offline states
✅ Verification successful

Let me gather more information about the canvas size handling and responsive design implementation.


Canvas responsiveness and layout stability are properly implemented.

The implementation shows robust handling of canvas responsiveness and layout stability:

  1. Canvas size is managed through rendererConfig.size which is obtained from getVitalsCanvasSizeAndDuration() and consistently applied to all canvas elements
  2. The container uses proper responsive classes:
    • Base container has w-[55%] that switches to md:w-full on medium screens
    • Flex layouts adapt with md:flex-row and md:flex-nowrap breakpoints
    • Content visibility is controlled via hidden class with proper state management through isOnline
  3. Layout stability is maintained through:
    • Absolute positioning of canvas elements with consistent sizing
    • Proper state transitions between online/offline modes using classNames utility
    • Consistent spacing and positioning across different viewport sizes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for canvas size calculations and responsive handling
ast-grep --pattern 'const $_ = useVentilatorVitalsMonitor($_)' -A 10
rg -A 5 'waveformCanvas.size'

Length of output: 5926


Script:

#!/bin/bash
# Search for the hook implementation to understand canvas size handling
ast-grep --pattern 'function useVentilatorVitalsMonitor($_) {
  $$$
}'

# Search for responsive classes and container styles
rg -A 2 'md:|sm:|lg:' src/components/VitalsMonitor/

Length of output: 17949


Line range hint 28-91: Address failing Cypress tests mentioned in PR comments.

The layout changes might affect element positioning that Cypress tests rely on. Consider:

  1. Updating Cypress selectors if they depend on specific layout structure
  2. Adding data-testid attributes for more reliable test selection

@nihal467
Copy link
Member

image

@modamaan the screen is not responsive in mobile screen

@modamaan
Copy link
Contributor Author

@nihal467 i didnt get the real time data for testing

@Jacobjeevan
Copy link
Contributor

Jacobjeevan commented Dec 27, 2024

@nihal467 i didnt get the real time data for testing

@modamaan You can check Gigin in the staging site (devdistrictadmin login if you can't access it, same password).

Here's direct link to two assets:

https://care.ohc.network/facility/0c95c7f0-e1d2-4aff-83fa-933cef60d3a8/assets/73885d66-4891-4d4f-ba65-78c75baf7e8d/configure

https://care.ohc.network/facility/0c95c7f0-e1d2-4aff-83fa-933cef60d3a8/assets/491bfe55-fe71-47fe-bb2e-a06e20071431/configure

@modamaan
Copy link
Contributor Author

@Jacobjeevan I logged into the devdistrictadmin and clicked the provided direct link, but it shows
Screenshot 2024-12-31 003844

@github-actions github-actions bot added needs-triage question Further information is requested labels Dec 30, 2024
@Jacobjeevan
Copy link
Contributor

@Jacobjeevan I logged into the devdistrictadmin and clicked the provided direct link, but it shows Screenshot 2024-12-31 003844

Sorry, I meant dev-districtadmin. But anyways, don't worry about it. Issue is no longer relevant as we are removing/reworking assets 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The assets configuration page lacks mobile responsiveness
4 participants