Skip to content

refactor: improve entity component layout for better device responsiveness #7383

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

Merged
merged 7 commits into from
May 21, 2025

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Apr 24, 2025

What type of PR is this?

/area ui
/kind improvement

What this PR does / why we need it:

Refactor Entity-related components to better adapt to different devices.

Note: It should be noted that the current solution includes breaking updates, and if the plugin uses this component, it needs to be adapted. Although this change will not cause functional problems, it will only affect the style. This is just an attempt at the moment, I will also try other solutions to ensure compatibility

before:

image

after:

Screen.Recording.2025-04-24.at.16.52.26.mov

Which issue(s) this PR fixes:

Fixes #7360
Fixes #7357
Fixes #5483
Fixes #2699
Fixes #7130
Fixes #7393

Special notes for your reviewer:

All data lists need to be tested.

Adaptation for plugin

If this component is used in a plugin, the plugin needs to actively adapt to it. Although it will not cause functional issues, it may result in style problems.

Adaptation method:

Before adapting, make sure that the ⁠@halo-dev/components package has been upgraded to version 2.21.0.
The adaptation is very simple: just wrap the ⁠VEntity component(s) with a ⁠VEntityContainer component, for example:

<script lang="ts" setup>
import { VEntity, VEntityContainer } from "@halo-dev/components"
</script>

<template>
  <VEntityContainer>
    <VEntity />
    <VEntity />
  </VEntityContainer>
</template>


Finally, please make sure to update the ⁠requires field in ⁠plugin.yaml to ⁠>=2.21.0.

Does this PR introduce a user-facing change?

优化 Console 和 UC 中数据列表的 UI 在不同尺寸设备下的表现

@f2c-ci-robot f2c-ci-robot bot added area/ui Issues or PRs related to the Halo UI kind/improvement Categorizes issue or PR as related to a improvement. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 24, 2025
@f2c-ci-robot f2c-ci-robot bot requested review from LIlGG and wan92hen April 24, 2025 08:55
Copy link

f2c-ci-robot bot commented Apr 24, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from ruibaby. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

pkg-pr-new bot commented Apr 24, 2025

Open in StackBlitz

@halo-dev/api-client

npm i https://pkg.pr.new/@halo-dev/api-client@7383

@halo-dev/components

npm i https://pkg.pr.new/@halo-dev/components@7383

@halo-dev/richtext-editor

npm i https://pkg.pr.new/@halo-dev/richtext-editor@7383

@halo-dev/console-shared

npm i https://pkg.pr.new/@halo-dev/console-shared@7383

@halo-dev/ui-plugin-bundler-kit

npm i https://pkg.pr.new/@halo-dev/ui-plugin-bundler-kit@7383

commit: 4f3ce29

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.47%. Comparing base (d382b45) to head (4f3ce29).
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7383      +/-   ##
============================================
- Coverage     59.52%   59.47%   -0.05%     
+ Complexity     3804     3803       -1     
============================================
  Files           677      677              
  Lines         23225    23225              
  Branches       1496     1496              
============================================
- Hits          13825    13814      -11     
- Misses         8762     8771       +9     
- Partials        638      640       +2     

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

@ruibaby ruibaby changed the title refactor: improve entity component layout for better device responsiveness WIP: refactor: improve entity component layout for better device responsiveness Apr 24, 2025
@f2c-ci-robot f2c-ci-robot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 24, 2025
@ruibaby ruibaby force-pushed the entity-responsive branch from 58e99b0 to 58cead9 Compare May 12, 2025 09:21
@JohnNiang JohnNiang added this to the 2.21.x milestone May 15, 2025
@ruibaby ruibaby changed the title WIP: refactor: improve entity component layout for better device responsiveness refactor: improve entity component layout for better device responsiveness May 20, 2025
@ruibaby ruibaby requested review from JohnNiang and guqing May 20, 2025 03:53
Copy link

@JohnNiang JohnNiang requested a review from Copilot May 20, 2025 03:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors various Entity-related components to improve device responsiveness, with several style and structural updates that affect how data lists are rendered. Key changes include replacing traditional HTML list elements (ul/li) with the VEntityContainer component, updating unique keys for v-for iterations, and minor style adjustments (e.g. scoped styles and additional attributes).

