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

Patient header UI update in Patient details page #9377

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

Conversation

Mahendar0701
Copy link
Contributor

@Mahendar0701 Mahendar0701 commented Dec 11, 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

Summary by CodeRabbit

  • New Features

    • Updated language for improved clarity in patient management and healthcare procedures.
    • Enhanced layout for displaying patient information in the Patient Home component, organizing details about facility, treating doctor, and assigned volunteer.
    • Introduced new icon options for the Badge component to enhance visual representation.
  • Bug Fixes

    • Corrected spelling in patient-related text strings.
    • Improved data retrieval for patient state information.
  • Documentation

    • Updated text strings for consistency and user-friendliness.
    • Added new strings to enhance functionality related to volunteer assignments.

@Mahendar0701 Mahendar0701 requested a review from a team as a code owner December 11, 2024 11:41
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Walkthrough

The changes involve updates to the English localization file public/locale/en.json, where text strings related to patient management and healthcare procedures have been modified for clarity and consistency. Additionally, the Demography component in PatientDetailsTab has been updated to access the patient's state using a structured object. The PatientHome component has undergone a significant restructuring to improve the layout and presentation of patient information, simplifying the rendering logic while maintaining existing functionality.

Changes

File Path Change Summary
public/locale/en.json Updated text strings, including renaming "patient_details" to "Details of Patient" and adding "unassign": "Unassign". Other adjustments include correcting spelling and adding "volunteer_update": "Volunteer updated successfully".
src/components/Patient/PatientDetailsTab/Demography.tsx Modified patient state access from patientData.state to patientData?.state_object?.name.
src/components/Patient/PatientHome.tsx Restructured JSX for patient information display, removed mandatory data checks, and simplified layout.
src/components/ui/badge.tsx Enhanced Badge component with new icon props and variants for improved display options.

Assessment against linked issues

Objective Addressed Explanation
Update patient header and state value in details page (#9376)
Correct incorrect state value in demography tab (#9376)
Correct colors of transfer labels (#9376) No changes related to transfer label colors were made.

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan
  • shivankacker

Poem

🐇 In the garden of care, we update with glee,
Patient details now clearer, for all to see.
With structured states and layouts anew,
Our app shines brighter, for me and for you!
Let's hop to the future, with joy and delight,
Enhancing each moment, making health feel right! 🌼


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. (Experiment)
  • @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 11, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 86a3597
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/675c7e8d4fe97f00098233f1
😎 Deploy Preview https://deploy-preview-9377--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

🧹 Outside diff range and nitpick comments (1)
src/components/Patient/PatientHome.tsx (1)

279-309: Consider memoizing the skills formatting logic

The skills formatting and tooltip rendering logic could benefit from memoization to prevent unnecessary re-renders, especially for large skill sets.

+ const formattedSkills = useMemo(() => formatSkills(skillsQuery.data?.results), 
+   [skillsQuery.data?.results]);

- {!!skillsQuery.data?.results?.length &&
-   formatSkills(skillsQuery.data?.results)}
+ {!!skillsQuery.data?.results?.length && formattedSkills}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e89530d and 38bcda5.

📒 Files selected for processing (3)
  • public/locale/en.json (1 hunks)
  • src/components/Patient/PatientDetailsTab/Demography.tsx (1 hunks)
  • src/components/Patient/PatientHome.tsx (1 hunks)
🔇 Additional comments (4)
src/components/Patient/PatientDetailsTab/Demography.tsx (1)

229-229: LGTM: Safe state value access implementation

The change to use state_object?.name with optional chaining is a safer way to access the state value and fixes the incorrect state value issue mentioned in the PR objectives.

src/components/Patient/PatientHome.tsx (2)

268-269: LGTM: Clean layout structure

The flex layout with proper gap spacing provides a responsive and well-organized structure for the patient header.


350-432: LGTM: Comprehensive status indicators

The status chips section effectively displays all relevant patient statuses with appropriate visual indicators and conditions.

public/locale/en.json (1)

1119-1119: LGTM: Improved text clarity

The text change from "Patient Details" to "Details of Patient" provides better clarity in the UI.

src/components/Patient/PatientHome.tsx Show resolved Hide resolved
@Mahendar0701 Mahendar0701 changed the title Patient header UI redesign Patient header UI update in Patient details page Dec 11, 2024
Copy link

👋 Hi, @Mahendar0701,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Dec 12, 2024
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

🧹 Outside diff range and nitpick comments (2)
src/components/ui/badge.tsx (1)

37-59: Consider adding aria-label for icon-only scenarios.

The implementation looks good! For better accessibility, consider adding aria-label when the badge contains only icons without text.

-      {startIcon && <CareIcon icon={startIcon} className="mr-1" />}
+      {startIcon && <CareIcon icon={startIcon} className="mr-1" aria-label={startIcon} />}
       <span>{props.children}</span>
-      {endIcon && <CareIcon icon={endIcon} className="ml-1" />}
+      {endIcon && <CareIcon icon={endIcon} className="ml-1" aria-label={endIcon} />}
src/components/Patient/PatientHome.tsx (1)

568-577: Consider consolidating transfer status logic.

The transfer status badge could be simplified using a single conditional render.

-            {patientData.allow_transfer ? (
-              <Badge variant="success" startIcon="l-unlock">
-                {t("transfer_allowed")}
-              </Badge>
-            ) : (
-              <Badge variant="warning" startIcon="l-lock">
-                {t("transfer_blocked")}
-              </Badge>
-            )}
+            <Badge
+              variant={patientData.allow_transfer ? "success" : "warning"}
+              startIcon={patientData.allow_transfer ? "l-unlock" : "l-lock"}
+            >
+              {t(patientData.allow_transfer ? "transfer_allowed" : "transfer_blocked")}
+            </Badge>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 53ec8ad and 86a3597.

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

19-26: LGTM! Well-structured variant definitions.

The new variants (alert, danger, success) are properly defined with appropriate color schemes and hover states.

src/components/Patient/PatientHome.tsx (2)

291-434: LGTM! Well-structured patient header layout.

The new layout effectively organizes patient information with clear sections for:

  • Facility details
  • Treating doctor with skills tooltip
  • Assigned doctor with WhatsApp integration
  • Assigned volunteer
  • Status badges with appropriate visual indicators

347-355: ⚠️ Potential issue

Security: Enhance WhatsApp link sanitization.

The current phone number sanitization can be improved for better security.

This was previously flagged in an earlier review. Please implement the suggested phone number sanitization function.

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.

Update Patient Header and state value in Patient details page
3 participants