Skip to content

refactor(log): 恢复费用气泡并用图标区分订阅来源 - #7451

Merged
Calcium-Ion merged 2 commits into
mainfrom
codex/usage-log-cost-bubbles
Sep 18, 2026
Merged

Calcium-Ion merged 2 commits into
mainfrom
codex/usage-log-cost-bubbles

Conversation

@Calcium-Ion

Copy link
Copy Markdown
Member

⚠️ 提交说明 / PR Notice

🔗 关联任务 / Related Issue

延续 #7450 的费用来源展示调整。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

📝 变更描述 / Description

费用栏恢复单行气泡,使用皇冠/钱包图标区分扣费来源,悬停或键盘聚焦显示说明。复用 StatusBadge 和 Tooltip,金额继续直接显示。

管理员视图按系统是否有启用的套餐展示图标;仅自己视图按本人是否有激活订阅展示,过期记录不触发图标。保留订阅实际扣减量、零值及工具附加费标记。

📸 运行证明 / Proof of Work

基于 ea336ed66,以下命令在独立工作树的 web/ 下执行:

  • bun run typecheck:退出码 0。
  • bun run build:退出码 0,生产构建完成。
  • 以下回归测试:4 个文件、41 项通过,覆盖金额、图标提示、管理员/仅自己切换、禁用套餐、过期订阅及移动端。
bun run test src/features/usage-logs/components/__tests__/cost-display.test.tsx src/features/usage-logs/components/__tests__/billing-source-visibility.test.tsx src/features/usage-logs/lib/__tests__/billing-source.test.ts src/features/usage-logs/components/__tests__/mobile-card.test.tsx
  • 以下 lint:退出码 0;6 个修改文件的格式检查及 git diff --check 通过。
bunx --no-install oxlint -c .oxlintrc.json src/features/usage-logs/components/log-cost-display.tsx src/features/usage-logs/components/usage-logs-table.tsx src/features/usage-logs/components/__tests__/cost-display.test.tsx src/features/usage-logs/components/__tests__/billing-source-visibility.test.tsx src/features/usage-logs/lib/billing-source.ts src/features/usage-logs/lib/__tests__/billing-source.test.ts

内置浏览器验证真实费用组件的模拟数据预览:图标与金额同排,第五行在来源标识关闭时只显示金额,零扣减显示 $0。

费用气泡预览

✅ 提交前检查项 / Checklist

  • 人工确认: 待维护者最终审阅描述并确认。
  • 非重复提交: 已检索现有 Issues 与 PRs;本次在 fix: hide source labels when subscriptions are not in play #7450 基础上调整样式及仅自己视图规则。
  • 新功能关联 Issue: 不适用,本次为现有 UI 调整。
  • 事前沟通: 按维护者本次明确要求实施。
  • 功能范围: 不涉及 Coding Plan、逆向渠道、第三方封装或 Codex 渠道。
  • 非透传: 不涉及透传转发。
  • 范围聚焦: 单个提交,仅包含费用显示相关代码、测试及预览截图。
  • 本地验证: 实际命令及结果见上。
  • 安全合规: 未包含凭据;未修改认证、计费结算或数据库。

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Calcium-Ion
Calcium-Ion merged commit 96b0da2 into main Sep 18, 2026
Javabcd pushed a commit to Javabcd/new-api that referenced this pull request Sep 22, 2026
* refactor(log): restore compact cost bubbles and source icons

* Delete .github/pr-previews/usage-log-cost-bubbles.png
GuDong2003 pushed a commit to GuDong2003/new-api that referenced this pull request Sep 25, 2026
* refactor(log): restore compact cost bubbles and source icons

* Delete .github/pr-previews/usage-log-cost-bubbles.png

(cherry picked from commit 96b0da2)
TomJKS pushed a commit to TomJKS/new-api that referenced this pull request Sep 28, 2026
* refactor(log): restore compact cost bubbles and source icons

* Delete .github/pr-previews/usage-log-cost-bubbles.png
meatRoll pushed a commit to meatRoll/new-api that referenced this pull request Oct 12, 2026
* refactor(log): restore compact cost bubbles and source icons

* Delete .github/pr-previews/usage-log-cost-bubbles.png
@Calcium-Ion
Calcium-Ion deleted the codex/usage-log-cost-bubbles branch October 22, 2026 04:56
xiaolanawaqaq pushed a commit to xiaolanawaqaq/new-apiaaa that referenced this pull request Nov 26, 2026
* refactor(log): restore compact cost bubbles and source icons

* Delete .github/pr-previews/usage-log-cost-bubbles.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant