Skip to content

Comments

feat(v15): swipe 增加 v15 的 demo#3160

Merged
xiaoyatong merged 1 commit intojdf2e:feat_v3.xfrom
oasis-cloud:feat_v15_swipe
Apr 11, 2025
Merged

feat(v15): swipe 增加 v15 的 demo#3160
xiaoyatong merged 1 commit intojdf2e:feat_v3.xfrom
oasis-cloud:feat_v15_swipe

Conversation

@oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Apr 9, 2025

Summary by CodeRabbit

  • 样式
    • 调整滑动组件及相关动作按钮的尺寸,整体布局更为协调。
    • 更新按钮文本和配色,例如将“设置常买”调整为“加常买”,“移入收藏”更改为“收藏”,同时优化了“看相似”和“删除”的背景色。
    • 在不同平台上实现了显示的一致性,提供了更加统一的用户体验。

@coderabbitai
Copy link

coderabbitai bot commented Apr 9, 2025

Walkthrough

本次变更在两个 demo 文件中调整了视图组件的尺寸和样式,包括减小宽度和高度、更新按钮文字及其背景和文本颜色。同时,在 taro 版本中,将原先的 setTimeout 调用替换为 nextTick 调用,以便在事件循环的下一 tick 中执行宽度计算函数,不涉及任何对外暴露接口的更改。

Changes

文件路径 变更描述
src/packages/swipe/demos/…/demo2.tsx (H5 和 Taro) 调整 ViewNodeSwipe 组件中的宽高值(如从 60 调整为 56,从 104 调整为 96),更新按钮文本(如“设置常买”→“加常买”)及其背景和文本颜色。
src/packages/swipe/swipe.taro.tsx 引入 nextTick 并在 useReady 钩子中调用它,以替换原先使用 setTimeout 执行 getWidth 函数的方式。

Sequence Diagram(s)

sequenceDiagram
    participant C as 组件
    participant R as useReady 钩子
    participant N as nextTick 调用
    participant G as getWidth 函数

    C->>R: 组件挂载
    R->>N: 调用 nextTick(() => getWidth())
    N->>G: 下一 tick 调用 getWidth
    G-->>R: 返回宽度数据
Loading

Possibly related PRs

Suggested reviewers

  • xiaoyatong

Poem

我是一只小兔子,
跳进代码的花园里,
尺寸变小心更细,
颜色换装美丽起,
优化步步皆欢喜,
代码之中见春晖。
🐇

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc94ce3 and 88a8b63.

📒 Files selected for processing (3)
  • src/packages/swipe/demos/h5/demo2.tsx (2 hunks)
  • src/packages/swipe/demos/taro/demo2.tsx (2 hunks)
  • src/packages/swipe/swipe.taro.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (16)
src/packages/swipe/swipe.taro.tsx (2)

12-12: 更新了导入语句,添加了 nextTick

@tarojs/taro 包中导入了 nextTick 函数,为后续代码的改进做准备。


61-61: 优化了获取宽度的执行时机

setTimeout(() => getWidth()) 替换为 nextTick(() => getWidth()),这是一个良好的改进:

  1. 使用 nextTick 更符合 Taro 框架的最佳实践
  2. 避免了不必要的定时器,可能提高性能
  3. 确保在下一个视图更新周期执行宽度计算,更加可靠
src/packages/swipe/demos/h5/demo2.tsx (7)

10-11: 调整了组件尺寸

将 ViewNode 组件的宽度从 60 减小到 56,高度从 104 减小到 96,使组件更加紧凑。


28-28: 调整了 Swipe 组件高度

将 Swipe 组件的高度从 104px 减小到 96px,与 ViewNode 组件的高度保持一致。


34-38: 优化了右侧操作区域的尺寸和样式

  1. 将宽度从 240 减小到 224,高度从 104 减小到 96
  2. 添加了圆角边框和溢出隐藏属性,提升了视觉效果

这些调整使组件看起来更加现代和精致。


42-45: 更新了第一个操作按钮的文本和样式

  1. 文本从"设置常买"改为"加常买",更加简洁
  2. 背景色从 #F8F8F8 改为 #fff4e8,更温暖
  3. 文字颜色从 #1A1A1A 改为 #b5691a,与背景形成更好的对比

这些变更提升了按钮的可读性和美观度。


46-49: 更新了第二个操作按钮的文本和样式

  1. 文本从"移入收藏"简化为"收藏"
  2. 背景色从 #ffcc00 调整为 #ffbf00,色调略有变化

简化的文本使按钮更加清晰易读。


50-53: 更新了"看相似"按钮的背景色

背景色从 #FF860D 改为 #ff791a,调整后的颜色与整体设计更加协调。


54-57: 更新了"删除"按钮的背景色

背景色从 #FA2C19 改为 #ff0f23,调整后的红色更加醒目,强调了删除操作的重要性。

src/packages/swipe/demos/taro/demo2.tsx (7)

13-14: 调整了 Taro 版本的 ViewNode 组件尺寸

将宽度从 pxTransform(60) 减小到 pxTransform(56),高度从 pxTransform(104) 减小到 pxTransform(96),与 H5 版本保持一致。


33-33: 调整了 Taro 版本的 Swipe 组件高度

将高度从 pxTransform(104) 减小到 pxTransform(96),与 H5 版本保持一致。


39-43: 优化了 Taro 版本右侧操作区域的尺寸和样式

  1. 宽度从 pxTransform(240) 减小到 pxTransform(224)
  2. 高度从 pxTransform(104) 减小到 pxTransform(96)
  3. 添加了圆角边框和溢出隐藏属性

这些调整与 H5 版本保持一致,确保了跨平台的统一体验。


47-50: 更新了 Taro 版本第一个操作按钮的文本和样式

  1. 文本从"设置常买"改为"加常买"
  2. 背景色从 #F8F8F8 改为 #fff4e8
  3. 文字颜色从 #1A1A1A 改为 #b5691a

与 H5 版本保持一致,确保了统一的视觉体验。


51-54: 更新了 Taro 版本第二个操作按钮的文本和样式

  1. 文本从"移入收藏"简化为"收藏"
  2. 背景色从 #ffcc00 调整为 #ffbf00

简化的文本和调整的颜色与 H5 版本保持一致。


55-58: 更新了 Taro 版本"看相似"按钮的背景色

背景色从 #FF860D 改为 #ff791a,与 H5 版本保持一致。


59-62: 更新了 Taro 版本"删除"按钮的背景色

背景色从 #FA2C19 改为 #ff0f23,与 H5 版本保持一致。

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 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.

@github-actions github-actions bot added the action:review This PR needs more reviews (less than 2 approvals) label Apr 9, 2025
@oasis-cloud oasis-cloud requested a review from xiaoyatong April 9, 2025 07:13
@github-actions github-actions bot added the 3.x Target branch 3.x label Apr 9, 2025
@oasis-cloud oasis-cloud requested a review from irisSong April 9, 2025 07:14
@codecov
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.19%. Comparing base (abd2516) to head (88a8b63).
Report is 11 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #3160      +/-   ##
=============================================
- Coverage      87.20%   87.19%   -0.02%     
=============================================
  Files            279      279              
  Lines          18538    18537       -1     
  Branches        2822     2820       -2     
=============================================
- Hits           16166    16163       -3     
- Misses          2367     2369       +2     
  Partials           5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiaoyatong xiaoyatong merged commit 16ee064 into jdf2e:feat_v3.x Apr 11, 2025
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 29, 2025
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants