-
Notifications
You must be signed in to change notification settings - Fork 514
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 Online Status Indicator in Organization Tab #9728
Fix Online Status Indicator in Organization Tab #9728
Conversation
WalkthroughThis pull request introduces comprehensive internationalization (i18n) support and improves user status representation across multiple components. The changes focus on replacing hardcoded strings with translatable keys, integrating the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (5)
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. |
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.
Move all strings in this page to I18n
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.
@JavidSumra ensure one's done in #9781 is also handled in this
👋 Hi, @JavidSumra, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
…726/user-status-indicator
…umra/care_fe into issues/9726/user-status-indicator
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
🧹 Nitpick comments (7)
src/pages/Organization/OrganizationUsers.tsx (1)
132-132
: [Localize Role Label]
Usingt("role")
is consistent with your new i18n approach. Check for uniform capitalization and usage across all locale JSON entries.src/pages/Organization/components/EditUserRoleSheet.tsx (2)
35-35
: [UserStatusIndicator Import]
ImportingUserStatusIndicator
centralizes status renders. Confirm if any older status code remains for cleanup.
127-127
: [Localize Description]
{t("update_user_role_organization")}
is consistent. Confirm the translation entry is short and descriptive to maintain clarity.src/pages/FacilityOrganization/components/EditFacilityUserRoleSheet.tsx (1)
169-172
: [Refactor Last Login to Status Indicator]
UserStatusIndicator
usage matches other components. This aggregated approach provides a single source for user status logic.src/components/Users/UserListAndCard.tsx (1)
103-138
: [Core Logic for UserStatusIndicator]
This block properly categorizes three states: online, last seen, or never logged in. The usage ofdayjs
is more reliable than manual date arithmetic. Validate large time spans (weeks/months) to ensure accurate status display.src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx (2)
122-127
: Consider improving the spacing between username and status indicator.The current implementation uses an arbitrary
mx-2
margin on the username span. Consider using a more semantic approach to handle the spacing between elements.-<span className="text-sm text-gray-500"> - <span className="mx-2"> - {userRole.user.username} - </span> - <UserStatusIndicator user={userRole.user} /> -</span> +<span className="text-sm text-gray-500 flex items-center gap-2"> + <span>{userRole.user.username}</span> + <UserStatusIndicator user={userRole.user} /> +</span>
Line range hint
106-170
: Consider adding ARIA labels for better accessibility.The user cards could benefit from improved accessibility. Consider adding appropriate ARIA labels to help screen readers better convey the user information.
-<Card key={userRole.id} className="h-full"> +<Card + key={userRole.id} + className="h-full" + aria-label={`User card for ${userRole.user.first_name} ${userRole.user.last_name}`} +> <CardContent className="p-4 sm:p-6"> {/* ... */} - <div className="grid grid-cols-2 gap-4 text-sm"> + <div + className="grid grid-cols-2 gap-4 text-sm" + role="list" + aria-label="User details" + > <div> - <div className="text-gray-500">{t("role")}</div> + <div className="text-gray-500" role="term">{t("role")}</div> <div className="font-medium truncate"> {userRole.role.name} </div> </div> <div> - <div className="text-gray-500">{t("phone_number")}</div> + <div className="text-gray-500" role="term">{t("phone_number")}</div> <div className="font-medium truncate"> {userRole.user.phone_number} </div> </div> </div>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
public/locale/en.json
(12 hunks)src/components/Users/UserListAndCard.tsx
(9 hunks)src/components/ui/sidebar/facility-switcher.tsx
(4 hunks)src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx
(6 hunks)src/pages/FacilityOrganization/components/EditFacilityUserRoleSheet.tsx
(9 hunks)src/pages/Organization/OrganizationUsers.tsx
(6 hunks)src/pages/Organization/components/EditUserRoleSheet.tsx
(9 hunks)src/types/notes/messages.ts
(0 hunks)
💤 Files with no reviewable changes (1)
- src/types/notes/messages.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/components/ui/sidebar/facility-switcher.tsx
- public/locale/en.json
🔇 Additional comments (54)
src/pages/Organization/OrganizationUsers.tsx (8)
3-3
: [Use i18n Hook Effectively]
The addition of theuseTranslation
import is correct. It aligns with the new usage of localized strings, ensuring that the module can leverage language translation throughout the component.
11-11
: [Proper Component Import]
ImportingUserStatusIndicator
from@/components/Users/UserListAndCard
is consistent with the PR objective of unifying user status display logic. Ensure that you remove any leftover references to outdated status indicators, if present.
32-32
: [Initialize Translation Hook]
Initializing the translation hook right before usage is a good practice. Verify that the translation keys ("users"
,"no_users_found"
, etc.) are duly added in the locale JSON files to prevent runtime fallbacks.
75-75
: [Replace Hardcoded "Users" with i18n Key]
Usingt("users")
aligns with the updated translations across the application.
101-101
: [Replace Hardcoded "No users found." with i18n Key]
The updatedt("no_users_found")
improves localization. Confirm that your translation files contain the"no_users_found"
key to fully localize this text.
124-124
: [Use Centralized User Status Indicator]
Replacing any ad-hoc status badges with theUserStatusIndicator
promotes consistency. This is beneficial for maintainability and can unify status checks in one place.
138-138
: [Localize Phone Number Label]
Usingt("phone_number")
ensures consistency in labeling across locales.
159-159
: [Localize "More Details" Button Label]
Switching tot("more_details")
is a good follow-up for complete translation coverage.src/pages/Organization/components/EditUserRoleSheet.tsx (17)
3-3
: [Import i18n Hook for Translations]
Introducing theuseTranslation
import is appropriate for localized strings in this component.
57-57
: [Declare Translation Hook]
Definest
, enabling translation strings. Ensure all relevant text is wrapped witht(...)
.
75-75
: [Status Toast Message i18n]
toast.success(t("user_role_update_success"))
helps localize success feedback. Confirm the translation key is present in all required languages to avoid missing translations.
95-95
: [User Removal Toast i18n]
toast.success(t("user_removed_success"))
is consistent. Double-check if the user removal scenario has negative tests in place to confirm the error handling.
108-108
: [Error Toast Localization]
toast.error(t("select_diff_role"))
is correctly localized. Ensure tests cover this specific scenario of selecting the same role.
121-121
: [Localize Edit Role Trigger]
{ t("edit_role") }
ensures the button text is translatable.
125-125
: [Localize Sheet Title]
<SheetTitle>{t("edit_user_role")}</SheetTitle>
aligns the heading with the new translation approach.
150-150
: [Localize "Username"]
{t("username")}
—this is straightforward. Confirm the correct string is used in non-English locales.
154-156
: [Localize "Current Role"]
{t("current_role")}
ensures the property reflection is localized.
160-163
: [Show Last Login with Status Indicator]
Replacing a textual last login with theUserStatusIndicator
clarifies the user's online/offline or last-seen status. This is a cohesive approach used across the codebase.
169-171
: [Localize Select Role Prompt]
{t("select_new_role")}
and the placeholder{t("select_role")}
guarantee the new role selection stays consistent with your localization.
199-199
: [Localize Update Role Button]
Ensure"update_role"
is tested. The button label is part of the critical user flow.
205-205
: [Localize Remove User Button]
{t("remove_user")}
—consistent with the action’s meaning.
211-211
: [Localize Remove Dialog Title]
{t("remove_user_organization")}
clarifies the remove action context in multi-lingual environments.
214-215
: [Warn Before Removing User]
${t("remove_user_warn_1")} ... {t("remove_user_warn_2")}
properly localizes the cautionary statement. Check for placeholders if the text needs to be combined in i18n strings for grammar nuances in certain languages.
219-219
: [Localize Dialog Cancel Button]
{t("cancel")}
is consistent.
224-224
: [Localize Dialog Confirm Button]
{t("remove")}
is consistent with the remove action.src/pages/FacilityOrganization/components/EditFacilityUserRoleSheet.tsx (17)
3-3
: [Add i18n Hook for Facility Organization]
useTranslation
import ensures that this component can properly localize strings.
35-35
: [Centralize User Status]
UserStatusIndicator
usage unifies status display with the organization pages. This fosters consistency.
58-58
: [Initialize Translation Hook for Roles]
const { t } = useTranslation();
sets up translation usage across success/error notifications.
80-80
: [Localize Update Role Success Message]
toast.success(t("user_role_update_success"))
preserves user engagement with a localized success message.
104-104
: [Localize User Removal Success Message]
toast.success(t("user_removed_success"))
is consistent with the approach in other components.
117-117
: [Localize Error Toast]
toast.error(t("select_diff_role"))
covers the scenario of re-selecting the same role.
130-130
: [Localize Default Trigger Text]
{t("edit_role")}
ensures text within the facility organization also follows the new i18n standard.
134-136
: [Sheet Title and Description Localization]
{t("edit_user_role")}
and{t("update_user_role_organization")}
improve clarity for various locales.
159-159
: [Localize Username Label]
{t("username")}
—makes the label consistent with the rest of the app.
163-165
: [Localize Current Role Label]
Transitioning from hardcoded text tot("current_role")
is consistent with the i18n approach.
177-179
: [Localize New Role Prompt]
{t("select_new_role")}
and placeholder{t("select_role")}
unify the user role selection across multiple facility-level contexts.
207-207
: [Localize Update Role Button]
{t("update_role")}
is consistent with the standard for these forms.
213-213
: [Localize Remove User Button]
{t("remove_user")}
—ensures uniformity across the entire application.
219-219
: [Localize Remove User Organization Title]
{t("remove_user_organization")}
clarifies the intent in a multi-lingual environment.
222-223
: [Localize Combined Warning Text]
Similar to theEditUserRoleSheet
, verify that the concatenation oft("remove_user_warn_1")
andt("remove_user_warn_2")
works as intended in all target languages.
227-227
: [Localize Cancel Button]
{t("cancel")}
is consistent.
232-232
: [Localize Final Remove Button]
{t("remove")}
keeps language usage consistent.src/components/Users/UserListAndCard.tsx (9)
1-1
: [Import Day.js for Last Login Calculations]
The addition ofdayjs
enables robust date/time calculations for the user’s last login status. Confirm thatdayjs
is in yourdependencies
.
8-9
: [Use Existing Badge Component]
Replacing inline or custom status styling with theBadge
component ensures consistent visuals for status indicators.
20-20
: [Utility Methods for UserStatus]
formatName
andisUserOnline
provide a clean abstraction. VerifyisUserOnline
uses the correct threshold for user inactivity.
66-66
: [Redefined getNameAndStatusCard Signature]
Removing thecur_online
parameter simplifies usage. Ensure all calling sites are updated accordingly.
75-75
: [Inline Status Indicator]
Embedding<UserStatusIndicator user={user} />
within the card layout clarifies the user’s current state visually.
170-170
: [Conditional Rendering for Different Screen Sizes]
getNameAndStatusCard(user, !isLessThanXLargeScreen)
is a neat approach to adapt the UI. Confirm it results in an expected layout on all breakpoints.
309-309
: [Localize Tab "Card" Label]
<span>{t("card")}</span>
ensures the tab label is translatable.
319-319
: [Localize Tab "List" Label]
<span>{t("list")}</span>
is consistent with the rest of the i18n tab usage.
342-342
: [Localize "No Users Found"]
Switching tot("no_users_found")
ensures that the empty state message is translatable.src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx (3)
3-3
: LGTM! Import statements are well-organized.The new imports for internationalization and the
UserStatusIndicator
component are properly organized and align with the PR's objective.Also applies to: 11-11
32-32
: LGTM! Proper i18n initialization.The
useTranslation
hook is correctly initialized and thet
function is consistently used throughout the component.
75-75
: Verify translation keys in locale files.Please ensure that all translation keys are defined in the locale files:
users
no_users_found
role
phone_number
more_details
Also applies to: 102-102, 134-134, 140-140, 162-162
…umra/care_fe into issues/9726/user-status-indicator
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
🧹 Nitpick comments (2)
src/components/Users/UserListAndCard.tsx (2)
102-104
: Enhance date localization in the title attribute.The title attribute should use a localized date format for better internationalization support.
- title={`${new Date(user.last_login).toLocaleString()}`} + title={new Date(user.last_login).toLocaleDateString(undefined, { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + })}
107-122
: Improve accessibility and maintainability of status indicators.Consider the following improvements:
- Add aria-label for screen readers
- Move color classes to Badge variants for better maintainability
- <Badge variant="secondary" className="bg-green-100 whitespace-nowrap"> + <Badge + variant="online" + className="whitespace-nowrap" + aria-label={t("user_status_online")} + >You'll need to define these variants in your Badge component:
// in Badge.tsx const variants = { online: "bg-green-100", away: "bg-yellow-100", offline: "bg-gray-100", // ... other variants }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
public/locale/en.json
(11 hunks)src/components/Users/UserListAndCard.tsx
(9 hunks)src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx
(6 hunks)src/pages/FacilityOrganization/components/EditFacilityUserRoleSheet.tsx
(10 hunks)src/pages/Organization/components/EditUserRoleSheet.tsx
(10 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- src/pages/FacilityOrganization/components/EditFacilityUserRoleSheet.tsx
- src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx
- src/pages/Organization/components/EditUserRoleSheet.tsx
- public/locale/en.json
🔇 Additional comments (4)
src/components/Users/UserListAndCard.tsx (4)
7-7
: LGTM! Good use of existing utilities.The imports are appropriate for the changes, and I appreciate that you're using the existing
relativeTime
utility as suggested in previous reviews.Also applies to: 19-19
65-65
: LGTM! Good separation of concerns.The removal of the
cur_online
parameter and delegation toUserStatusIndicator
improves code organization and maintainability.Also applies to: 74-74
295-295
: LGTM! Good internationalization coverage.All user-facing strings are properly internationalized using the translation function.
Also applies to: 305-305, 328-328
106-123
: Verify the status indicator states match the requirements.The implementation handles all user states appropriately:
- Online: Current user or recently active users
- Away: Users with last login timestamp
- Offline: Users who never logged in
Please verify that these states align with the product requirements from issue #9726.
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
🧹 Nitpick comments (5)
public/locale/en.json (5)
357-357
: Consider using i18next time formattingThe keys
"ago"
and"last_seen"
are used for displaying time-based information. Consider using i18next's built-in date/time formatting features instead of concatenating strings.- "ago": "ago", - "last_seen": "Last seen", + // Remove these keys and use i18next's built-in date formatting: + // t('{{date, ago}}') or t('{{date, fromNow}}')Reference: https://www.i18next.com/translation-function/formatting#date-formatting
Also applies to: 1112-1118
487-487
: Clarify the context for the generic "card" keyThe key
"card"
seems too generic and might lead to confusion. Consider using a more specific key name that indicates its context and usage.- "card": "Card", + "user_card": "Card", // if used in user context + "facility_card": "Card", // if used in facility context
657-657
: Ensure consistent casing in role management keysThe role management related keys follow a good naming pattern. However, some keys use different casing styles (e.g., "current_role" vs "userRole").
Consider standardizing the casing:
"current_role": "Current Role", "edit_role": "Edit Role", "edit_user_role": "Edit User Role", "select_diff_role": "Please select a different role", "select_facility": "Select Facility", "select_new_role": "Select New Role", "update_role": "Update Role", "update_user_role_organization": "Update the role for this user in the organization",Also applies to: 764-766, 1636-1638, 1646-1646, 1832-1836
1539-1540
: Add placeholder markers in user removal messagesThe user removal confirmation message contains hardcoded placeholders. Consider using i18next's standardized placeholder syntax.
- "remove_user_warn": "Are you sure you want to remove {{firstName}} {{lastName}} from this organization? This action cannot be undone.", + "remove_user_warn": "Are you sure you want to remove %(firstName)s %(lastName)s from this organization? This action cannot be undone.",Reference: https://www.i18next.com/translation-function/formatting#string-formatting
1866-1867
: Consider adding more context to success messagesThe success messages for user operations are good but could be more specific about what role or organization was involved.
- "user_removed_success": "User removed from organization successfully", - "user_role_update_success": "User role updated successfully", + "user_removed_success": "User removed from {{organizationName}} successfully", + "user_role_update_success": "User role updated to {{roleName}} successfully",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
public/locale/en.json
(11 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: cypress-run (1)
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.
Conditionally approving.
LGTM
…umra/care_fe into issues/9726/user-status-indicator
👋 Hi, @JavidSumra, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
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 comments (1)
src/components/Users/UserListAndCard.tsx (1)
Line range hint
92-101
: Fix type definition inconsistency in UserStatusIndicator.The
className
prop is defined in the type but not used in the function parameters. This could lead to TypeScript errors.Apply this diff to fix the inconsistency:
export const UserStatusIndicator = ({ user, addPadding = false, }: { user: UserBase; - className?: string; addPadding?: boolean; }) => {
🧹 Nitpick comments (2)
public/locale/en.json (1)
357-357
: Consider implementing plural forms for time-based translations.The "ago" translation should follow i18next plural guidelines to handle different time units correctly.
Consider implementing plural forms like this:
- "ago": "ago", + "ago_one": "{{count}} {{unit}} ago", + "ago_other": "{{count}} {{unit}}s ago"This allows for proper pluralization: "1 minute ago" vs "2 minutes ago".
src/components/Users/UserListAndCard.tsx (1)
102-124
: Improve date format in the title attribute.While the status indicator implementation looks good, the raw date string in the title attribute could be formatted for better readability.
Apply this diff to improve the date format:
- title={`${new Date(user.last_login).toLocaleString()}`} + title={new Date(user.last_login).toLocaleDateString(undefined, { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + })}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.json
(11 hunks)src/components/Users/UserListAndCard.tsx
(9 hunks)
🔇 Additional comments (5)
public/locale/en.json (1)
487-487
: LGTM! The new translations follow i18n best practices.The added translations:
- Follow consistent naming conventions
- Use proper capitalization for UI display
- Correctly implement template variables where needed
Also applies to: 657-657, 1113-1113, 1539-1540, 1636-1636, 1638-1638
src/components/Users/UserListAndCard.tsx (4)
7-7
: LGTM! Import changes are well-aligned with the implementation.The addition of the Badge component and relativeTime util follows the recommendations from previous reviews.
Also applies to: 19-19
65-65
: LGTM! Function signature update for getNameAndStatusCard.The removal of the
cur_online
parameter simplifies the interface as the online status is now handled within the UserStatusIndicator component.Also applies to: 91-91
295-295
: LGTM! Comprehensive i18n implementation.All user-facing strings have been properly internationalized using consistent translation keys.
Also applies to: 305-305, 328-328
74-74
: Verify consistent usage of UserStatusIndicator across the codebase.The implementation looks good, but let's verify that all instances of user status display have been updated to use this component.
Run this script to check for any remaining direct Badge usage for user status:
Also applies to: 74-74
✅ Verification successful
Implementation is consistent across the codebase ✅
The UserStatusIndicator component is properly used in all relevant locations where user status is displayed. No legacy Badge implementations for user status were found.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for direct Badge usage with online/offline related text rg -l "Badge.*online|Badge.*offline" --type ts --type tsx # Search for UserStatusIndicator usage rg -l "UserStatusIndicator" --type ts --type tsxLength of output: 164
Script:
#!/bin/bash # Search for Badge usage with online/offline context rg -A 3 "Badge.*(?i:online|offline)" "*.{ts,tsx}" # Search for UserStatusIndicator usage rg -A 2 "UserStatusIndicator" "*.{ts,tsx}" # Also search for any status-related Badge components rg -A 3 "Badge.*status" "*.{ts,tsx}"Length of output: 286
Script:
#!/bin/bash # Search for Badge usage with online/offline context rg -A 3 '<Badge.*(?i:online|offline)' # Search for UserStatusIndicator component usage rg -A 2 '<UserStatusIndicator' # Search for status-related Badge components rg -A 3 '<Badge.*status'Length of output: 3063
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
🧹 Nitpick comments (2)
src/components/Users/UserListAndCard.tsx (1)
103-105
: Consider formatting the hover timestamp.The raw timestamp in the title attribute could be more user-friendly.
- title={`${new Date(user.last_login).toLocaleString()}`} + title={new Date(user.last_login).toLocaleDateString(undefined, { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + })}public/locale/en.json (1)
659-659
: Consider adding plural forms for role-related translationsThe role-related translations should follow i18next plural guidelines as mentioned in the past review comments.
Consider updating the translations to support plural forms:
- "current_role": "Current Role", + "current_role_one": "Current Role", + "current_role_other": "Current Roles",Also applies to: 767-769
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.json
(11 hunks)src/components/Users/UserListAndCard.tsx
(9 hunks)
🔇 Additional comments (9)
src/components/Users/UserListAndCard.tsx (4)
7-7
: LGTM! Good use of existing utilities.The imports are well-organized, and I appreciate the reuse of the existing
relativeTime
utility as suggested in the previous review.Also applies to: 19-19
107-124
: Well-structured status indicator implementation!The Badge-based status indicators are well-implemented with:
- Clear visual states (green/yellow/gray)
- Consistent structure across all states
- Proper i18n support
- Responsive to the previous review feedback about removing "last seen" text
65-65
: Good function signature simplification!The removal of the
cur_online
parameter and integration with the new UserStatusIndicator component improves code maintainability.Also applies to: 74-74
296-296
: Complete i18n implementation!All user-facing strings have been properly internationalized using the translation function.
Also applies to: 306-306, 329-329
public/locale/en.json (5)
357-357
: LGTM: Time-related translation keyThe translation key
"ago": "ago"
follows the common pattern for time-related suffixes.
488-488
: LGTM: UI element translation keyThe translation key
"card": "Card"
follows proper capitalization for UI elements.
1117-1117
: LGTM: User activity translationsThe translations for user activity status (
"last_login"
and"never_logged_in"
) are consistent and properly formatted.Also applies to: 1231-1231
1544-1545
: Verify string interpolation in warning messageThe warning message uses proper string interpolation with
{{firstName}}
and{{lastName}}
variables.Let's verify that these variables are properly passed from the code:
✅ Verification successful
String interpolation verified successfully
The warning message variables are properly passed from both
EditUserRoleSheet
andEditFacilityUserRoleSheet
components, with correct mapping offirst_name
andlast_name
to the translation placeholders.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usage of the translation key to verify variable passing rg "remove_user_warn" -A 3Length of output: 1285
1642-1644
: Ensure consistency in role-related messagesThe role update messages maintain consistency in terminology using "role" and proper sentence casing.
Let's verify the consistency of role-related messages across the codebase:
Also applies to: 1652-1652, 1838-1838, 1842-1842, 1872-1873
✅ Verification successful
Role-related messages maintain consistent terminology and casing ✅
All role-related messages in the codebase consistently use:
- The term "role" throughout
- Proper sentence casing for all words
- Clear, action-oriented phrasing
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for all role-related translation keys to verify consistency rg '"select_.*role"|"update_.*role"|"edit_.*role"'Length of output: 1883
LGTM |
@JavidSumra 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
UserStatusIndicator
Component@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
Release Notes
Internationalization
User Management
UserStatusIndicator
componentUI Improvements
Localization