Reviewed Changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ui/console-src/modules/system/backup/tabs/List.vue Replaced the ul/li list with VEntityContainer for rendering backup items.
ui/console-src/modules/system/auth-providers/components/AuthProvidersSection.vue Updated the draggable list structure by removing the li wrapper and using VEntityContainer.
ui/console-src/modules/interface/themes/components/preview/ThemePreviewModal.vue Switched from an unordered list to VEntityContainer for theme previews.
ui/console-src/modules/interface/menus/components/MenuList.vue Modified the menu list rendering to use VEntityContainer instead of ul/li.
ui/console-src/modules/interface/menus/Menus.vue Changed style encapsulation to scoped styles with :deep selectors.
ui/console-src/modules/contents/posts/widgets/RecentPublishedWidget.vue Updated the list rendering from ul/li to VEntityContainer for recent posts.
ui/console-src/modules/contents/posts/tags/TagList.vue Replaced traditional list markup with VEntityContainer in the tag list.
ui/console-src/modules/contents/posts/components/entity-fields/TitleField.vue Removed margin classes from VSpace, affecting spacing in the title field.
Others Similar list refactoring and style updates across categories, deleted lists, pages, comments, attachments, etc.
Comments suppressed due to low confidence (3)

ui/console-src/modules/system/auth-providers/components/AuthProvidersSection.vue:42

  • Removing the
  • wrapper in the draggable list may alter the DOM structure expected by VueDraggable, potentially affecting drag functionality. Verify that the updated structure functions as intended with the draggable component.
<AuthProviderListItem v-for="authProvider in modelValue" :key="authProvider.name" :auth-provider="authProvider" @reload="onReload" />

ui/console-src/modules/system/backup/tabs/List.vue:29

  • Replacing the
      element with VEntityContainer removes the explicit 'role="list"' attribute, which may negatively impact screen reader behavior. Please ensure that VEntityContainer provides appropriate list semantics if accessibility is a requirement.
    <VEntityContainer>
    

    ui/console-src/modules/contents/posts/components/entity-fields/TitleField.vue:39

    • [nitpick] The removal of margin classes (e.g. 'mt-1 sm:mt-0') from VSpace may alter the intended spacing of the title field. Confirm that this change is deliberate to maintain layout consistency across devices.
    <VSpace>
    

@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2025
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

目前,仍然无法切换至 console 或者 uc,且没有登出按钮。

@ruibaby
Copy link
Member Author

ruibaby commented May 21, 2025

All data lists need to be tested.

此 PR 仅优化使用 VEntity 实现的各种数据列表。

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

It works very well.

/approve

@JohnNiang JohnNiang merged commit b309bc5 into halo-dev:main May 21, 2025
10 of 11 checks passed
@ruibaby ruibaby deleted the entity-responsive branch May 21, 2025 04:29
f2c-ci-robot bot pushed a commit to halo-dev/plugin-s3 that referenced this pull request May 29, 2025
Refactor data list using ⁠VEntityContainer to optimize display across devices of various sizes.

See halo-dev/halo#7383

Note: Updating to this version requires Halo >= 2.21.0.

```release-note
适配 Halo 2.21.0 的数据列表样式
```
f2c-ci-robot bot pushed a commit to halo-sigs/plugin-moments that referenced this pull request May 29, 2025
Refactor data list using ⁠VEntityContainer to optimize display across devices of various sizes.

See halo-dev/halo#7383

Note: Updating to this version requires Halo >= 2.21.0.

```release-note
适配 Halo 2.21.0 的数据列表样式
```
f2c-ci-robot bot pushed a commit to halo-dev/plugin-feed that referenced this pull request May 29, 2025
Refactor data list using ⁠VEntityContainer to optimize display across devices of various sizes.

See halo-dev/halo#7383

Note: Updating to this version requires Halo >= 2.21.0.

```release-note
适配 Halo 2.21.0 的数据列表样式
```
f2c-ci-robot bot pushed a commit that referenced this pull request May 30, 2025
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.21.x

#### What this PR does / why we need it:

Resolve ui issue of global search component cause by #7383

#### Which issue(s) this PR fixes:

Fixes #7478

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
修复 2.21.0-alpha.1 中 Console 的全局搜索样式问题。
```
@JohnNiang JohnNiang modified the milestones: 2.21.x, 2.21.0 Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui Issues or PRs related to the Halo UI kind/improvement Categorizes issue or PR as related to a improvement. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
2 participants