fix(wallet): honor configured quota units for reward transfers - #5808
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe transfer dialog now derives quota conversion and transfer limits from system currency config instead of a hardcoded constant. Admin quota settings and locale strings now display formatted quota values in the related descriptions. ChangesCurrency-aware quota display and transfer
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/default/src/features/system-settings/general/quota-settings-section.tsx`:
- Around line 143-144: The quota description text in
`quota-settings-section.tsx` is mixing an unnormalized preview value with
untranslated string concatenation. Update the relevant description renderers to
use a normalized quota value from `field.value` (treat empty string as 0 before
calling `formatQuota`) and pass the entire sentence through `t()` with a
`formattedQuota` placeholder instead of appending the formatted value outside
the translation. Apply the same fix in the description blocks used by the quota
fields around `handleNumberChange`, `formatQuota`, and the related localized
text sections.
In `@web/default/src/features/wallet/components/dialogs/transfer-dialog.tsx`:
- Around line 52-63: The transfer dialog is only sanitizing quotaPerUnit for
minimumQuota, but the conversion path still uses the raw store value, which can
make minimumAmount invalid and transferQuota collapse to zero. Update
transfer-dialog.tsx around the useSystemConfigStore, quotaUnitsToDollars, and
parseQuotaFromDollars flow so the same normalized quotaPerUnit is used
consistently for both display and parsing, or move the fallback into the shared
currency formatter/parser helpers. Keep the fallback behavior aligned with
DEFAULT_CURRENCY_CONFIG.quotaPerUnit so the dialog remains usable when the
stored value is non-positive.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5b4fc871-0fa4-468b-ad49-7585f7807075
📒 Files selected for processing (3)
web/default/src/features/system-settings/general/quota-settings-section.tsxweb/default/src/features/wallet/components/dialogs/transfer-dialog.tsxweb/default/src/features/wallet/constants.ts
💤 Files with no reviewable changes (1)
- web/default/src/features/wallet/constants.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/default/src/features/system-settings/general/quota-settings-section.tsx (1)
85-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winNormalize
valueAsNumberbeforeonChange.
valueAsNumbercan beNaNfor intermediate invalid number input, andvalue={field.value ?? ''}will pass that through to the controlled field. CoerceNaNto''here to avoid React’sNaNvalue warning and keep editing stable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/system-settings/general/quota-settings-section.tsx` around lines 85 - 90, Normalize the value passed from handleNumberChange before calling onChange, since event.currentTarget.valueAsNumber can produce NaN for temporary invalid input and then flow into the controlled field via value={field.value ?? ''}. Update the handleNumberChange logic in quota-settings-section.tsx so it coerces NaN to an empty string instead of forwarding it, keeping the input stable and avoiding React warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@web/default/src/features/system-settings/general/quota-settings-section.tsx`:
- Around line 85-90: Normalize the value passed from handleNumberChange before
calling onChange, since event.currentTarget.valueAsNumber can produce NaN for
temporary invalid input and then flow into the controlled field via
value={field.value ?? ''}. Update the handleNumberChange logic in
quota-settings-section.tsx so it coerces NaN to an empty string instead of
forwarding it, keeping the input stable and avoiding React warnings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ef6805cb-4129-4424-b70a-67d5dff1b0d1
📒 Files selected for processing (7)
web/default/src/features/system-settings/general/quota-settings-section.tsxweb/default/src/i18n/locales/en.jsonweb/default/src/i18n/locales/fr.jsonweb/default/src/i18n/locales/ja.jsonweb/default/src/i18n/locales/ru.jsonweb/default/src/i18n/locales/vi.jsonweb/default/src/i18n/locales/zh.json
✅ Files skipped from review due to trivial changes (3)
- web/default/src/i18n/locales/en.json
- web/default/src/i18n/locales/ru.json
- web/default/src/i18n/locales/vi.json
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input (cherry picked from commit 90fa6fe)
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
…umNous#5808) * fix(wallet): honor configured quota units for reward transfers * fix(i18n): localize quota preview descriptions * fix(settings): normalize invalid quota input
Important
📝 变更描述 / Description
修复 default 主题邀请奖励转余额弹窗的单位不一致问题。
转账输入现在使用站点当前配置的额度展示单位,并在提交前转换为后端所需的原始 quota。最低金额、步进和可转上限也会根据
quota_per_unit及当前货币汇率动态计算,不再依赖前端硬编码的500000。同时在后台的新用户额度、邀请者奖励和受邀者奖励字段下增加格式化金额预览,方便管理员确认原始 quota 对应的实际展示金额。
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
转账输入站点配置的单位数值即可,不再始终需要输入原始 quota。
Summary by CodeRabbit
formattedQuotaplaceholder.