-
Notifications
You must be signed in to change notification settings - Fork 560
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
Location Availability display fix #10749
Conversation
WalkthroughThis pull request adds two new localization keys ("available" and "unavailable") in the English JSON file. It updates the LocationCard component to use the translation function for both status and availability text, incorporating logic to determine availability based on the presence of a current encounter. Additionally, the LocationList interface is enhanced with an optional Changes
Sequence Diagram(s)sequenceDiagram
participant LC as LocationCard
participant Loc as Location Object
participant t as Translation Function
LC->>Loc: Retrieve status and current_encounter
alt current_encounter exists
LC->>t: Translate "unavailable"
else
LC->>t: Translate "available"
end
LC->>t: Translate status (t(location.status))
Note right of LC: Render badges with translated text.
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying care-fe with
|
Latest commit: |
f57dbca
|
Status: | ✅ Deploy successful! |
Preview URL: | https://d556c5af.care-fe.pages.dev |
Branch Preview URL: | https://location-minor-fixes.care-fe.pages.dev |
There was a problem hiding this 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
📒 Files selected for processing (3)
public/locale/en.json
(2 hunks)src/pages/Facility/settings/locations/components/LocationCard.tsx
(1 hunks)src/types/location/location.ts
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- public/locale/en.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test
- GitHub Check: cypress-run (1)
🔇 Additional comments (4)
src/types/location/location.ts (2)
1-1
: LGTM!The import statement follows the project's import pattern and is necessary for the new
current_encounter
property.
46-51
: LGTM!The
current_encounter
property is correctly added:
- Follows the file's snake_case naming convention
- Properly marked as optional
- Type is correctly specified as Encounter
src/pages/Facility/settings/locations/components/LocationCard.tsx (2)
98-100
: LGTM!The variant logic correctly reflects availability:
- Default variant when location is available (no current encounter)
- Destructive variant when location is unavailable (has current encounter)
103-105
:✅ Verification successful
Verify translation keys for availability text.
Ensure that translation keys exist for "available" and "unavailable" in the translation files.
Run the following script to check the translation files:
🏁 Script executed:
#!/bin/bash # Description: Check if translation keys exist for availability text # Search for availability translation keys echo "Searching for availability translation keys..." rg -i '"available"\s*:|"unavailable"\s*:' public/locale/Length of output: 265
Translation keys verified successfully.
The translation keys for
"available"
and"unavailable"
are correctly defined inpublic/locale/en.json
, so the conditional rendering insrc/pages/Facility/settings/locations/components/LocationCard.tsx
(lines 103-105) is using the proper keys. No further changes are needed.
@@ -92,17 +92,17 @@ export function LocationCard({ location, onEdit, className }: Props) { | |||
location.status === "active" ? "default" : "secondary" | |||
} | |||
> | |||
{location.status} | |||
{t(location.status)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify translation keys for status values.
Ensure that translation keys exist for all possible status values: "active", "inactive", and "unknown".
Run the following script to check the translation files:
🏁 Script executed:
#!/bin/bash
# Description: Check if translation keys exist for status values
# Search for status values in translation files
echo "Searching for status translation keys..."
rg -i '"active"\s*:|"inactive"\s*:|"unknown"\s*:' public/locale/
Length of output: 660
Translation Keys Verification: "inactive" key missing in some locales
The check confirms that while "active" and "unknown" are translated consistently across all locales, the "inactive" key is defined only in the English translation file (public/locale/en.json). Please verify whether a fallback to English is acceptable or if you need to add translations for "inactive" in the other languages (hi, kn, ta, ml).
CARE
|
Project |
CARE
|
Branch Review |
location-minor-fixes
|
Run status |
|
Run duration | 07m 37s |
Commit |
|
Committer | Amjith Titus |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
11
|
View all changes introduced in this branch ↗︎ |
@amjithtitus09 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! 🙌 |
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
Refactor