fix: add my-quota page for non-admin users#419
Conversation
Non-admin users could see "Quotas" nav but were redirected away. Now they see "My Quota" nav linking to a read-only quota view. - Add /dashboard/my-quota page reusing QuotaCards component - Update nav to show role-specific labels and routes - Unify redirect targets for non-admin users - Add i18n keys for all 5 languages Closes #412 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @ding113, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the user experience by providing non-admin users with a personalized view of their quotas through a new 'My Quota' page. It intelligently adjusts the navigation menu based on user roles and standardizes the redirection behavior for non-admin users who might inadvertently try to access admin-specific quota management sections, ensuring they are guided to their relevant quota information. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🧪 测试结果
总体结果: ✅ 所有测试通过 |
There was a problem hiding this comment.
Code Review
This pull request introduces a dedicated 'My Quota' page for non-admin users, which is a great improvement for user experience. The changes correctly update the navigation to be role-aware and unify redirects for admin-only quota pages. The implementation is solid, including the necessary internationalization updates. I have a couple of suggestions to further improve the code.
| ...(isAdmin | ||
| ? [{ href: "/dashboard/quotas", label: t("quotasManagement") }] | ||
| : [{ href: "/dashboard/my-quota", label: t("myQuota") }]), | ||
| { href: "/dashboard/users", label: t("userManagement") }, |
There was a problem hiding this comment.
The userManagement link should only be visible to admin users. You should add adminOnly: true to this navigation item to prevent non-admin users from seeing a link to a page they cannot access. This would make it consistent with the other admin-only links and the changes you've made for the quotas link.
| { href: "/dashboard/users", label: t("userManagement") }, | |
| { href: "/dashboard/users", label: t("userManagement"), adminOnly: true }, |
| <div> | ||
| <h3 className="text-lg font-medium">{tNav("myQuota")}</h3> | ||
| </div> |
- Add error state handling in my-quota page (show Alert instead of empty state) - Fix quotas/keys redirect to /dashboard/my-quota for consistency Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review Summary
No significant issues identified in this PR.
PR Size: M
- Lines changed: 46
- Files changed: 10
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - Clean
- Type safety - Clean
- Documentation accuracy - Clean
- Test coverage - Adequate
- Code clarity - Good
Automated review by Codex AI
There was a problem hiding this comment.
- Identified open PR
#419and reviewed all diff hunks (46 LOC across 10 files). - Applied label
size/Mto PR#419. - Submitted a PR review summary comment via
gh pr review; no inline comments left because no issues met the ≥80 confidence threshold on changed lines.
🧪 测试结果
总体结果: ✅ 所有测试通过 |
Simplifies the JSX structure by removing unnecessary inner div elements in both the error state and success state render paths. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🧪 测试结果
总体结果: ✅ 所有测试通过 |
Summary
/dashboard/my-quotapage for non-admin users to view their quota (read-only)Closes #412
Test plan
/dashboard/quotascanLoginWebUi, verify "My Quota" nav links to/dashboard/my-quota/dashboard/my-quotadisplays QuotaCards correctly/dashboard/quotasredirects to/dashboard/my-quotaGenerated with Claude Code