-
Notifications
You must be signed in to change notification settings - Fork 624
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: Redesign the Open view of Department/Teams #10558
Fix: Redesign the Open view of Department/Teams #10558
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request updates localization and reorganizes UI components for facility organization views. In the localization file, four new keys are added, and an existing sorting key is modified. The Facility Organization view now uses a new Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
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
🧹 Nitpick comments (7)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (5)
53-54
: Localize the titles if needed.“Departments/Teams” and “Users” are hardcoded. If these labels need to be localized, consider using the translation function.
Also applies to: 59-59
100-110
: Addtype="button"
to the go-back button.Without specifying
type="button"
, the default behavior can betype="submit"
in form contexts. This is a minor improvement for clarity.<button + type="button" onClick={() => goBack()} className="mt-1 hover:underline" aria-label="Go back" >
111-127
: Avoid potential side effects ofreverse()
.
reverse()
mutates the array in place. Consider using[...orgParents].reverse()
to keeporgParents
intact if needed elsewhere.-{orgParents.reverse().map((parent) => ( +[...orgParents].reverse().map((parent) => (
129-140
: Use fallback for unknown organization types.When displaying
{t(\
facility_organization_type__${org.org_type}`)}, add a fallback for unrecognized
org_type` keys to prevent undefined translations.
141-167
: Remove one of the conflicting props on Tabs.Defining both
defaultValue
andvalue
can be redundant if you’re fully controlling the Tabs withvalue
.src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (2)
28-33
: Consider typingorg_type
as an enum or union.Defining
org_type
as a union type or enum can help catch invalid values at compile time.
35-92
: Optimize sub-organization count retrieval.Using
limit: 1
to fetch only the count is clever, but consider a dedicated endpoint or HEAD request if performance is a concern. Also, “Department inside” / “Team inside” are partially untranslated strings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
public/locale/en.json
(3 hunks)src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
(5 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test
- GitHub Check: cypress-run (1)
🔇 Additional comments (14)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (5)
3-3
: Imports look good.These newly introduced imports and references are straightforward and appear to be used correctly.
Also applies to: 5-5, 7-7, 15-15, 20-20
37-37
: Double-check references fromicon
tovalue
.Ensure all components referencing the old
icon
property are updated to use the newvalue
string property to prevent runtime issues.
47-48
: Usage of translation and custom navigation is fine.The integration of
useTranslation
for localization anduseAppHistory
for navigation is implemented correctly.
63-64
: Good approach to default the active tab.The logic cleanly defaults to
"departments"
if the current path is not found innavItems
.
85-85
: No meaningful changes detected.src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (8)
15-15
: Imports look consistent.
94-94
: Export signature is reasonable.
95-99
: Mismatch betweenlimit: 15
andlimit = 12
.Using two different limits (15 in
useFilters
, 12 in local variable) could cause confusion in pagination or unexpected data size. Verify the intended approach.
129-130
: Minor spacing style.
131-146
: Search input approach looks good.The placeholder is translated. Changes to
searchQuery
are tracked properly, resetting the page for new searches.
163-163
: Structural enhancement.This additional
div
wrapper organizes the layout more clearly.
166-170
: Use ofOrganizationCard
is consistent.
182-182
: Pagination usage is aligned with the rest of the structure.public/locale/en.json (1)
996-999
: New and modified keys are aligned with code usage.These translations match the dynamic keys and search placeholders used in the components.
Also applies to: 1890-1890, 1919-1919
… layout consistency
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 (6)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (3)
28-33
: Consider using a union type fororg_type
.The
org_type
field could be more strictly typed using a union type to prevent invalid values.- org_type: string; + org_type: 'dept' | 'team';
35-35
: Remove unusedfacilityId
prop.The
facilityId
prop is destructured but never used in the component.-function OrganizationCard({ org }: { org: Organization; facilityId: string }) { +function OrganizationCard({ org }: { org: Organization }) {
52-62
: Remove commented code.The commented badge code should be removed if it's no longer needed. If it's for future implementation, consider creating a TODO issue to track it.
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (3)
90-97
: Consider memoizing parent organization calculation.The parent organization calculation could be memoized to prevent unnecessary recalculations on re-renders.
Consider using useMemo:
- const orgParents: FacilityOrganizationParent[] = []; - let currentParent = org.parent; - while (currentParent) { - if (currentParent.id) { - orgParents.push(currentParent); - } - currentParent = currentParent.parent; - } + const orgParents = useMemo(() => { + const parents: FacilityOrganizationParent[] = []; + let currentParent = org.parent; + while (currentParent) { + if (currentParent.id) { + parents.push(currentParent); + } + currentParent = currentParent.parent; + } + return parents; + }, [org.parent]);
101-109
: Enhance back button accessibility.While the back button implementation is good, it could benefit from improved accessibility.
Consider these improvements:
- <button - onClick={() => goBack()} - className="mt-1 hover:underline" - aria-label="Go back" - > + <button + onClick={() => goBack()} + className="mt-1 hover:underline inline-flex items-center gap-1" + aria-label="Go back to previous page" + type="button" + >
148-165
: Enhance tab navigation accessibility.The tab navigation could benefit from ARIA attributes for better screen reader support.
Consider these improvements:
<Tabs defaultValue={currentTab} className="w-full mt-2" value={currentTab} + aria-label="Organization navigation" > <TabsList className="w-full justify-start border-b border-gray-300 bg-transparent p-0 h-auto rounded-none"> {navItems.map((item) => ( <Link key={item.path} href={item.path}> <TabsTrigger value={item.value} className="border-b-2 border-transparent px-2 py-2 text-gray-600 hover:text-gray-900 data-[state=active]:text-primary-800 data-[state=active]:border-primary-700 data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none" + aria-label={`View ${item.title.toLowerCase()}`} > {item.title} </TabsTrigger> </Link>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
(5 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: OSSAR-Scan
- GitHub Check: cypress-run (1)
🔇 Additional comments (5)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (1)
77-83
: Resolve inconsistent pagination limit values.There are two different limit values being used:
useFilters
hook uses a limit of 15- The component uses a hardcoded limit of 12 for the grid layout
Consider using a single consistent value or document why different values are needed.
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (4)
35-39
: LGTM! Interface update improves type safety.The change from
icon
tovalue
in theNavItem
interface better represents the semantic meaning of the navigation items and aligns with the new tabbed navigation structure.
46-48
: LGTM! Proper hook initialization.The addition of translation and history hooks enhances the component's functionality with internationalization support and navigation capabilities.
50-64
: Verify edge case handling in tab detection.While the navigation setup looks good, consider what happens when the path doesn't match any navItem path. Currently, it defaults to "departments", but this might not always be the desired behavior.
Consider adding error boundaries or explicit handling for unknown paths:
- const currentTab = - navItems.find((item) => item.path === path)?.value || "departments"; + const currentTab = (() => { + const found = navItems.find((item) => item.path === path)?.value; + if (!found) { + console.warn(`No matching tab found for path: ${path}`); + return "departments"; + } + return found; + })();
73-84
: LGTM! Comprehensive loading state implementation.The loading state provides good visual feedback with appropriate skeleton components and proper layout structure.
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
🧹 Nitpick comments (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (1)
103-110
: Enhance back button accessibility.While the back button has an aria-label, it should be wrapped in a proper semantic element for better accessibility.
- <button + <button + type="button" onClick={() => goBack()} - className="mt-1 hover:underline" + className="mt-1 hover:underline inline-flex items-center gap-1" aria-label="Go back" > <CareIcon icon="l-arrow-left" className="h-4 w-4 text-gray-600" /> <span className="text-sm text-gray-600">Back</span> </button>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: cypress-run (1)
- GitHub Check: OSSAR-Scan
- GitHub Check: CodeQL-Build
🔇 Additional comments (3)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (3)
1-40
: LGTM! Well-organized imports and clean interface update.The imports are logically grouped, and the NavItem interface update from
icon
tovalue
aligns well with the new tabbed navigation approach.
47-66
: LGTM! Clean hook implementation and navigation setup.The translation and history hooks are well-integrated, and the navigation items are properly structured with a clean currentTab calculation that handles the default case.
154-171
: LGTM! Clean tabbed navigation implementation.The tabbed navigation is well-implemented with proper styling for active and hover states, and the Link wrapping of TabsTrigger provides good user experience.
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Outdated
Show resolved
Hide resolved
Conflicts have been detected against the base branch. Please merge the base branch into your branch.
|
@abhimanyurajeesh resolve conflicts as well; we've removed support for page level breadcrumbs; |
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
♻️ Duplicate comments (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (1)
116-127
:⚠️ Potential issueFix key prop in breadcrumb mapping.
The fragment and breadcrumb items need proper key props to avoid React warnings and potential reconciliation issues.
- {orgParents.reverse().map((parent) => ( - <> - <BreadcrumbItem key={parent.id}> + {orgParents.reverse().map((parent) => ( + <React.Fragment key={parent.id}> + <BreadcrumbItem> <BreadcrumbLink> <Link href={`${parent.id}`}>{parent.name}</Link> </BreadcrumbLink> </BreadcrumbItem> - <BreadcrumbItem key={`ellipsis-${parent.id}`}> + <BreadcrumbItem> <BreadcrumbSeparator /> </BreadcrumbItem> - </> + </React.Fragment> ))}
🧹 Nitpick comments (1)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (1)
52-62
: Remove commented code for sub-organization counts.The commented code for displaying sub-organization counts should either be implemented or removed to maintain code cleanliness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
public/locale/en.json
(4 hunks)src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
(4 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
🔇 Additional comments (5)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (2)
103-136
: Well-structured responsive navigation layout.The navigation layout with back button, breadcrumbs and responsive design provides good user experience and follows best practices.
155-172
: Clean tab-based navigation implementation.The tabbed navigation using shadcn UI components is well implemented with proper state management and routing.
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (2)
77-81
: Well-implemented pagination with proper caching.The pagination implementation using useFilters hook with proper cache blacklisting and results per page handling is well done.
Also applies to: 89-91
109-125
: Clean search implementation with proper UX.The search functionality with icon, proper placeholder text, and debounced API calls provides a good user experience.
public/locale/en.json (1)
997-1000
: Well-structured localization keys for organization types.The new localization keys follow consistent naming patterns and provide clear translations for different organization types.
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
🔭 Outside diff range comments (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (1)
103-199
:⚠️ Potential issueFix JSX syntax errors.
There are several syntax errors in the JSX structure:
- Missing closing tag for the div at line 104
- Fragment has no corresponding closing tag
Apply this diff to fix the syntax:
- <> + <div className="space-y-4"> <div className="md:px-6 py-2 flex items-center gap-2 mx-auto max-w-4xl"> {/* ... */} + </div> <Page title={`${org.name} `}> {/* ... */} </Page> - </> + </div>🧰 Tools
🪛 Biome (1.9.4)
[error] 137-137: Expected corresponding JSX closing tag for 'Page'.
Opening tag
closing tag
(parse)
🪛 GitHub Check: cypress-run (1)
[failure] 104-104:
JSX element 'div' has no corresponding closing tag.
[failure] 199-199:
Identifier expected.🪛 GitHub Actions: Lint Code Base
[error] 199-199: Parsing error: Identifier expected
🧹 Nitpick comments (2)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (2)
66-67
: Simplify currentTab calculation.The currentTab logic can be simplified using optional chaining and nullish coalescing.
- const currentTab = - navItems.find((item) => item.path === path)?.value || "departments"; + const currentTab = navItems.find((item) => item.path === path)?.value ?? "departments";
89-91
: Enhance error message with more context.Consider providing more descriptive error messages to help users understand why the organization wasn't found.
- return <div>{t("not_found")}</div>; + return <div>{t("organization_not_found", { id })}</div>;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.json
(4 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- public/locale/en.json
🧰 Additional context used
🪛 GitHub Check: cypress-run (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
[failure] 104-104:
JSX element 'div' has no corresponding closing tag.
[failure] 199-199:
Identifier expected.
🪛 GitHub Actions: Lint Code Base
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
[error] 199-199: Parsing error: Identifier expected
🪛 GitHub Actions: Cypress Tests
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
[error] 102-102: JSX fragment has no corresponding closing tag.
[warning] Importing JSON modules is an experimental feature and might change at any time.
🔇 Additional comments (2)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (2)
44-52
: LGTM! Good improvements to navigation and i18n support.The addition of translation and history hooks enhances the component's functionality.
117-128
: Fix key prop in breadcrumb mapping.The fragment and breadcrumb items need proper key props to avoid React warnings and potential reconciliation issues.
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Show resolved
Hide resolved
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 (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (1)
137-176
: Consider removing redundant "defaultValue" from Tabs.
When combined with the controlledvalue
prop,defaultValue
is usually unnecessary.Below is a diff to omit
defaultValue
:-<Tabs - defaultValue={currentTab} - className="w-full mt-2" - value={currentTab} -> +<Tabs className="w-full mt-2" value={currentTab}>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: CodeQL-Build
- GitHub Check: OSSAR-Scan
- GitHub Check: cypress-run (1)
🔇 Additional comments (9)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (9)
3-17
: All newly introduced imports are well-integrated.
No issues found; this is a neat addition that leverages your UI library and i18n effectively.
22-22
: Use of custom history hook looks good.
This provides a more streamlined approach to navigation and fosters code consistency.
49-50
: Proper integration of i18n and custom goBack.
This seamlessly ties into your existing application hooks.
55-61
: Good use of i18n for nav item titles.
This keeps the UI text dynamic and localized.
65-67
: Fallback logic is straightforward.
Ensuring a default tab if path matching fails is a clean approach.
89-89
: Appropriate not-found UI message.
Presenting a localized fallback helps users understand the missing data state.
103-112
: Back button integration is user-friendly.
A clear and intuitive navigation element.
116-127
: Fragment key usage repeats a past concern.
As previously noted, unkeyed fragments with keyed children may cause React warnings or reconciliation issues.
37-41
: Verify removal of the old “icon” property references.
Replacingicon
withvalue
inNavItem
may break any old references that still expect anicon
property.Below is a script to locate potential leftover references to
icon
in.ts
and.tsx
files:✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Find any references to the old "icon" property that might be left behind. rg --type ts --type tsx 'icon\s*:'Length of output: 64
Below is an updated shell script that explicitly searches both
.ts
and.tsx
files so we can verify that no lingering references to the oldicon
property remain:Please run this script and inspect the output. If nothing is returned, it confirms that all references to the removed
icon
property have been cleared. Otherwise, any output will need further manual review to ensure that legacy references are updated.
🏁 Script executed:
[run_scripts] #!/bin/bash # Locate any references to the old "icon" property in both .ts and .tsx files. rg --glob "*.{ts,tsx}" 'icon\s*:'Length of output: 5243
Confirmation of NavItem Update in FacilityOrganizationLayout
- The
FacilityOrganizationLayout.tsx
file now definesNavItem
with avalue
property in place oficon
.- The updated search found several occurrences of
icon:
across the codebase; however, none of these are within the context of theNavItem
interface used by FacilityOrganizationLayout.- References to
icon
seen in files likesrc/common/constants.tsx
, sidebar components, and others appear to serve different purposes and are not related to the navigation items in FacilityOrganizationLayout.Based on the evidence, the removal and replacement in FacilityOrganizationLayout are correct and isolated from other valid uses of the
icon
property.
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
♻️ Duplicate comments (1)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (1)
116-127
:⚠️ Potential issueFix key prop in breadcrumb mapping.
The fragment and breadcrumb items need proper key props to avoid React warnings and potential reconciliation issues.
- {orgParents.reverse().map((parent) => ( - <> - <BreadcrumbItem key={parent.id}> + {orgParents.reverse().map((parent) => ( + <React.Fragment key={parent.id}> + <BreadcrumbItem> <BreadcrumbLink> <Link href={parent.id}>{parent.name}</Link> </BreadcrumbLink> </BreadcrumbItem> - <BreadcrumbItem key={`ellipsis-${parent.id}`}> + <BreadcrumbItem> <BreadcrumbSeparator /> </BreadcrumbItem> - </> + </React.Fragment> ))}
🧹 Nitpick comments (4)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (2)
29-34
: Remove unused propfacilityId
.The
facilityId
prop is declared in the component's props interface but is not used within the component.function OrganizationCard({ org, }: { org: FacilityOrganization; - facilityId: string; }) {
51-61
: Clean up commented code for sub-organization counts.The commented code suggests an incomplete feature for displaying sub-organization counts. Either implement the feature or remove the commented code to maintain code cleanliness.
Would you like me to help implement the sub-organization count feature? This would involve:
- Adding a query to fetch sub-organization counts
- Implementing the loading state
- Displaying the count in the Badge component
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (2)
65-66
: Enhance tab value fallback logic.The current implementation uses a hardcoded fallback value which could cause issues if 'departments' is not a valid value. Consider using the first nav item's value as the default.
- const currentTab = - navItems.find((item) => item.path === path)?.value || "departments"; + const currentTab = + navItems.find((item) => item.path === path)?.value || navItems[0]?.value || "departments";
88-90
: Enhance error state UX.The current error state could be more informative and user-friendly.
- return <div>{t("not_found")}</div>; + return ( + <div className="flex flex-col items-center justify-center p-6"> + <CareIcon icon="l-exclamation-circle" className="h-12 w-12 text-gray-400" /> + <p className="mt-2 text-lg font-medium">{t("not_found")}</p> + <Button + onClick={() => goBack()} + variant="ghost" + size="sm" + className="mt-4" + > + {t("back_to_previous_page")} + </Button> + </div> + );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
(4 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: cypress-run (1)
🔇 Additional comments (6)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (3)
74-101
: Well-implemented search and pagination!The component demonstrates good practices:
- Proper use of useFilters hook for pagination
- Debounced search implementation
- Clean query parameter handling
105-131
: Great UI improvements!The search and layout implementation shows attention to detail:
- Intuitive search input with icon
- Responsive layout with proper spacing
- Clean flex-based alignment
139-162
: Well-structured pagination implementation!The pagination implementation is clean and user-friendly:
- Shows only when needed (count > resultsPerPage)
- Proper handling of empty states
- Clean integration with the OrganizationCard component
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (3)
37-41
: Verify NavItem interface consistency across codebase.The NavItem interface has been updated to use
value
instead oficon
. This change was previously flagged as inconsistent with the organization layout implementation.#!/bin/bash # Search for other NavItem interface definitions rg "interface NavItem" -A 5 --type typescript
48-50
: LGTM! Proper hook initialization.The hooks are correctly initialized and follow React best practices.
155-172
: LGTM! Well-implemented tabs navigation.The tabs implementation is clean, accessible, and follows best practices:
- Uses proper ARIA attributes through shadcn components
- Handles navigation correctly with Link components
- Maintains consistent styling
…rts and simplifying breadcrumb links
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.
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
Outdated
Show resolved
Hide resolved
… and remove unnecessary whitespace
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
♻️ Duplicate comments (2)
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (2)
32-36
:⚠️ Potential issueMaintain consistency in NavItem interface across layouts.
The NavItem interface has been modified to use
value
instead oficon
, which differs from the organization layout implementation. This inconsistency was previously flagged and needs to be addressed.Consider one of these approaches:
- Align both interfaces by updating the organization layout to use
value
- Create separate interfaces with distinct names to avoid confusion
101-115
:⚠️ Potential issueFix React key prop issues in breadcrumb mapping.
The breadcrumb implementation still has key prop issues that need to be addressed:
- Using fragment without key
- Redundant key props on BreadcrumbItem
Apply this fix:
- {orgParents.reverse().map((parent) => ( - <> - <BreadcrumbItem key={parent.id}> + {orgParents.reverse().map((parent) => ( + <React.Fragment key={parent.id}> + <BreadcrumbItem> <BreadcrumbLink asChild className="text-sm text-gray-900 hover:underline hover:underline-offset-2" > <Link href={parent.id}>{parent.name}</Link> </BreadcrumbLink> </BreadcrumbItem> - <BreadcrumbItem key={`ellipsis-${parent.id}`}> + <BreadcrumbItem> <BreadcrumbSeparator /> </BreadcrumbItem> - </> + </React.Fragment> ))}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
(4 hunks)src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: cypress-run (1)
🔇 Additional comments (5)
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx (2)
74-101
: Well-structured implementation with proper pagination and search!The component effectively uses:
- useFilters hook for pagination
- Debounced query for search
- Proper state management
105-131
: Clean and responsive layout implementation!The search and create organization components are well-organized with proper responsive behavior and accessibility features:
- Search icon placement
- Responsive grid
- Clear visual hierarchy
src/pages/Facility/settings/organizations/components/FacilityOrganizationLayout.tsx (3)
43-60
: Well-implemented i18n and navigation setup!The translation integration and tab navigation logic are well-structured. The fallback to "departments" provides good defensive programming.
62-84
: Good implementation of data fetching and loading states!The use of React Query with skeleton loading states provides excellent user feedback, and the error message is properly internationalized.
125-163
: Clean and accessible layout implementation!The page layout with tabs follows good UI practices:
- Proper use of Badge component for organization type
- Accessible tab implementation
- Consistent styling with the design system
src/pages/Facility/settings/organizations/FacilityOrganizationView.tsx
Outdated
Show resolved
Hide resolved
@abhimanyurajeesh 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
Redesigned
Summary by CodeRabbit
New Features
Bug Fixes
Refactor