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: improve file delete confirmation message and styling #4333

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Jan 23, 2025

Types

  • 🐛 Bug Fixes
  • 💄 Style Changes

Background or solution

  • 修复偶现的多选文件后,选择的文件不匹配问题
  • 优化删除多个文件的样式
  • 修复文件树焦点样式丢失问题
  • 修复 Cmd+A 后删除文件,选中的文件列表不正确问题
  • 区分 Linux 环境下的文案展示
image

Changelog

improve file delete confirmation message and styling

Summary by CodeRabbit

  • 样式调整

    • 修改了标题颜色继承方式
    • 为树形项目元素添加了选中状态样式
  • 文件树功能

    • 优化了文件删除确认对话框,增加了文件数量和名称的详细提示
    • 增强了文件选择交互逻辑
    • 提升了文件操作的用户体验
  • 国际化更新

    • 更新了文件删除确认消息,提供了更清晰的上下文
    • 添加了文件删除操作的提示信息
    • 优化了中英文本地化字符串

@opensumi opensumi bot added the 🎨 feature feature required label Jan 23, 2025
@erha19
Copy link
Member Author

erha19 commented Jan 23, 2025

/next

Copy link
Contributor

coderabbitai bot commented Jan 23, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > [email protected]: Glob versions prior to v9 are no longer supported
error Couldn't find any versions for "@opensumi/ide-dev-tool" that matches "workspace:*"

"""

变更概述

演练

此次拉取请求涉及多个文件的样式和本地化更改。主要修改包括调整标题颜色继承、树形项目选中样式、文件删除确认对话框的本地化字符串以及文件树模型服务中的选择逻辑。这些变更旨在改善用户界面的一致性和交互体验。

变更

文件路径 变更摘要
packages/components/src/style/base.less 将标题元素颜色从 @heading-color 更改为 inherit
packages/design/src/browser/style/design.module.less role='treeitem' 的元素添加新的轮廓样式
packages/file-tree-next/src/browser/services/file-tree-model.service.ts 更新文件删除确认逻辑,修改 selectChildNode 方法可见性
packages/i18n/src/common/en-US.lang.ts 更新文件删除确认消息和本地化字符串
packages/i18n/src/common/zh-CN.lang.ts 更新中文本地化字符串,调整文件删除确认消息

序列图

sequenceDiagram
    participant User
    participant FileTree
    participant ConfirmDialog
    User->>FileTree: 选择文件
    User->>FileTree: 触发删除操作
    FileTree->>ConfirmDialog: 显示删除确认对话框
    ConfirmDialog-->>User: 展示详细删除信息
    User->>ConfirmDialog: 确认删除
    ConfirmDialog->>FileTree: 执行文件删除
Loading

可能相关的拉取请求

建议标签

💄 style change, 🐞 bug

建议审阅者

  • Ricbet
  • hacke2
    """
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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

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

🧹 Nitpick comments (1)
packages/design/src/browser/style/design.module.less (1)

599-603: 树形控件选中项样式优化

为树形控件的选中项添加边框提示是很好的改进:

  1. 提升了用户界面的可视反馈
  2. 增强了交互体验
  3. 改善了可访问性

建议考虑添加过渡动画以使选中效果更平滑:

