Skip to content

fix: 🐛 修复 Toast 英文断行样式错误问题 - #1067

Merged
Moonofweisheng merged 1 commit into
masterfrom
fix/toast-word-break
May 21, 2025
Merged

Moonofweisheng merged 1 commit into
masterfrom
fix/toast-word-break

Conversation

@Moonofweisheng

@Moonofweisheng Moonofweisheng commented May 21, 2025

Copy link
Copy Markdown
Owner

🤔 这个 PR 的性质是?(至少选择一个)

  • 日常 bug 修复
  • 新特性提交
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • CI/CD 改进
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 代码重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

toast信息经常会展示接口异常信息,而其经常为英文,所以添加word-break:break-all,以解决此问题。

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Summary by CodeRabbit

  • 样式

    • Toast 组件的文本颜色、行高和加载动画底部间距现可通过变量自定义,提升样式灵活性。
    • 优化 Toast 组件长文本显示效果,支持自动换行。
  • 文档

    • 英文和中文界面中 Toast 相关文案进行了修正和优化。

@vercel

vercel Bot commented May 21, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2025 3:12pm

@netlify

netlify Bot commented May 21, 2025

Copy link
Copy Markdown

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit 8fd13e3
🔍 Latest deploy log https://app.netlify.com/projects/wot-design-uni/deploys/682ded454b057d00080718d4
😎 Deploy Preview https://deploy-preview-1067--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented May 21, 2025

Copy link
Copy Markdown

Walkthrough

本次变更主要针对 toast 组件的样式变量进行了增强,将部分原本硬编码的样式值替换为可配置的 SCSS 变量。同时,修正了中英文 locale 文件中 toast 相关的翻译字符串,使其更准确表达“居中 toast”的含义。没有对结构或控制流进行更改。

Changes

文件/路径 变更摘要
src/locale/en-US.json
src/locale/zh-CN.json
更新了 "ju-zhong-toast" 的翻译字符串,使其分别更准确地表达为 "Center toast" 和 "居中toast"。
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss 新增 toast 相关的 SCSS 变量,包括文本颜色、行高、加载动画下边距,并优化了部分注释。
src/uni_modules/wot-design-uni/components/wd-toast/index.scss 使用新增的变量替换原有的硬编码样式值,提升样式的灵活性和可配置性,增加了长单词断行处理。

Poem

兔子翻译词条忙,
样式变量添新装。
居中 toast 更明朗,
颜色行高随心量。
跳跃代码如春光,
🐇祝你开发路顺畅!

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 875e072 and 8fd13e3.

