Repository navigation
feat: add paginated invite details - #6364
Sunshine-JamesHu wants to merge 1 commit into
Conversation
WalkthroughAdds an authenticated invitee-history endpoint and connects it to a paginated wallet dialog. Invitee names are masked, new invitees are marked, deleted records are included, and interface translations are added across supported locales. ChangesInvitee history
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Wallet as Wallet UI
participant API as getUserInvitees
participant Endpoint as GET /api/user/aff/invitees
participant Query as GetUserInvitees model query
Wallet->>API: request page and page size
API->>Endpoint: send paginated GET request
Endpoint->>Query: fetch invitees and total
Query-->>Endpoint: masked invitee records
Endpoint-->>API: typed response
API-->>Wallet: render rows and pagination
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 Warning |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/features/wallet/components/dialogs/invitees-dialog.tsx (1)
69-79: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winConsider
placeholderData: keepPreviousDatafor pagination
Page or page-size changes currently replace the table with the full skeleton again. Keeping the previous rows visible while the next page loads will remove the flicker.🤖 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/src/features/wallet/components/dialogs/invitees-dialog.tsx` around lines 69 - 79, Update the useQuery configuration in the invitees dialog to use TanStack Query’s keepPreviousData placeholder behavior for page and pageSize changes. Import the required keepPreviousData helper if needed, while preserving the existing loading and query behavior.
🤖 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.
Nitpick comments:
In `@web/src/features/wallet/components/dialogs/invitees-dialog.tsx`:
- Around line 69-79: Update the useQuery configuration in the invitees dialog to
use TanStack Query’s keepPreviousData placeholder behavior for page and pageSize
changes. Import the required keepPreviousData helper if needed, while preserving
the existing loading and query behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7c45f792-9072-4be5-9ef5-c42833eb4aa9
📒 Files selected for processing (16)
controller/user.gomodel/user_invitee.gomodel/user_invitee_test.gorouter/api-router.goweb/src/features/wallet/api.tsweb/src/features/wallet/components/affiliate-rewards-card.tsxweb/src/features/wallet/components/dialogs/invitees-dialog.tsxweb/src/features/wallet/index.tsxweb/src/features/wallet/types.tsweb/src/i18n/locales/en.jsonweb/src/i18n/locales/fr.jsonweb/src/i18n/locales/ja.jsonweb/src/i18n/locales/ru.jsonweb/src/i18n/locales/vi.jsonweb/src/i18n/locales/zh-TW.jsonweb/src/i18n/locales/zh.json
51fdfc5 to
2b6f1df
Compare
…tistics Complete the RF-07 invitation statistics panel so the administrator summary, list filters and CSV export cover every recorded commission state. The inviter view keeps exposing only the payable pipeline. - model: the per-invitation aggregates and the filter-aware summary bucket the refused events (review, blocked, rejected) alongside pending/locked/settled, so the buckets add up to the recorded total; the commission-status validation accepts all six recorded states. - controller: the administrator item embeds the admin-only refused fields while the self item stays payable-only and masked; the CSV export gains review_quota, blocked_quota and rejected_quota (17 columns); the endpoints stay read-only and never move a balance. - web: label and filter the refused states, show all six buckets in the admin dialog summary, keep the commission total across all six states, register the dynamic label keys, and cover the admin dialog with regression tests (summary, refused row, keyword filter, CSV export, disabled export on the empty state). - i18n: 28 new keys in all seven locales. `node scripts/add-missing-keys.mjs` could not be executed in this sandbox, so the keys were inserted at their ICU-sorted anchors and normalized with `node scripts/sync-i18n.mjs`, which reports missingCount=0 and extrasCount=0. Tests: TestReferralInvitationStats seeds refused events and asserts the six buckets, their sum against the recorded total and the blocked filter; TestReferralInvitationQueryValidation accepts all six states; TestReferralInvitationStatisticsEndpoints covers masking, cross-inviter isolation, the admin-only refused fields, filter errors, the 17-column CSV and an unchanged balance. Inspired-by: QuantumNous#6364 Inspired-by: QuantumNous#4197 Local tests not run (CI-only session).
Important
📝 变更描述 / Description
在钱包邀请统计中增加分页详情入口。用户点击邀请人数后可查看通过其邀请链接注册的用户,并可调整每页数量、前后翻页、重试失败请求。
后端新增已认证的
/api/user/aff/invitees接口,使用 GORM 按邀请人隔离并稳定分页。响应仅包含脱敏显示名、邀请时间和当日新增标记,不暴露被邀请人的用量、状态或注销信息;软删除用户仍计入历史邀请。前端适配当前
web/目录、Base UI 和 Hugeicons,并为 en、zh、zh-TW、fr、ja、ru、vi 补齐文案。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Summary by CodeRabbit