fix(web/default): api-info color dot shows wrong color due to semantic token mismatch#4824
fix(web/default): api-info color dot shows wrong color due to semantic token mismatch#4824Micah-Zheng wants to merge 2 commits into
Conversation
Signed-off-by: Micah-Zheng <[email protected]>
… color display Signed-off-by: Micah-Zheng <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR consolidates semantic color background class mappings to explicit Tailwind utilities and refactors the API info section component to derive badge colors from the centralized ChangesColor System Centralization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
问题描述
系统管理 → 内容 → API 地址页面,设置徽章颜色后,概览页面 API 信息卡片里显示的颜色与设置的颜色不一致(例如设置 Blue 显示红色,设置 Purple 显示黄色)。
根本原因
colorToBgClass(lib/colors.ts)将颜色名映射到语义 token(bg-chart-1、bg-warning等),而这些 token 的实际颜色与颜色名称不对应:同时,设置页面的颜色预览用的是 Tailwind 硬编码类(
bg-blue-500),而概览卡片用的是getBgColorClass(语义 token),两套系统不一致,导致设置页面预览正确但概览卡片显示错误。修复方案
colorToBgClass改用直接的 Tailwind 颜色类(bg-blue-500、bg-green-500等),确保颜色名与显示颜色一致getBgColorClass,与概览卡片保持一致slate到SemanticColor类型和colorToBgClass映射(前端颜色选项已有slate但类型定义缺失)影响范围
colorToBgClass目前仅被api-info-item.tsx和api-info-section.tsx使用,影响范围仅限 API 地址功能。Signed-off-by: Micah-Zheng [email protected]
Summary by CodeRabbit
New Features
Refactor