Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used🧬 Code graph analysis (1)web/src/pages/api-tokens/index.tsx (2)
🔇 Additional comments (8)
📝 WalkthroughWalkthrough将 API 令牌页面中的 devMode 从表格列移除,改为在创建与编辑对话框中作为内联开关管理;创建/编辑请求中包含 devMode;对话框关闭和表单重置逻辑更新以清理 devMode 状态和编辑态。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/src/pages/api-tokens/index.tsx (1)
481-486: 编辑弹窗关闭逻辑可抽取为单一方法。Line 481-486 与 Line 569-572 的关闭/清理逻辑重复,建议抽成
closeEditDialog(),减少后续状态字段增加时的漏改风险。Also applies to: 566-573
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/src/pages/api-tokens/index.tsx` around lines 481 - 486, The onOpenChange handler duplicates cleanup logic (calling setEditingToken(null) and resetForm()) in multiple places; extract that into a single function named closeEditDialog() and replace the repeated blocks at the onOpenChange sites (and the similar logic around lines referenced, e.g., the blocks that currently call setEditingToken(null) and resetForm() at the other dialog close handlers) with a call to closeEditDialog(), ensuring all dialog-close paths invoke it so future state additions only need one update.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web/src/pages/api-tokens/index.tsx`:
- Around line 550-559: The label for the developer mode switch is not
programmatically associated with the Switch component (label text at the JSX
around {t('apiTokens.devMode')}), so assistive tech may not announce it; update
the markup to add a unique id (e.g., devModeSwitchId) used as htmlFor on the
label and passed to the Switch component (or add an aria-label/aria-labelledby
prop on the Switch) while preserving the existing props (checked={devMode},
onCheckedChange={setDevMode}, disabled={updateToken.isPending}) so the control
becomes accessible to screen readers.
---
Nitpick comments:
In `@web/src/pages/api-tokens/index.tsx`:
- Around line 481-486: The onOpenChange handler duplicates cleanup logic
(calling setEditingToken(null) and resetForm()) in multiple places; extract that
into a single function named closeEditDialog() and replace the repeated blocks
at the onOpenChange sites (and the similar logic around lines referenced, e.g.,
the blocks that currently call setEditingToken(null) and resetForm() at the
other dialog close handlers) with a call to closeEditDialog(), ensuring all
dialog-close paths invoke it so future state additions only need one update.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/pages/api-tokens/index.tsx
📜 Review details
🧰 Additional context used
🧬 Code graph analysis (1)
web/src/pages/api-tokens/index.tsx (2)
web/src/components/ui/index.ts (3)
Switch(51-51)DialogFooter(42-42)Button(2-2)web/src/components/ui/button.tsx (1)
Button(58-58)
🔇 Additional comments (1)
web/src/pages/api-tokens/index.tsx (1)
118-127: devMode 的“编辑后保存提交”链路实现正确。Line 126 将
devMode并入更新 payload,且 Line 158 在进入编辑态时正确回填,和 Line 90 的重置逻辑配合良好,行为与 PR 目标一致。Also applies to: 152-159
Summary
Testing
Summary by CodeRabbit