-
Notifications
You must be signed in to change notification settings - Fork 214
ui/ux : disable filters on empty data #53
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
Conversation
@islamBelabbes is attempting to deploy a commit to the 9d8 Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe filter component for posts now disables the dropdown selectors for tags, categories, and authors when their respective lists are empty. In such cases, a message indicating the absence of options is displayed instead of the usual placeholder. The authors' selector also receives a centered text style when disabled. Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/posts/filter.tsxOops! Something went wrong! :( ESLint: 9.26.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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)
components/posts/filter.tsx (1)
87-93
: Consider consistent coding styleWhile this implementation works correctly, there's an inconsistency in coding style between this and the tags implementation. The tags use a one-line ternary while categories use a multi-line approach.
- <SelectTrigger disabled={!hasCategories}> - {hasCategories ? ( - <SelectValue placeholder="All Categories" /> - ) : ( - "No categories found" - )} + <SelectTrigger disabled={!hasCategories}> + {hasCategories ? <SelectValue placeholder="All Categories" /> : "No categories found"} </SelectTrigger>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/posts/filter.tsx
(3 hunks)
🔇 Additional comments (3)
components/posts/filter.tsx (3)
60-62
: Good addition of helper variablesAdding these boolean flags improves readability and makes the conditional rendering logic cleaner throughout the component.
70-71
: Good implementation of disabled state for empty tagsThe conditional rendering and disabled state work well together to provide a good user experience when no tags are available.
108-113
: Inconsistent styling for authors dropdownThe authors dropdown has a "text-center" class that's not applied to the other dropdowns, creating an inconsistency in the UI. Is this intentional?
Either apply the same centering to all dropdowns for consistency:
- <SelectTrigger disabled={!hasTags}> + <SelectTrigger disabled={!hasTags} className="text-center">- <SelectTrigger disabled={!hasCategories}> + <SelectTrigger disabled={!hasCategories} className="text-center">Or remove it from the authors dropdown if it's not needed:
- <SelectTrigger disabled={!hasAuthors} className="text-center"> + <SelectTrigger disabled={!hasAuthors}>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
disable filter buttons if the searched data does not exist
before :


after :


Summary by CodeRabbit