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: support maxResize props on the panel #2569

Merged
merged 4 commits into from
Apr 12, 2023

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Apr 10, 2023

Types

  • 🎉 New Features

Background or solution

🤖 Generated by Copilot at d27eae1

  • Add a ref variable isDisposed to check if the RecycleTreeBasic component is unmounted before updating the state (link,link,link)
  • Modify the minResize and maxResize props of the SplitPanel component in the DefaultLayout and ToolbarActionBasedLayout components, which control the layout of the left and right panels, to allow resizing between 280px and 480px (link,link,link,link)
  • Add a data attribute data-max-resize to the SplitPanel component, which stores the maximum resize value of each panel element (link)
  • Add optional chaining operators and a condition to check the maximum resize values in the ResizeHandleHorizontal component, which handles the horizontal resizing of the panels, to avoid errors and limit resizing (link,link)
  • Refactor the flexModeSetSize function in the ResizeHandleHorizontal component, which sets the size of the fixed and flex elements in the flex mode, to simplify the logic and use constants (link)
  • Add spaces between the Chinese and English words in the comments of the SplitPanel component, for readability and consistency (link,link)
  • Add a ternary operator to check the length of the status bar item arrays in the StatusBarView component, which renders the status bar items, to avoid rendering an empty array as a child element (link)
  • Add and remove empty lines in the SplitPanel and StatusBarView component files, for code style consistency (link,link)

close #2537

在侧边栏默认大小控制方面,还可以通过 AppConfig#panelSize 的方式去控制。相关逻辑见:

const customPanelSize = appConfig.panelSizes && appConfig.panelSizes[side];

同时修复骨架图下面的 0 0 奇怪样式

image

Changelog

support maxResize props on the panel and fix some warnings

@opensumi opensumi bot added 🎨 feature feature required 🐞 bug Something isn't working labels Apr 10, 2023
@github-actions
Copy link
Contributor

ChatGPT Code Review:

CodeReview:

  1. 在 BasicRecycleTree 组件中增加了 isDisposed 状态,用于标记组件是否已经被销毁,这样可以避免异步操作的回调在组件已经销毁后被调用导致的问题。

  2. 在 BasicRecycleTree 组件中的 setModel 方法增加了判断,只有在组件未被销毁的情况下才能进行状态更新,避免异步操作在组件已经销毁后更新状态导致的问题。

  3. 在 DefaultLayout 组件中增加了对 SplitPanel 组件的 maxResize 属性的设置,可以限制拖拽调整面板大小的最大值。

  4. 在 ResizeHandleHorizontal 组件中增加了对 maxResize 属性的支持,可以限制拖拽调整元素大小的最大值。

  5. 在 StatusBarView 组件中,对左侧和右侧的状态栏项进行了判断,只有在存在状态栏项时才进行渲染,避免出现没有状态栏项时的空白区域。

修改建议:

  1. 可以对 BasicRecycleTree 组件中的异步操作进行优化,避免在组件销毁后仍然进行操作和更新状态,可以使用 useEffect Hook 向服务器发送请求,并在组件销毁时清除副作用。

  2. 可以对代码进行一些格式上的调整,如缩进对齐、空格的添加等,以提高代码可读性。

  3. 在默认 commit message 上增加了一些更多的描述,如 Issue 编号、相关操作等,可以更加明确地表达本次提交的意义。

合适的 commit message:

feat(recycle-tree): add support maxResize props on the panel

fix(left-panel): adjust the minResize value to 280 to avoid too small

fix(right-panel): add the maxResize value to 480 to limit the size of the panel

refactor(StatusBar): avoid rendering blank areas by checking the length of the left/right Entries

chore: update the code format

@erha19
Copy link
Member Author

erha19 commented Apr 10, 2023

/publish

@github-actions
Copy link
Contributor

🎉 PR Next version 2.23.3-next-1681122616.0 publish successful! You can install prerelease version via npm install package@2.23.3-next-1681122616.0 @erha19

2.23.3-next-1681122616.0

/home/runner/work/_temp/_runner_file_commands/step_summary_ffd846c1-c180-4e9f-a87b-9f2855dc863b

@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (b7c71f6) 57.71% compared to head (d27eae1) 57.71%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2569   +/-   ##
=======================================
  Coverage   57.71%   57.71%           
=======================================
  Files        1324     1324           
  Lines       83544    83544           
  Branches    17392    17392           
=======================================
  Hits        48221    48221           
  Misses      32093    32093           
  Partials     3230     3230           
Flag Coverage Δ
jsdom 52.73% <ø> (ø)
node 16.76% <ø> (ø)

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

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@ensorrow ensorrow left a comment

Choose a reason for hiding this comment

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

LGTM

@erha19 erha19 merged commit 97652f3 into main Apr 12, 2023
16 of 17 checks passed
@erha19 erha19 deleted the feat/support-max-resize-on-the-panel branch April 12, 2023 02:24
@erha19 erha19 added this to the 2.24 milestone Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🎨 feature feature required 💄 style change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] IDE 布局:如何设置左侧插槽最大宽度
2 participants