-
Notifications
You must be signed in to change notification settings - Fork 521
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: Sort Permissions #2165
fix: Sort Permissions #2165
Conversation
|
📝 WalkthroughWalkthroughThe changes in this pull request focus on the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
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 (
|
@Vardhaman619 is attempting to deploy a commit to the Unkey Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions for pull request titles! 🙏 |
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 and nitpick comments (1)
apps/dashboard/app/(app)/authorization/permissions/page.tsx (1)
5-5
: Overall: Effective implementation of permission sortingThe changes successfully address the PR objective by implementing alphabetical sorting of permissions. The implementation is clean and localized to the permissions page.
As a potential enhancement, consider making the sorting direction (ascending/descending) configurable. This could provide more flexibility for users who might prefer a different sorting order.
Here's a suggestion to make the sorting direction configurable:
- Add a new state variable to track the sorting direction:
const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc');
- Modify the query to use the state variable:
orderBy: [sortDirection === 'asc' ? asc(permissions.name) : desc(permissions.name)],
- Add a UI element (e.g., a button) to toggle the sort direction:
<Button onClick={() => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc')}> Toggle Sort Direction </Button>This enhancement would provide users with more control over how permissions are displayed.
Also applies to: 22-22
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- apps/dashboard/app/(app)/authorization/permissions/page.tsx (2 hunks)
🔇 Additional comments (1)
apps/dashboard/app/(app)/authorization/permissions/page.tsx (1)
5-5
: LGTM: Import modification for sortingThe addition of
asc
to the import statement is appropriate for implementing the sorting functionality required by the PR objectives.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Looks good to me.
Thanks
What does this PR do?
This PR addresses the issue of permission tables not being sorted correctly. Currently, the user interface displays permission entries in an inconsistent order, making it difficult for users to locate specific permissions quickly. This update ensures that the permission tables are sorted alphabetically by permission name, improving user experience and accessibility.
Fixes #2157
Issue #2157
Type of change
How should this be tested?
To verify the changes, please follow these steps:
Checklist
Required
pnpm build
pnpm fmt
console.logs
git pull origin main
Appreciated
Summary by CodeRabbit
New Features
Bug Fixes