[class*='mod_actived__'] {
  outline: 1px solid var(--kt-tree-inactiveSelectionBackground);
+ transition: outline 0.1s ease-in-out;
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dcaae39 and 3f81ffc.

📒 Files selected for processing (5)
  • packages/components/src/style/base.less (1 hunks)
  • packages/design/src/browser/style/design.module.less (1 hunks)
  • packages/file-tree-next/src/browser/services/file-tree-model.service.ts (6 hunks)
  • packages/i18n/src/common/en-US.lang.ts (1 hunks)
  • packages/i18n/src/common/zh-CN.lang.ts (1 hunks)
👮 Files not reviewed due to content moderation or server errors (2)
  • packages/file-tree-next/src/browser/services/file-tree-model.service.ts
  • packages/i18n/src/common/zh-CN.lang.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/file-tree-next/src/browser/services/file-tree-model.service.ts

[error] 1008-1010: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: 🚀🚀🚀 Next Version for pull request
  • GitHub Check: unittest (ubuntu-latest, 18.x, jsdom)
  • GitHub Check: build (ubuntu-latest, 20.x)
  • GitHub Check: unittest (ubuntu-latest, 18.x, node)
  • GitHub Check: unittest (macos-latest, 18.x, jsdom)
  • GitHub Check: build (macos-latest, 20.x)
  • GitHub Check: build-windows
  • GitHub Check: unittest (macos-latest, 18.x, node)
🔇 Additional comments (2)
packages/i18n/src/common/en-US.lang.ts (1)

54-57: 文件删除相关的本地化字符串改进

本次更改优化了文件删除操作的用户体验:

  1. 删除确认消息现在包含文件数量信息
  2. 新增了关于从回收站恢复文件的提示
  3. 重构了删除操作相关的消息键名,使其更有条理性
packages/components/src/style/base.less (1)

118-118: 标题元素样式优化

将标题元素的颜色设置为 inherit 是一个很好的改进:

  1. 提高了样式的灵活性,标题会继承父元素的颜色
  2. 简化了样式覆盖的复杂度
  3. 符合组件复用的最佳实践

@opensumi
Copy link
Contributor

opensumi bot commented Jan 23, 2025

🎉 PR Next publish successful!

3.7.1-next-1737628160.0

@erha19
Copy link
Member Author

erha19 commented Jan 23, 2025

/next

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

🧹 Nitpick comments (2)
packages/file-tree-next/src/browser/services/file-tree-model.service.ts (2)

994-994: 建议将魔法数字提取为常量

建议将 MAX_FILES = 10 提取为类级别的常量,以提高代码的可维护性。

-      const MAX_FILES = 10;
+      private static readonly MAX_FILES_IN_CONFIRMATION = 10;

Line range hint 1734-1749: 建议添加输入参数验证

为了提高代码的健壮性,建议添加对输入参数 uris 的验证:

   public selectChildNode(uris: URI[]) {
+    if (!uris || uris.length === 0) {
+      return;
+    }
     for (const uri of uris) {
+      if (!uri) {
+        continue;
+      }
       const file = this.fileTreeService.getNodeByPathOrUri(uri);
       // ... rest of the code
     }
   }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f81ffc and 26c5814.

📒 Files selected for processing (1)
  • packages/file-tree-next/src/browser/services/file-tree-model.service.ts (6 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/file-tree-next/src/browser/services/file-tree-model.service.ts

[error] 1007-1008: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: 🚀🚀🚀 Next Version for pull request
  • GitHub Check: ubuntu-latest, Node.js 20.x
  • GitHub Check: build (ubuntu-latest, 20.x)
  • GitHub Check: build-windows
  • GitHub Check: build (macos-latest, 20.x)
🔇 Additional comments (3)
packages/file-tree-next/src/browser/services/file-tree-model.service.ts (3)

26-26: 导入更改看起来不错!

新增的导入模块与文件删除确认对话框的改进直接相关,包括消息类型、操作系统检测和 Markdown 格式化支持。

Also applies to: 34-34, 38-38


990-1012: 文件删除确认对话框的改进很棒!

改进包括:

  • 根据操作系统显示不同的确认消息
  • 增加了显示的文件数量
  • 添加了更清晰的删除提示
  • 使用 Markdown 格式化消息以提升可读性
🧰 Tools
🪛 Biome (1.9.4)

[error] 1007-1008: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 1734-1749: 方法可见性的更改是合理的

selectChildNode 方法改为公共方法使得外部组件可以访问此功能,这有助于提高代码的可重用性。

@opensumi
Copy link
Contributor

opensumi bot commented Jan 23, 2025

🎉 PR Next publish successful!

3.7.1-next-1737628833.0

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 14.28571% with 12 lines in your changes missing coverage. Please review.

Project coverage is 54.18%. Comparing base (dcaae39) to head (26c5814).

Files with missing lines Patch % Lines
...xt/src/browser/services/file-tree-model.service.ts 14.28% 9 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4333      +/-   ##
==========================================
- Coverage   54.18%   54.18%   -0.01%     
==========================================
  Files        1638     1638              
  Lines      100084   100093       +9     
  Branches    21731    21727       -4     
==========================================
+ Hits        54233    54235       +2     
- Misses      38095    38099       +4     
- Partials     7756     7759       +3     
Flag Coverage Δ
jsdom 49.72% <14.28%> (-0.01%) ⬇️
node 12.23% <0.00%> (-0.01%) ⬇️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 feature feature required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant