Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add account seletor into market header in md size #6370

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

huhuanming
Copy link
Contributor

@huhuanming huhuanming commented Dec 18, 2024

Summary by CodeRabbit

  • 新特性

    • 更新了市场首页头部组件,采用了新的标签页头部结构。
    • 在场景名称枚举中新增了 market 值。
    • 更新了市场详情概览组件,支持用户自定义货币符号。
    • 更新了图表组件的高度计算逻辑,提升了用户体验。
  • bug 修复

    • 移除了国际化相关的功能,简化了组件逻辑。

Copy link

codesandbox bot commented Dec 18, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

概述

代码变更解析

步骤概览

这次代码变更主要涉及市场主页头部组件的重构。变更包括移除国际化相关逻辑,简化头部渲染,并在共享类型中新增了一个账户选择器场景名称。代码修改集中在四个文件中:MarketHomeHeader.md.tsxMarketHomeHeader.tsxMarketDetailOverview.tsxtypes/index.ts

变更详情

文件路径 变更摘要
packages/kit/src/views/Market/components/MarketHomeHeader.md.tsx 移除国际化导入,更新组件结构,使用 TabPageHeader 替代原有头部组件
packages/kit/src/views/Market/components/MarketHomeHeader.tsx 删除 useIntl 钩子,保留组件基本结构
packages/shared/types/index.ts EAccountSelectorSceneName 枚举中新增 market
packages/kit/src/views/Market/components/MarketDetailOverview.tsx 添加获取用户货币设置的逻辑,更新货币符号为用户定义的符号
packages/kit/src/views/Market/components/TokenPriceChart.tsx 更新 useHeight 钩子的返回值,精简 BasicTokenPriceChart 逻辑

代码交互流程

sequenceDiagram
    participant MarketHomeHeader as 市场主页头部
    participant TabPageHeader as 标签页头部
    participant AccountSelector as 账户选择器

    MarketHomeHeader->>TabPageHeader: 使用 EAccountSelectorSceneName.home
    TabPageHeader-->>AccountSelector: 传递场景名称
Loading

这个序列图展示了新的头部组件如何与账户选择器进行交互,通过传递特定的场景名称来确定渲染行为。


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a92754 and 8dab0c6.

📒 Files selected for processing (1)
  • packages/kit/src/views/Market/components/TokenPriceChart.tsx (1 hunks)
🔇 Additional comments (1)
packages/kit/src/views/Market/components/TokenPriceChart.tsx (1)

145-145: 检查 Android 高度调整的影响

高度从 258 调整到 278 可能会影响整体布局。建议:

  1. 验证在不同 Android 设备上的显示效果
  2. 确认此更改与新增的账户选择器布局兼容
✅ Verification successful

Android 高度调整已验证安全

此高度调整仅影响 TokenPriceChart 组件内部,通过 useHeight hook 动态计算。这是一个局部变化,不会影响其他组件布局。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 搜索相关的布局调整
rg -l "fixedHeight|useHeight" --type tsx

Length of output: 70


Script:

#!/bin/bash
# Search for height-related patterns in TypeScript and TypeScript React files
rg -l "fixedHeight|useHeight" --type ts --type tsx --type-add 'tsx:*.tsx'

# Search for specific height value
rg "278|258" --type ts --type tsx --type-add 'tsx:*.tsx' -C 2

# Find all TypeScript/React files in the Market directory
fd -e tsx -e ts . packages/kit/src/views/Market

Length of output: 66051


Script:

#!/bin/bash
# Search for files that might be affected by the height change
rg -A 5 -B 5 "useHeight|height.*278|height.*258" packages/kit/src/views/Market/

# Look for related layout components
rg -l "Chart|TokenPrice" packages/kit/src/views/Market/

Length of output: 2944


🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

@huhuanming huhuanming changed the title feat: replace market header in md size feat: add account seletor into market header in md size Dec 18, 2024
@huhuanming huhuanming enabled auto-merge (squash) December 18, 2024 09:39
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 650f508 and 385833b.

📒 Files selected for processing (3)
  • packages/kit/src/views/Market/components/MarketHomeHeader.md.tsx (1 hunks)
  • packages/kit/src/views/Market/components/MarketHomeHeader.tsx (0 hunks)
  • packages/shared/types/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/kit/src/views/Market/components/MarketHomeHeader.tsx
🔇 Additional comments (2)
packages/kit/src/views/Market/components/MarketHomeHeader.md.tsx (1)

1-4: 导入声明简化和更新

导入声明更加精简,移除了未使用的国际化相关组件。

packages/shared/types/index.ts (1)

83-83: ⚠️ Potential issue

场景名称定义与使用不一致

已经定义了 market 场景名称,但在 MarketHomeHeader.md.tsx 中却使用了 home。建议修正使用正确的场景名称。

建议修改 MarketHomeHeader.md.tsx 中的代码:

-      <TabPageHeader sceneName={EAccountSelectorSceneName.home} />
+      <TabPageHeader sceneName={EAccountSelectorSceneName.market} />

Likely invalid or redundant comment.

originalix
originalix previously approved these changes Dec 18, 2024
@huhuanming huhuanming merged commit 2aecac4 into x Dec 19, 2024
8 checks passed
@huhuanming huhuanming deleted the replace-market-header branch December 19, 2024 05:51
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.

3 participants