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

Fix: Incorrect Icon in Patient nav bar | Facility switcher hovering and some minor fixes #10080

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

Conversation

Rishith25
Copy link
Contributor

@Rishith25 Rishith25 commented Jan 21, 2025

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

  • Localization

    • Added new translation entries for medical terminology: "Onset", "Severity", and "Symptom"
    • Implemented internationalization in Diagnosis and Symptom tables
  • UI Improvements

    • Enhanced cursor and focus styles in dropdown menus
    • Updated patient navigation icon for nearby facilities
    • Modified appointment status badge to highlight cancelled appointments
  • Minor Changes

    • Updated creator display to show username instead of full name in tables

@Rishith25 Rishith25 requested a review from a team as a code owner January 21, 2025 07:14
Copy link
Contributor

coderabbitai bot commented Jan 21, 2025

Walkthrough

This pull request introduces several enhancements across different components, focusing on internationalization, user interface improvements, and minor visual updates. The changes include adding localization entries for medical terminology, implementing translation support in diagnosis and symptom tables, updating sidebar component interactions, modifying patient navigation icons, and refining appointment status badge representations.

Changes

File Change Summary
public/locale/en.json Added new localization entries: "onset", "severity", and "symptom"
src/components/Patient/diagnosis/DiagnosisTable.tsx Integrated internationalization using useTranslation hook, replaced static headers with translated strings
src/components/Patient/symptoms/SymptomTable.tsx Added translation support, modified creator name display
src/components/ui/sidebar/facility-switcher.tsx Added cursor-pointer class, updated focus styles
src/components/ui/sidebar/organization-switcher.tsx Added cursor-pointer class, enhanced focus styles
src/components/ui/sidebar/patient-nav.tsx Changed "nearby_facilities" icon from "d-patient" to "d-hospital"
src/pages/Patient/index.tsx Updated getStatusChip to use "destructive" variant for cancelled appointments

Assessment against linked issues

Objective Addressed Explanation
Use destructive variant for cancelled badge
Incorrect icon for Nearby facilities
Display username in symptoms/diagnosis tables

Possibly related PRs

Suggested labels

tested, needs review, good to merge

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 A rabbit's tale of code so bright,
Translations dancing with delight,
Icons shifting, badges gleam,
Internationalization's sweet dream,
Hopping through changes, pixel-perfect might! 🌈


📜 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 dddb2cb and 194ecb3.

📒 Files selected for processing (3)
  • public/locale/en.json (4 hunks)
  • src/components/Patient/diagnosis/DiagnosisTable.tsx (2 hunks)
  • src/components/Patient/symptoms/SymptomTable.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/components/Patient/symptoms/SymptomTable.tsx
  • src/components/Patient/diagnosis/DiagnosisTable.tsx
  • public/locale/en.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: cypress-run (1)

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 21, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 194ecb3
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/679071c1b1ee230008e16e83
😎 Deploy Preview https://deploy-preview-10080--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 (6)
src/pages/Patient/components/AppointmentDialog.tsx (2)

90-90: Use AppointmentCancelledStatuses for status check

Instead of directly comparing with "cancelled" string, use the AppointmentCancelledStatuses array for better type safety and maintainability.

-              disabled={isPending || appointment.status == "cancelled"}
+              disabled={isPending || AppointmentCancelledStatuses.includes(appointment.status as AppointmentCancelledStatus)}

Line range hint 99-102: Track TODO comment for reschedule functionality

The TODO comment about wiring up the reschedule functionality should be tracked in the issue tracker.

Would you like me to create an issue to track the implementation of the reschedule functionality?

src/pages/Patient/index.tsx (2)

57-59: Refactor nested ternary operators for better readability

The nested ternary operators make the code harder to read. Consider using a more explicit approach with a switch statement or object mapping.

-        variant={
-          status === "checked_in"
-            ? "secondary"
-            : status === "booked"
-              ? "primary"
-              : status === "cancelled"
-                ? "destructive"
-                : "default"
-        }
+        variant={getStatusVariant(status)}

// Add this function above the component:
const getStatusVariant = (status: string) => {
  switch (status) {
    case "checked_in":
      return "secondary";
    case "booked":
      return "primary";
    case "cancelled":
      return "destructive";
    default:
      return "default";
  }
};

Line range hint 134-135: Use i18n for hardcoded strings

The hardcoded strings should be internationalized using the translation system.

-              <span className="text-sm">{"Currently doesn't exist"}</span>
+              <span className="text-sm">{t("appointment_type_not_available")}</span>
-              <span className="text-sm">{"Facility Location"}</span>
+              <span className="text-sm">{t("facility_location")}</span>
src/components/Patient/symptoms/SymptomTable.tsx (1)

89-89: Consider updating Avatar name prop for consistency.

While changing to display username, the Avatar component still uses first_name and last_name for the name prop. Consider updating it to match the username display for consistency.

-              <Avatar
-                name={`${symptom.created_by?.first_name} ${symptom.created_by?.last_name}`}
-                className="w-4 h-4"
-                imageUrl={symptom.created_by?.profile_picture_url}
-              />
+              <Avatar
+                name={symptom.created_by?.username}
+                className="w-4 h-4"
+                imageUrl={symptom.created_by?.profile_picture_url}
+              />
src/components/Patient/diagnosis/DiagnosisTable.tsx (1)

89-89: Consider updating Avatar name prop for consistency.

Similar to SymptomTable.tsx, consider updating the Avatar name prop to use username for consistency.

-              <Avatar
-                name={`${diagnosis.created_by?.first_name} ${diagnosis.created_by?.last_name}`}
-                className="w-4 h-4"
-                imageUrl={diagnosis.created_by?.profile_picture_url}
-              />
+              <Avatar
+                name={diagnosis.created_by?.username}
+                className="w-4 h-4"
+                imageUrl={diagnosis.created_by?.profile_picture_url}
+              />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 46faa4b and c24a0f2.

📒 Files selected for processing (9)
  • public/locale/en.json (6 hunks)
  • src/components/Patient/diagnosis/DiagnosisTable.tsx (3 hunks)
  • src/components/Patient/symptoms/SymptomTable.tsx (3 hunks)
  • src/components/ui/sidebar/facility-switcher.tsx (2 hunks)
  • src/components/ui/sidebar/organization-switcher.tsx (2 hunks)
  • src/components/ui/sidebar/patient-nav.tsx (1 hunks)
  • src/pages/Patient/components/AppointmentDialog.tsx (1 hunks)
  • src/pages/Patient/index.tsx (1 hunks)
  • src/types/scheduling/schedule.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/components/ui/sidebar/patient-nav.tsx
🔇 Additional comments (10)
src/components/Patient/symptoms/SymptomTable.tsx (1)

41-41: LGTM! Well-structured i18n implementation.

The translation implementation is consistent and follows best practices.

Also applies to: 47-52

src/components/Patient/diagnosis/DiagnosisTable.tsx (1)

41-41: LGTM! Consistent i18n implementation.

The translation implementation matches the pattern used in SymptomTable.tsx, maintaining consistency across components.

Also applies to: 47-52

src/components/ui/sidebar/organization-switcher.tsx (1)

67-70: LGTM! Enhanced interactive feedback.

The cursor-pointer and focus styles improve the UI feedback, aligning with the PR objectives.

Also applies to: 86-88

src/components/ui/sidebar/facility-switcher.tsx (1)

61-64: LGTM! Consistent with organization switcher.

The UI improvements mirror those in the organization switcher, maintaining a cohesive user experience.

Also applies to: 81-83

public/locale/en.json (6)

1471-1471: LGTM! Translation key added for onset field.

The translation is consistent with other medical terminology in the file.


1867-1867: LGTM! Translation key added for role selection prompt.

The translation follows the existing pattern for selection prompts in the file.


1893-1893: LGTM! Translation key added for PRN reason selection.

The translation is consistent with other selection prompts and medical terminology.


1932-1932: LGTM! Translation key added for severity field.

The translation is consistent with other medical terminology in the file.


2009-2009: LGTM! Translation key added for symptom field.

The translation is consistent with other medical terminology in the file.


2197-2197: LGTM! Translation key added for verification field.

The translation is consistent with other form field labels in the file.

src/types/scheduling/schedule.ts Outdated Show resolved Hide resolved
Copy link

👋 Hi, @Rishith25,
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 Jan 21, 2025
@Rishith25 Rishith25 changed the title Fix: Disable Cancel appointment button after cancellation | Facility switcher hovering and some minor fixes Fix: Incorrect Icon for Nearby Facilities | Facility switcher hovering and some minor fixes Jan 21, 2025
@Rishith25 Rishith25 changed the title Fix: Incorrect Icon for Nearby Facilities | Facility switcher hovering and some minor fixes Fix: Incorrect Icon in Patient nav bar | Facility switcher hovering and some minor fixes Jan 21, 2025
@github-actions github-actions bot removed the merge conflict pull requests with merge conflict label Jan 21, 2025
@rithviknishad rithviknishad added the invalid This doesn't seem right label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable Cancel appointment button after cancellation | Facility switcher hovering and some minor fixes
2 participants