📒 Files selected for processing (4)
  • src/locale/en-US.json (1 hunks)
  • src/locale/zh-CN.json (1 hunks)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-toast/index.scss (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Components (wd-toast)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (8)
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (3)

642-642: 新增可配置 Toast 文字颜色变量 $-toast-color
替换了硬编码文字颜色,提升主题定制和重用性,符合现有变量命名规范。


648-648: 新增可配置 Toast 文案行高变量 $-toast-line-height
集中管理行高,减少硬编码,便于适配不同字号和多语言环境。


653-654: 新增可配置 Toast 加载态间距变量
引入 $-toast-loading-padding$-toast-loading-margin-bottom,统一管理加载图标内边距和下方间距,增强布局灵活性。

src/locale/en-US.json (1)

705-705: 校对本地化文案:ju-zhong-toast
Mid game toast 改为 Center toast,准确描述“居中 toast”含义,并与中文翻译保持一致。

src/locale/zh-CN.json (1)

705-705: 翻译修正:将“局中toast”更新为“居中toast”
中文翻译已准确表达“居中toast”的含义,与英文“Center toast”保持一致。

src/uni_modules/wot-design-uni/components/wd-toast/index.scss (3)

10-10: 使用变量替换硬编码颜色
已将原先的固定白色替换为 $-toast-color 变量,增强了主题定制灵活性。


22-23: 添加自动换行与可配置行高
通过 word-break: break-all;$-toast-line-height,可确保英文或长文本在有限宽度内正确换行,提升了国际化显示效果。


55-55: 使用 SCSS 变量替换固定外边距
margin-bottom 已替换为 $-toast-loading-margin-bottom,使加载图标的间距可根据主题需求灵活调整。


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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

@petercat-assistant

Copy link
Copy Markdown

Walkthrough

此 PR 修复了 Toast 组件在显示英文信息时的断行样式问题。通过添加 word-break: break-all 样式规则,确保英文信息能够正确断行。此外,调整了 Toast 组件的样式变量以提高可维护性。

Changes

文件 概要
src/locale/en-US.json, src/locale/zh-CN.json 更新了本地化文件,调整了文本内容。
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss 添加了 Toast 组件相关的样式变量,包括文字颜色、行高、loading 动画的 margin-bottom 等。
src/uni_modules/wot-design-uni/components/wd-toast/index.scss 修改了 Toast 组件的样式,应用新的样式变量,并添加了 word-break: break-all 以解决英文断行问题。

@include e(msg) {
font-size: $-toast-fs;
line-height: 20px;
word-break: break-all;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

确保 word-break: break-all; 不会影响其他语言的显示效果,尤其是在多语言支持的情况下。

@github-actions

Copy link
Copy Markdown

组件测试摘要 (H5 平台)

测试时间: Wed May 21 15:13:58 UTC 2025

测试结果

组件 状态 覆盖率
wd-toast ✅ 通过 84.46%

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.61%. Comparing base (875e072) to head (8fd13e3).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1067      +/-   ##
==========================================
- Coverage   84.94%   84.61%   -0.34%     
==========================================
  Files         215       12     -203     
  Lines       17191      650   -16541     
  Branches     2718       98    -2620     
==========================================
- Hits        14603      550   -14053     
+ Misses       2588      100    -2488     
Flag Coverage Δ
h5 84.61% <ø> (-0.34%) ⬇️
wd-action-sheet ?
wd-backtop ?
wd-badge ?
wd-button ?
wd-calendar ?
wd-calendar-view ?
wd-card ?
wd-cell ?
wd-cell-group ?
wd-checkbox ?
wd-checkbox-group ?
wd-circle ?
wd-col-picker ?
wd-collapse ?
wd-config-provider ?
wd-count-down ?
wd-count-to ?
wd-curtain ?
wd-datetime-picker ?
wd-datetime-picker-view ?
wd-divider ?
wd-drop-menu ?
wd-fab ?
wd-floating-panel ?
wd-form ?
wd-gap ?
wd-grid ?
wd-grid-item ?
wd-icon ?
wd-img ?
wd-img-cropper ?
wd-index-anchor ?
wd-index-bar ?
wd-input ?
wd-input-number ?
wd-keyboard ?
wd-layout ?
wd-loading ?
wd-loadmore ?
wd-message-box ?
wd-navbar ?
wd-navbar-capsule ?
wd-notice-bar ?
wd-notify ?
wd-number-keyboard ?
wd-overlay ?
wd-pagination ?
wd-password-input ?
wd-picker ?
wd-picker-view ?
wd-popover ?
wd-popup ?
wd-progress ?
wd-radio ?
wd-radio-group ?
wd-rate ?
wd-resize ?
wd-search ?
wd-segmented ?
wd-select-picker ?
wd-sidebar ?
wd-signature ?
wd-skeleton ?
wd-slider ?
wd-sort-button ?
wd-status-tip ?
wd-step ?
wd-steps ?
wd-sticky ?
wd-sticky-box ?
wd-swipe-action ?
wd-swiper ?
wd-swiper-nav ?
wd-switch ?
wd-tabbar ?
wd-table ?
wd-tabs ?
wd-tag ?
wd-text ?
wd-textarea ?
wd-toast 84.61% <ø> (ø)
wd-tooltip ?
wd-transition ?
wd-upload ?
wd-video-preview ?
wd-watermark ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

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.

2 participants