-
Notifications
You must be signed in to change notification settings - Fork 477
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
Enhanced the Asset Page header layout #9472
Enhanced the Asset Page header layout #9472
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
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
🧹 Nitpick comments (1)
src/components/Assets/AssetsList.tsx (1)
Line range hint
351-464
: Consider optimizing the nested layout structureWhile the layout improvements align with the PR objectives, consider simplifying the nested div structure for better maintainability.
Consider this simplified structure:
-<div className="flex w-full flex-col gap-2 items-center justify-between lg:flex-row"> - <div className="flex flex-col w-full lg:w-auto md:flex-row"> +<div className="grid grid-cols-1 lg:grid-cols-2 gap-2 w-full items-center"> + <div className="flex flex-col md:flex-row w-full lg:w-auto">
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/Assets/AssetsList.tsx
(6 hunks)
🔇 Additional comments (4)
src/components/Assets/AssetsList.tsx (4)
18-18
: LGTM: Search-related configuration changes are well-structured
The addition of SearchByMultipleFields and the corresponding hook configuration with proper cache management for search fields is implemented correctly.
Also applies to: 40-40, 44-44
59-62
: LGTM: Search parameters are properly configured
The new search parameters are well-structured with appropriate default values, ensuring clean query parameter handling.
318-343
: LGTM: Search options are well-configured with accessibility features
The search configuration includes clear labels, placeholders, and keyboard shortcuts, enhancing user experience and accessibility.
481-481
: LGTM: Filter badge integration is consistent
The new name filter badge is properly integrated with the existing filter system.
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: 2
🧹 Nitpick comments (1)
src/components/Assets/AssetsList.tsx (1)
467-473
: Consider adding tests for the new search functionalityThe new search implementation would benefit from automated tests to verify:
- Multiple field search behavior
- Keyboard shortcut functionality
- Search parameter handling
Would you like me to help create test cases for the new search functionality?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/Assets/AssetsList.tsx
(6 hunks)
🔇 Additional comments (3)
src/components/Assets/AssetsList.tsx (3)
11-12
: LGTM: Import and hook configuration changes are appropriate
The new imports and hook configuration support the enhanced search functionality. The cacheBlacklist configuration correctly prevents caching of search parameters.
Also applies to: 19-19, 46-46
467-473
: LGTM: Search implementation with keyboard shortcuts
The SearchByMultipleFields implementation provides a good user experience with:
- Multiple search fields for different asset properties
- Keyboard shortcuts for quick access
- Clear placeholders for better usability
Line range hint 357-453
: LGTM: Improved header layout with responsive design
The new layout structure provides:
- Better organization of buttons and controls
- Responsive design that adapts to different screen sizes
- Consistent spacing and alignment
- Clear visual hierarchy
<SearchByMultipleFields | ||
id="asset-search" | ||
options={searchOptions} | ||
onSearch={(key, value) => updateQuery({ search: value })} |
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.
🛠️ Refactor suggestion
Consider updating search callback to utilize multiple fields
The current onSearch implementation updates a single 'search' query parameter, which doesn't fully utilize the multiple field search capability. Consider updating the search fields individually.
Consider this approach:
- onSearch={(key, value) => updateQuery({ search: value })}
+ onSearch={(key, value) => updateQuery({ [key]: value })}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
onSearch={(key, value) => updateQuery({ search: value })} | |
onSearch={(key, value) => updateQuery({ [key]: value })} |
const searchOptions = [ | ||
{ | ||
key: "name", | ||
label: "Name", | ||
type: "text" as const, | ||
placeholder: "Search by Name", | ||
value: qParams.name || "", | ||
shortcutKey: "n", | ||
}, | ||
{ | ||
key: "serial_number", | ||
label: "Serial No.", | ||
type: "text" as const, | ||
placeholder: "Search by Serial No.", | ||
value: qParams.serial_number || "", | ||
shortcutKey: "u", | ||
}, | ||
{ | ||
key: "asset_qr_id", | ||
label: "QR Code ID", | ||
type: "text" as const, | ||
placeholder: "Search by QR Code ID", | ||
value: qParams.qr_code_id || "", | ||
shortcutKey: "p", | ||
}, | ||
]; |
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.
Fix inconsistency in search option key naming
The asset_qr_id
key in searchOptions doesn't match the parameter name qr_code_id
used in the params object (line 64). This mismatch could cause search functionality to break.
Apply this fix:
- key: "asset_qr_id",
+ key: "qr_code_id",
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const searchOptions = [ | |
{ | |
key: "name", | |
label: "Name", | |
type: "text" as const, | |
placeholder: "Search by Name", | |
value: qParams.name || "", | |
shortcutKey: "n", | |
}, | |
{ | |
key: "serial_number", | |
label: "Serial No.", | |
type: "text" as const, | |
placeholder: "Search by Serial No.", | |
value: qParams.serial_number || "", | |
shortcutKey: "u", | |
}, | |
{ | |
key: "asset_qr_id", | |
label: "QR Code ID", | |
type: "text" as const, | |
placeholder: "Search by QR Code ID", | |
value: qParams.qr_code_id || "", | |
shortcutKey: "p", | |
}, | |
]; | |
const searchOptions = [ | |
{ | |
key: "name", | |
label: "Name", | |
type: "text" as const, | |
placeholder: "Search by Name", | |
value: qParams.name || "", | |
shortcutKey: "n", | |
}, | |
{ | |
key: "serial_number", | |
label: "Serial No.", | |
type: "text" as const, | |
placeholder: "Search by Serial No.", | |
value: qParams.serial_number || "", | |
shortcutKey: "u", | |
}, | |
{ | |
key: "qr_code_id", | |
label: "QR Code ID", | |
type: "text" as const, | |
placeholder: "Search by QR Code ID", | |
value: qParams.qr_code_id || "", | |
shortcutKey: "p", | |
}, | |
]; |
@nithish1018 previous pulled request was closed by me mistakenly which leads to unassign the issue, can you assign the #9349 again as I am still working on that issue, migrating the dropdown to shadcn dropdown in Export.tsx component as asked |
Hey @manmeetnagii I can't assign issues. |
Duplicate of #9466 |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Summary by CodeRabbit
New Features
Bug Fixes
UI Improvements