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:toolbar style improvement #755

Merged
merged 8 commits into from
Aug 23, 2024
Merged

Conversation

lichunn
Copy link
Contributor

@lichunn lichunn commented Aug 23, 2024

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Introduced a new Lock component to enhance the toolbar functionality.
    • Expanded layout options for greater customization, including visibility settings for lines and collapsibility.
  • Bug Fixes

    • Improved interactivity of toolbar components by refining the handling of enabled/disabled states.
  • Style

    • Enhanced visual presentation of toolbars with new hover effects and layout adjustments.
    • Updated CSS styles for toolbars, breadcrumbs, and buttons to improve readability and user experience.
  • Documentation

    • Added a comprehensive guide on the layout management system, detailing new APIs and state management features.

Copy link
Contributor

coderabbitai bot commented Aug 23, 2024

Walkthrough

The changes involve enhancements to layout and toolbar functionalities across multiple modules. Key additions include the Lock component, new layout options for customization, and refactoring of state management. Styling modifications improve the visual presentation and interactivity of user interface elements. Configuration updates streamline component integration, leading to a more versatile and user-friendly application experience.

Changes

File Path Change Summary
designer-demo/registry.js Enhanced layout configuration; added Lock component to toolbars; new options introduced.
packages/design-core/index.js New export for Lock component; previous exports remain unchanged.
packages/layout/index.js Added isShowLine, isShowCollapse, and toolbars to options object.
packages/layout/src/DesignPlugins.vue Renamed state management variable; improved clarity with META_APP import.
packages/layout/src/DesignToolbars.vue Enhanced CSS styling for toolbars; organized toolbar items more effectively.
packages/layout/src/Main.vue Introduced :layoutRegistry prop in design-toolbars component.
packages/layout/src/ToolbarCollapse.vue Minor CSS adjustment for component layout.
packages/layout/src/composable/Layout.md New documentation for layout management and state APIs.
packages/layout/src/composable/useLayout.js Removed pluginState; integrated pluginEvent into layoutState.
packages/plugins/help/src/HelpIcon.vue Updated state management with META_APP; improved clarity in plugin activation.
packages/theme/common/base.less Changed breadcrumb line height from 24px to 28px.
packages/theme/dark/toolbar.less Introduced new CSS properties for hover effects and visual separation in the toolbar.
packages/theme/light/toolbar.less Updated color variables for toolbar styling; introduced new hover states.
packages/theme/light/variable.less Added new CSS properties for breadcrumb styling in the toolbar.
packages/toolbars/breadcrumb/src/Main.vue Removed component for page locking; modified button text and enhanced styling.
packages/toolbars/generate-vue/src/Main.vue Improved button layout with flexbox; refined hover states.
packages/toolbars/lock/meta.js Changed toolbar alignment from right to left; removed collapsed property.
packages/toolbars/lock/src/Main.vue Removed :disabled attribute; simplified icon class name.
packages/toolbars/save/src/Main.vue Updated button styling; enhanced layout and hover effects.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Toolbar
    participant LockComponent
    participant LayoutState

    User->>Toolbar: Interacts with toolbar
    Toolbar->>LockComponent: Triggers lock action
    LockComponent->>LayoutState: Updates state
    LayoutState-->>Toolbar: Reflects updated state
Loading

🐇
In a world of clicks and swipes,
New features hop, as joy ignites.
With locks and toolbars bright and neat,
Our layout dances, a rhythmic beat.
So let us cheer, both wild and free,
For changes made, oh, what glee! 🎉


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Outside diff range, codebase verification and nitpick comments (7)
packages/theme/light/toolbar.less (1)

9-9: Consider using consistent color formats.

The variable --ti-lowcode-toolbar-view-active-bg has been changed to an RGB format. Ensure that all color definitions in the file use the same format for consistency.

packages/layout/src/composable/Layout.md (1)

43-43: Use fenced code blocks for code snippets.

The document contains indented code blocks, which markdownlint flags as an issue. Use fenced code blocks (```) for better readability and compliance with markdown standards.

Apply this change to all code blocks in the document.

Also applies to: 45-45, 51-51, 53-53, 60-60, 62-62, 69-69, 71-71, 73-73, 79-79, 81-81, 85-85, 90-90, 93-93, 98-98, 110-110, 112-112, 114-114, 124-124, 126-126, 149-149

Tools
Markdownlint

43-43: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)

packages/toolbars/lock/src/Main.vue (1)

Line range hint 51-78: Consider improving error handling in lockPage.

The lockPage function handles errors by notifying the user. Ensure that the error messages are user-friendly and consider logging errors for debugging purposes.

packages/toolbars/breadcrumb/src/Main.vue (2)

94-95: Ensure consistent margin and cursor styles.

The addition of margin-right and cursor styles should be consistent with other elements to maintain a cohesive design.


106-108: Enhance hover state styling.

The hover state for the breadcrumb title has been added. Ensure that this styling is consistent with other hover states in the application.

packages/layout/src/DesignToolbars.vue (2)

Line range hint 99-116: Review CSS for icon elements.

The CSS changes for .icon elements should be reviewed to ensure they enhance the user interface without causing layout issues.


Line range hint 132-147: Check alignment and margin adjustments.

The alignment and margin changes in .toolbar-right should be consistent with the overall design and not disrupt the layout.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7a50b54 and 2e0d828.

Files ignored due to path filters (2)
  • packages/design-core/assets/locked.svg is excluded by !**/*.svg
  • packages/design-core/assets/unlocked.svg is excluded by !**/*.svg
Files selected for processing (19)
  • designer-demo/registry.js (3 hunks)
  • packages/design-core/index.js (1 hunks)
  • packages/layout/index.js (1 hunks)
  • packages/layout/src/DesignPlugins.vue (7 hunks)
  • packages/layout/src/DesignToolbars.vue (6 hunks)
  • packages/layout/src/Main.vue (2 hunks)
  • packages/layout/src/ToolbarCollapse.vue (2 hunks)
  • packages/layout/src/composable/Layout.md (1 hunks)
  • packages/layout/src/composable/useLayout.js (5 hunks)
  • packages/plugins/help/src/HelpIcon.vue (3 hunks)
  • packages/theme/common/base.less (1 hunks)
  • packages/theme/dark/toolbar.less (1 hunks)
  • packages/theme/light/toolbar.less (1 hunks)
  • packages/theme/light/variable.less (1 hunks)
  • packages/toolbars/breadcrumb/src/Main.vue (7 hunks)
  • packages/toolbars/generate-vue/src/Main.vue (2 hunks)
  • packages/toolbars/lock/meta.js (1 hunks)
  • packages/toolbars/lock/src/Main.vue (1 hunks)
  • packages/toolbars/save/src/Main.vue (1 hunks)
Files skipped from review due to trivial changes (2)
  • packages/layout/src/ToolbarCollapse.vue
  • packages/theme/common/base.less
Additional context used
Markdownlint
packages/layout/src/composable/Layout.md

43-43: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


45-45: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


51-51: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


53-53: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


60-60: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


62-62: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


69-69: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


71-71: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


73-73: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


79-79: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


81-81: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


85-85: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


90-90: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


93-93: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


98-98: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


110-110: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


112-112: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


114-114: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


124-124: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


126-126: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)


149-149: Expected: fenced; Actual: indented
Code block style

(MD046, code-block-style)

Additional comments not posted (34)
packages/toolbars/lock/meta.js (1)

6-6: Verify the impact of removing the collapsed property.

The removal of the collapsed property might affect the toolbar's default state. Ensure that this change doesn't introduce any unintended behavior in the UI.

Run the following script to check for any references to the collapsed property in the codebase:

Verification successful

No impact from removing the collapsed property.

The search did not find any references to the collapsed property in the codebase, indicating that its removal does not affect the toolbar's default state or introduce unintended behavior in the UI.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify references to the `collapsed` property.

# Test: Search for the `collapsed` property usage. Expect: No critical dependencies on the `collapsed` property.
rg --type javascript --type vue --type json 'collapsed'

Length of output: 90


Script:

#!/bin/bash
# Description: Verify references to the `collapsed` property using ast-grep.

# Test: Search for the `collapsed` property usage in JavaScript and Vue files.
ast-grep --lang javascript --pattern 'collapsed' 

# Test: Search for the `collapsed` property usage in JSON files.
rg --type json 'collapsed'

Length of output: 75

packages/layout/index.js (1)

13-15: Verify the usage of new properties in the codebase.

The properties isShowLine, isShowCollapse, and toolbars have been added. Ensure they are being utilized correctly and do not cause any issues.

Run the following script to check for the usage of these properties in the codebase:

packages/theme/dark/toolbar.less (1)

10-15: Verify the usage of new CSS properties in the codebase.

The new CSS properties --ti-lowcode-toolbar-left-icon-bg-hover and --ti-lowcode-toolbar-right-line have been added. Ensure they are applied correctly in the toolbar components.

Run the following script to check for the usage of these CSS properties in the codebase:

Verification successful

CSS Properties Verified in Toolbar Components

The new CSS properties --ti-lowcode-toolbar-left-icon-bg-hover and --ti-lowcode-toolbar-right-line are correctly applied in the DesignToolbars.vue component.

  • Found in packages/layout/src/DesignToolbars.vue
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of new CSS properties in the codebase.

# Test: Search for the usage of `--ti-lowcode-toolbar-left-icon-bg-hover` and `--ti-lowcode-toolbar-right-line`. Expect: Proper application in relevant stylesheets or components.
rg --type css --type less '--ti-lowcode-toolbar-left-icon-bg-hover|--ti-lowcode-toolbar-right-line'

Length of output: 575


Script:

#!/bin/bash
# Description: Verify the usage of new CSS properties in the codebase.

# Test: Search for the usage of `--ti-lowcode-toolbar-left-icon-bg-hover` and `--ti-lowcode-toolbar-right-line`. Expect: Proper application in relevant stylesheets or components.
rg --type css --type less -e '--ti-lowcode-toolbar-left-icon-bg-hover' -e '--ti-lowcode-toolbar-right-line'

Length of output: 453


Script:

#!/bin/bash
# Description: Search for the usage of the CSS properties in the codebase.

# Test: Look for any references to `--ti-lowcode-toolbar-left-icon-bg-hover` and `--ti-lowcode-toolbar-right-line` outside their declarations.
rg '--ti-lowcode-toolbar-left-icon-bg-hover|--ti-lowcode-toolbar-right-line' --glob '!packages/theme/**'

Length of output: 580


Script:

#!/bin/bash
# Description: Search for the usage of the CSS properties in the codebase.

# Test: Look for any references to `--ti-lowcode-toolbar-left-icon-bg-hover` and `--ti-lowcode-toolbar-right-line` outside their declarations.
rg -e '--ti-lowcode-toolbar-left-icon-bg-hover' -e '--ti-lowcode-toolbar-right-line' --glob '!packages/theme/**'

Length of output: 305

packages/theme/light/toolbar.less (2)

10-10: Good addition for hover effect.

The new variable --ti-lowcode-toolbar-left-icon-bg-hover enhances the hover state for left icons, improving user interaction.


16-16: Ensure consistent border styling.

The new variable --ti-lowcode-toolbar-right-line is added for styling a right border or line element. Make sure this aligns with other border styles in the project.

designer-demo/registry.js (3)

18-18: Ensure the Lock component is used correctly.

The Lock component has been added to the imports. Verify that it is correctly implemented and utilized within the application.


56-64: Enhance layout customization.

The layout object has been restructured to include new options. This change allows for greater flexibility in the user interface, which is a positive enhancement.


76-76: Expanded toolbar functionality.

The addition of multiple components to the toolbars array, including Lock, Media, Redoundo, and Collaboration, enhances the toolbar's capabilities.

packages/layout/src/composable/useLayout.js (2)

30-31: Streamline plugin state management.

The pluginEvent property has been integrated into layoutState.plugins, simplifying the state structure. This is a positive refactor for maintainability.


47-53: Position change for utility functions.

The functions getPluginState, getDimension, and setDimension have been repositioned. Ensure that their new positions do not affect their functionality or usage.

packages/layout/src/Main.vue (2)

4-4: Ensure the layoutRegistry is correctly utilized.

The addition of the :layoutRegistry prop to the design-toolbars component enhances its functionality. Verify that the layoutRegistry is being used correctly within the component.


66-66: LGTM! Verify the integration of layoutRegistry.

The inclusion of layoutRegistry in the return object is approved. Ensure that its integration with other parts of the component is functioning as expected.

packages/design-core/index.js (1)

9-9: LGTM! The Lock component export is a valuable addition.

The new export statement for the Lock component enhances the module's functionality by making it available for import.

packages/toolbars/lock/src/Main.vue (1)

11-11: Ensure consistency with icon class changes.

The class name of the <span> element has been changed from icon-hides to icon. Verify that this change is consistent with the CSS and doesn't affect the intended styling or functionality.

packages/toolbars/breadcrumb/src/Main.vue (1)

15-15: Verify the impact of button text change.

The button text has been changed from "发布区块" to "区块". Ensure that this change aligns with the intended functionality and doesn't affect user understanding.

packages/layout/src/DesignToolbars.vue (1)

53-58: Verify plugin API registration logic.

The registration of plugin APIs for 'lock' and 'save' actions should be verified to ensure it functions as intended and doesn't introduce side effects.

packages/toolbars/save/src/Main.vue (1)

180-186: Enhance button styling with flexbox and hover effects.

The use of display: flex and align-items: center ensures that the button contents are well-aligned. The hover effect provides visual feedback, improving user interaction. Ensure that the background color variable is correctly defined in your theme settings.

packages/layout/src/DesignPlugins.vue (8)

58-65: Update state management with pluginState.

The transition from pluginsState to pluginState improves consistency in state management. Ensure that all references to pluginsState have been updated to avoid any runtime errors.


77-77: Include META_APP for enhanced plugin management.

The addition of META_APP improves the management of plugin identifiers, enhancing clarity and maintainability. Ensure that this change is reflected in all relevant parts of the codebase.


101-101: Refactor to use pluginState from useLayout().

This refactor improves the readability and maintainability of the code by centralizing state management. Verify that other parts of the codebase are compatible with this change.


111-111: Streamline navigation list management.

The use of pluginState ensures consistent state management across navigation lists. This change enhances the maintainability of the code.


115-115: Use META_APP for conditional checks.

The use of META_APP in conditional checks improves code clarity and consistency. Ensure that all related conditions are updated accordingly.


140-141: Enhance page management with META_APP.

The use of META_APP for page management ensures consistency and improves code readability. Verify that all related logic is updated to reflect this change.


154-156: Optimize fixed panel management with pluginState.

The logic for managing fixed panels is streamlined with pluginState, improving code clarity and maintainability. Ensure that this logic is consistently applied across the codebase.


165-167: Ensure consistent use of pluginState and components.

The consistent use of pluginState and component references enhances code readability and maintainability. Verify that all component references are correctly defined.

packages/toolbars/generate-vue/src/Main.vue (3)

4-4: Enhance toolbar button layout with flexbox.

The addition of toolbar-generate-btn class with display: flex and align-items: center ensures proper alignment of the icon and title. This change improves the visual presentation of the toolbar button.


264-268: Improve toolbar styling with margin and alignment.

The margin-right property and flexbox alignment enhance the layout and separation of toolbar elements. This change contributes to a more polished user interface.


276-278: Maintain button appearance with hover effects.

The hover effect ensures consistent button appearance and provides visual feedback during interaction. Verify that the background color variable is correctly defined in your theme settings.

packages/plugins/help/src/HelpIcon.vue (3)

51-51: Import change approved.

The addition of META_APP in the import statement is appropriate for the changes in the component.


62-64: Setup function change approved.

The introduction of getPluginState and removal of PLUGIN_NAME aligns with the new state management approach.


138-138: beforeShow method change approved.

The change from PLUGIN_NAME.Materials to META_APP.Materials is consistent with the updated import structure.

packages/theme/light/variable.less (3)

300-300: CSS variable --ti-lowcode-toolbar-breadcrumb-bg addition approved.

The background color for the breadcrumb is defined correctly and enhances the toolbar styling.


302-302: CSS variable --ti-lowcode-toolbar-breadcrumb-left-color addition approved.

The font color for the left side of the breadcrumb is defined correctly and enhances the toolbar styling.


304-304: CSS variable --ti-lowcode-toolbar-breadcrumb-bg-hover addition approved.

The hover background color for the breadcrumb is defined correctly and enhances the toolbar styling.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2e0d828 and 2836035.

Files selected for processing (1)
  • packages/layout/src/DesignToolbars.vue (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/layout/src/DesignToolbars.vue

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2836035 and 1f2aa6d.

Files selected for processing (1)
  • designer-demo/registry.js (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • designer-demo/registry.js

@hexqi hexqi merged commit 52d2432 into opentiny:refactor/develop Aug 23, 2024
1 check passed
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat: add grouping to toolbar

* feat:sort out the status and API of the layout

* fix:remove unused bags

* feat: 工具栏左侧调整

* feat: 间距调整

* fix: remove methods that do not exist

* fix: 去掉多余配置
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