app-monorepo
app-monorepo copied to clipboard
feat: earn support show pending activation OK-33127 OK-33196 OK-33198
Summary by CodeRabbit
-
新功能
- 添加了获取待激活投资组合列表的功能,以便用户管理质押活动。
- 更新了交易记录和投资组合详情的显示逻辑,增强用户体验。
-
Bug 修复
- 修复了在无交易时显示消息的问题。
-
文档
- 更新了相关类型和接口,以支持新功能和状态。
-
样式
- 改进了组件的渲染逻辑,以更好地展示状态标签和徽章。
Walkthrough
本次变更在多个组件中引入了新功能和修改。ServiceStaking 类新增了一个方法 getPendingActivationPortfolioList,用于获取待激活的投资组合列表。多个组件的属性和方法也进行了更新,以支持新的功能和状态管理,包括在 ClaimOptions 和 StakePage 组件中添加了 amount 参数。其他组件如 PortfolioDetails 和 HistoryList 也进行了相应的逻辑调整,以便更好地处理和展示数据。
Changes
| 文件路径 | 变更摘要 |
|---|---|
packages/kit-bg/src/services/ServiceStaking.ts |
新增方法 getPendingActivationPortfolioList,接受 accountId 和 networkId 参数,返回待激活投资组合列表。 |
packages/kit/src/views/Staking/components/OptionList/index.tsx |
更新 ListEmptyComponent 的翻译标识,修改 OptionList 的上下文以包含 extraFields 和 activeId。 |
packages/kit/src/views/Staking/pages/ClaimOptions/index.tsx |
在 onPress 中的 addBabylonTrackingItem 方法调用中新增 amount 参数。 |
packages/kit/src/views/Staking/pages/HistoryList/index.tsx |
增加异步操作以刷新账户历史,调用 fetchAccountHistory。 |
packages/kit/src/views/Staking/pages/PortfolioDetails/index.tsx |
替换 getBabylonPortfolioStatus 为 getBabylonPortfolioTags,并使用 useMemo 计算 data 变量。 |
packages/kit/src/views/Staking/pages/Stake/index.tsx |
在 onConfirm 中的 addBabylonTrackingItem 方法调用中新增 amount 和 minStakeTerm 参数。 |
packages/kit/src/views/Staking/utils/babylon.ts |
定义新类型 IBabylonStatus,更新 getBabylonPortfolioStatus 和 useBabylonStatusMap 函数,新增 getBabylonPortfolioTags 函数。 |
packages/shared/types/staking.ts |
更新 IBabylonPortfolioStatus 类型,新增 local_pending_activation 状态,修改 IEarnBabylonTrackingItem 接口,新增 amount 和可选的 minStakeTerm 属性。 |
Sequence Diagram(s)
sequenceDiagram
participant User
participant ServiceStaking
participant OptionList
participant ClaimOptions
participant StakePage
participant HistoryList
participant PortfolioDetails
User->>ServiceStaking: 调用 getPendingActivationPortfolioList
ServiceStaking-->>User: 返回待激活投资组合列表
User->>ClaimOptions: 点击 Claim
ClaimOptions->>ServiceStaking: 调用 addBabylonTrackingItem(amount)
ServiceStaking-->>ClaimOptions: 处理成功状态
User->>StakePage: 点击确认
StakePage->>ServiceStaking: 调用 addBabylonTrackingItem(amount, minStakeTerm)
ServiceStaking-->>StakePage: 处理成功状态
User->>HistoryList: 刷新历史记录
HistoryList->>ServiceStaking: fetchAccountHistory
ServiceStaking-->>HistoryList: 返回账户历史数据
User->>PortfolioDetails: 查看投资组合详情
PortfolioDetails->>ServiceStaking: 调用 getBabylonPortfolioTags
ServiceStaking-->>PortfolioDetails: 返回投资组合标签
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryorSummaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.