Skip to content

fix(users): prevent large quota values from overflowing - #6134

Merged
Calcium-Ion merged 1 commit into
mainfrom
fix/users-quota-overflow
Jul 14, 2026
Merged

fix(users): prevent large quota values from overflowing#6134
Calcium-Ion merged 1 commit into
mainfrom
fix/users-quota-overflow

Conversation

@QuentinHsu

@QuentinHsu QuentinHsu commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

问题描述

  • 用户列表中的额度列宽度不足。
  • 当剩余额度和总额度数值较大时,文本会相互挤压并溢出到相邻列。

修复方式

  • 将额度列默认宽度调整为 300px,并设置 260px 的最小宽度。
  • 使用双列网格展示剩余额度和总额度,增加固定间距并分别左右对齐。
  • 将超长额度文本限制在单元格内截断,完整数值仍可通过 Tooltip 查看。
  • 将额度展示逻辑提取为独立的 UserQuotaCell 组件。
  • 保留零额度状态、额度百分比和进度条颜色逻辑。

测试说明

  • 目标文件格式检查通过。
  • 目标文件 oxlint 检查通过。
  • TypeScript 类型检查通过。
  • 前端生产构建通过。
  • 已完成登录后页面的视觉验证。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • bunx oxfmt --check src/features/users/components/users-columns.tsx src/features/users/components/user-quota-cell.tsx
  • bunx oxlint -c .oxlintrc.json src/features/users/components/users-columns.tsx src/features/users/components/user-quota-cell.tsx
  • bun run typecheck
  • bun run build

Summary by CodeRabbit

  • New Features
    • Added a dedicated quota status display for users.
    • Quota usage now shows remaining and total amounts, usage percentage, and a color-coded progress indicator.
    • Users with no assigned quota see a clear “No Quota” status.

- widen the quota column and add consistent spacing between remaining and total values.
- extract quota rendering into a dedicated component and truncate oversized text within the cell.
- preserve full-value tooltips, progress indicators, and the zero-quota state.
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

User quota display

Layer / File(s) Summary
Quota cell rendering
web/default/src/features/users/components/user-quota-cell.tsx
Adds UserQuotaCell to calculate quota totals and percentages, select progress colors, and render quota details or a “No Quota” badge.
Quota column integration
web/default/src/features/users/components/users-columns.tsx
Replaces the inline quota UI with UserQuotaCell, passing the user’s used and remaining quota values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a bunny with a quota to show,
With emerald bars that gently glow.
Remaining, total, used in sight,
A tidy tooltip makes it right.
No quota? A badge says so—
Hop, hop, overflow must go!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR addresses issue #6123 by refactoring quota rendering to prevent large values from overflowing in the user list.
Out of Scope Changes check ✅ Passed The changes stay focused on quota cell rendering and overflow handling, with no unrelated functionality added.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: preventing oversized user quota values from overflowing in the user list.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/users-quota-overflow

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 9a2d660 into main Jul 14, 2026
2 checks passed
JacksonsY added a commit to JacksonsY/new-api that referenced this pull request Jul 15, 2026
上游 7c28993..a63364d:
- fix: purge authentication data on hard user deletion (QuantumNous#6168) —— 硬删用户时清理
  2FA/备份码/Passkey/Token/OAuth 绑定 + 缓存失效(安全修复,跟上游)。后端文件
  (model/user.go、token.go、twofa.go、controller/user.go、telegram.go) 自动合并为
  并集:上游清理逻辑 + fork 供应商字段/隐藏敏感字段均完整保留(逐文件校验新增行数与
  上游一致)。
- fix: infer MiniMax vendor for MiniMax models (QuantumNous#6164) —— 常规修复,跟上游。
- fix(users): prevent large quota values from overflowing (QuantumNous#6134) —— 纯前端「单元格文本
  溢出」的显示修复(非整数溢出)。冲突文件 users-columns.tsx 按「界面归我们」保留 fork 版
  (语义色 token bg-destructive/warning/success + StatusBadge children API + 卡片式
  meta cardRole/cardSpan/contentMode),未采用上游抽出的 user-quota-cell.tsx(其用
  base 时代的硬编码色/label API,与 fork 设计系统已分叉),该新组件在本合并中删除。

go build ./... 通过;model/controller 测试(含上游新增 user_authentication/telegram/
task_cas 测试)全绿;前端树与 fork HEAD 等价。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fux-dev pushed a commit to fux-dev/new-api that referenced this pull request Jul 19, 2026
…6134)

- widen the quota column and add consistent spacing between remaining and total values.
- extract quota rendering into a dedicated component and truncate oversized text within the cell.
- preserve full-value tooltips, progress indicators, and the zero-quota state.
@Calcium-Ion
Calcium-Ion deleted the fix/users-quota-overflow branch July 21, 2026 06:46
jiweiyeah added a commit to jiweiyeah/yutou-api that referenced this pull request Jul 25, 2026
Synced upstream/main (8739c055a6c53d, 49 commits) into custom.

Conflicts resolved by keeping custom side per user instruction:
- controller/user.go: kept custom subscription filter + total_topup sort
- model/user.go: kept custom queryUsers delegation (GetAllUsers/GetAllUsersFiltered/SearchUsers)
- model/channel_cache.go: kept custom performance monitoring (RecordCacheSync)
- web/default/src/features/users/components/users-columns.tsx: kept custom imports (formatNumber, cn)
- web/default/src/features/users/components/users-table.tsx: kept custom controlled sorting + server-side ordering + subscriptionFilter

Removed upstream test model/user_pagination_test.go — depends on the
upstream sortOptions-based GetAllUsers/SearchUsers signatures that custom
side does not expose (custom uses queryUsers with subStatus/orderBy/orderDir).

Verified: go build ./... and web/default tsc --noEmit both pass.

Notable upstream fixes absorbed:
- QuantumNous#6225 prevent duplicate tool calls in Responses→Chat streaming
- QuantumNous#6194 server-side sorting for user list (fix paged-data client-sort bug)
- QuantumNous#6134 prevent large quota values from overflowing
- QuantumNous#6168 purge authentication data on hard user deletion
- QuantumNous#6096 golang.org/x/crypto 0.51.0 → 0.52.0
- Deadlock fix in channel_cache.go (InvalidatePricingCache lock ordering)
  NOT absorbed — custom side keeps performance monitoring branch.
  Manual review needed if pricing cache staleness is observed.
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
…6134)

- widen the quota column and add consistent spacing between remaining and total values.
- extract quota rendering into a dedicated component and truncate oversized text within the cell.
- preserve full-value tooltips, progress indicators, and the zero-quota state.
MinTiang pushed a commit to MinTiang/new-api that referenced this pull request Aug 6, 2026
…6134)

- widen the quota column and add consistent spacing between remaining and total values.
- extract quota rendering into a dedicated component and truncate oversized text within the cell.
- preserve full-value tooltips, progress indicators, and the zero-quota state.
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
…6134)

- widen the quota column and add consistent spacing between remaining and total values.
- extract quota rendering into a dedicated component and truncate oversized text within the cell.
- preserve full-value tooltips, progress indicators, and the zero-quota state.
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.

用户列表额度字段显示溢出,旧UI显示正常

2 participants