-
Notifications
You must be signed in to change notification settings - Fork 469
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: Added location for linked facility #9383
Fix: Added location for linked facility #9383
Conversation
WalkthroughThe changes in the pull request focus on the Changes
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
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. |
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: 0
🧹 Outside diff range and nitpick comments (1)
src/components/Users/LinkedFacilities.tsx (1)
249-252
: Maintain consistency in null checking patternsWhile the implementation is functionally correct, it uses a different pattern for null checking compared to the linked facilities implementation. Consider using optional chaining for consistency:
- {homeFacility.district_object && - `, ${homeFacility.district_object.name}`} + {homeFacility.district_object?.name && + `, ${homeFacility.district_object.name}`}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/components/Users/LinkedFacilities.tsx
(2 hunks)
🔇 Additional comments (2)
src/components/Users/LinkedFacilities.tsx (2)
202-206
: LGTM! Implementation aligns with requirements
The addition of district information is well-implemented with proper null checking using optional chaining. The formatting with the comma separator provides a clean and readable display.
202-206
: Verify FacilityModel type definition
Let's verify that the district_object
property is properly defined in the FacilityModel type and consistently used across the codebase.
Also applies to: 249-252
✅ Verification successful
Based on the search results, I can now generate the final response as we have found both the FacilityModel interface definition and the usage of district_object across the codebase.
Property district_object
is properly defined and consistently used
The FacilityModel interface in src/components/Facility/models.tsx
shows that district_object
is an optional property, and its usage in LinkedFacilities.tsx is consistent with the type definition. The property is used with optional chaining (?.
) throughout the codebase, which is the correct pattern for accessing optional properties.
- The property is used consistently with optional chaining in multiple components
- The pattern
facility.district_object?.name
is used similarly in other components like UserListView, PatientDetails, etc. - The type definition and usage align with TypeScript's best practices for optional properties
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check FacilityModel type definition and usage
echo "Checking FacilityModel type definition..."
ast-grep --pattern 'interface FacilityModel {
$$$
district_object?: {
$$$
}
$$$
}'
echo "Checking district_object usage patterns..."
rg "district_object" --type typescript
Length of output: 358
Script:
#!/bin/bash
# Let's try a different approach to find the type definition and usage
# First, let's find all TypeScript/TSX files that might contain the FacilityModel definition
echo "Searching for FacilityModel definition..."
rg "FacilityModel" -A 5 -B 5
# Then, let's look for district_object usage in all ts/tsx files
echo -e "\nSearching for district_object usage..."
fd -e ts -e tsx -x rg "district_object" {}
Length of output: 65513
Hmm, maybe we could display the local body name as well...but both in a tool tip? 🤔 I'll ping the design channel for ideas. |
@AdityaJ2305 Try this: |
👍 |
@Jacobjeevan, Done |
Awesome! |
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: 0
🧹 Outside diff range and nitpick comments (3)
src/components/Users/LinkedFacilities.tsx (3)
204-214
: Consider adding tooltips for facility names and locationsWhile the location display is well-implemented, long facility/location names might get truncated. Consider adding tooltips to show the full names on hover, as suggested in the PR comments.
<div className="text-sm text-black p-2 font-bold flex-1"> + <div title={`${facility.name}`}> {facility.name} + </div> {facility.district_object?.name && ( - <div className="text-sm text-gray-500 font-medium"> + <div className="text-sm text-gray-500 font-medium" + title={`${facility.district_object.name}${facility.state_object?.name ? `, ${facility.state_object.name}` : ''}`}> {facility.district_object?.name} {facility.district_object?.name && facility.state_object?.name && ", "} {facility.state_object?.name} </div> )} </div>Also applies to: 258-268
302-302
: Improve mobile layout spacingThe flex column layout for mobile is good, but consider adjusting the spacing for better visual hierarchy:
-<div className="flex flex-col sm:flex-row gap-3"> +<div className="flex flex-col sm:flex-row gap-4 sm:gap-3"> -<div className="flex flex-col sm:flex-row gap-3"> +<div className="flex flex-col sm:flex-row gap-4 sm:gap-3"> -<div className="flex flex-col sm:flex-row flex-wrap gap-3"> +<div className="flex flex-col sm:flex-row flex-wrap gap-4 sm:gap-3">Also applies to: 332-332, 344-344
316-326
: Reconsider custom button paddingThe button migration to Shadcn UI looks good, but the custom padding might override Shadcn's default styling system:
<Button variant="primary" size="lg" name="Add" id="link-facility" - className="mt-1 rounded-lg px-6 py-[23px] text-base" + className="mt-1 text-base" onClick={() => linkFacility(userData.username, facility)} disabled={!authorizeForHomeFacility} > {t("add_facility")} </Button>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/Users/LinkedFacilities.tsx
(6 hunks)
🔇 Additional comments (2)
src/components/Users/LinkedFacilities.tsx (2)
6-6
: LGTM: Button component migration
The migration to Shadcn UI's Button component aligns with the design system standardization.
218-218
: LGTM: Consistent icon sizing
The icon size changes to text-xl
are consistent and improve visibility.
Also applies to: 280-280
@AdityaJ2305 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! 🙌 |
Proposed Changes
district_object.name
for linked facility for users@ohcnetwork/care-fe-code-reviewers
Screenshot
Merge Checklist
Summary by CodeRabbit