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

fix(tabs): clicked tabs should be entirely visible & fix ci install failed #2685

Merged
merged 7 commits into from
Nov 1, 2024

Conversation

Alex-huxiyang
Copy link
Collaborator

@Alex-huxiyang Alex-huxiyang commented Nov 1, 2024

上次的改动导致元素无法完全漏出

Summary by CodeRabbit

  • 新功能
    • 优化了选项卡组件的滚动逻辑,简化了水平滚动的计算方式。
  • 改进
    • 改善了右到左布局中选项卡的滚动行为,提升了性能和清晰度。
    • 清晰化了范围组件的拖动状态初始化,确保状态定义明确。
  • 样式
    • 移除了CSS变量nutuiDividerVerticalTop,可能影响样式配置。

Copy link

coderabbitai bot commented Nov 1, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

本次更改主要涉及 src/packages/tabs/tabs.taro.tsx 文件中 Tabs 组件的 scrollIntoView 函数。修改的核心是 to 变量的计算方式,之前的计算方式考虑了导航矩形的宽度,而现在直接将 to 设置为 rtl ? -left : left,简化了计算逻辑。此外,移除了关于负 to 值不需要滚动的注释。这些更改主要集中在滚动逻辑上,整体结构和功能保持不变。

Changes

文件路径 更改摘要
src/packages/tabs/tabs.taro.tsx 修改 scrollIntoView 函数,简化 to 变量的计算逻辑,移除不必要的注释。
src/packages/range/range.taro.tsx, src/packages/range/range.tsx 修改 dragStatus 的初始化,从逻辑或操作改为直接赋值为 'start',以明确初始状态。
src/packages/configprovider/types.ts NutCSSVariables 类型中移除变量 nutuiDividerVerticalTop

Possibly related PRs

Suggested labels

size/L

Suggested reviewers

  • oasis-cloud

Poem

在标签间跳跃,兔子欢快舞,
滚动逻辑简化,真是太酷!
左右随心所欲,轻松不费力,
兔子祝贺你们,代码更灵活! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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 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.

@Alex-huxiyang Alex-huxiyang changed the title fix: tabs should show left edge fix(tabs): tabs should show left edge Nov 1, 2024
@Alex-huxiyang Alex-huxiyang changed the title fix(tabs): tabs should show left edge fix(tabs): clicked tabs should be entirely visible Nov 1, 2024
@Alex-huxiyang Alex-huxiyang changed the title fix(tabs): clicked tabs should be entirely visible fix(tabs): clicked tabs should be entirely visible & fix ci install failed Nov 1, 2024
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.07%. Comparing base (b97e0a5) to head (39b501b).
Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #2685   +/-   ##
=======================================
  Coverage   84.07%   84.07%           
=======================================
  Files         217      217           
  Lines       17830    17830           
  Branches     2608     2608           
=======================================
  Hits        14991    14991           
  Misses       2834     2834           
  Partials        5        5           

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

@oasis-cloud oasis-cloud added the 2.x label Nov 1, 2024
Copy link

@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: 0

🧹 Outside diff range and nitpick comments (1)
src/packages/range/range.taro.tsx (1)

77-77: 修复了 dragStatus 状态的初始化问题

这个修改是正确的,移除了多余的逻辑运算符。之前的代码可能使用了 'start' || '' 这样的形式,这种写法会始终返回 'start'

建议进一步改进:为了避免字符串字面量可能带来的拼写错误,建议定义一个枚举或常量来管理拖动状态:

enum DragStatus {
  START = 'start',
  DRAGGING = 'draging',
  NONE = ''
}

// 使用示例
const [dragStatus, setDragStatus] = useState<DragStatus>(DragStatus.START)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 61f5e96 and dd3be03.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • src/packages/configprovider/types.ts (0 hunks)
  • src/packages/range/range.taro.tsx (1 hunks)
  • src/packages/range/range.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/packages/configprovider/types.ts
🔇 Additional comments (1)
src/packages/range/range.tsx (1)

77-77: 代码更清晰,但需验证状态转换

这个改动将 dragStatus 的初始值从逻辑表达式简化为直接赋值 'start',使代码更加清晰。虽然功能上没有变化,但建议验证以下状态转换是否正常:

  • 触摸开始时设置为 'start'
  • 拖动时变更为 'draging'
  • 触摸结束时重置为空字符串
✅ Verification successful

状态转换逻辑完整且正确

通过代码分析,dragStatus 的状态转换逻辑完整且符合预期:

  • 初始状态设置为 'start'
  • 触摸开始时设置为 'start'
  • 拖动过程中设置为 'draging'
  • 触摸结束时重置为空字符串 ''

此简化改动不影响组件的正常工作。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 验证 dragStatus 状态转换的完整性
# 搜索所有修改 dragStatus 状态的代码位置

rg "setDragStatus\(" --type tsx

Length of output: 61


Script:

#!/bin/bash
# Search for setDragStatus calls in all files
rg "setDragStatus"

# Also try to find the component implementation to analyze state transitions
ast-grep --pattern 'const Range = $_$ => {
  $$$
}'

Length of output: 699

@oasis-cloud oasis-cloud merged commit 08bab87 into jdf2e:next Nov 1, 2024
5 checks passed
Alex-huxiyang added a commit to Alex-huxiyang/nutui-react that referenced this pull request Nov 1, 2024
* fix: tabs should show left edge

* fix: update lock to fix ci insatall failed

* fix: ci failed

* fix: ci failed

* fix: build

* fix: build
@coderabbitai coderabbitai bot mentioned this pull request Nov 15, 2024
20 tasks
@Alex-huxiyang Alex-huxiyang deleted the hxy/tabs/taro branch November 19, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants