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: Edit code style #667

Merged
merged 2 commits into from
Aug 26, 2024
Merged

feat: Edit code style #667

merged 2 commits into from
Aug 26, 2024

Conversation

ianxinnew
Copy link
Contributor

@ianxinnew ianxinnew commented Jul 19, 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 tips property in the CodeConfigurator component to provide contextual examples.
    • Enhanced MetaCodeEditor layout with a split-pane view for improved usability, making demo content always visible.
    • Expanded localization support with new entries for "example code" in English and Chinese.
  • Style

    • Updated dialog box styling with rounded corners for a modern appearance.

Copy link
Contributor

coderabbitai bot commented Jul 19, 2024

Walkthrough

The recent updates enhance the CodeConfigurator and MetaCodeEditor components by introducing user-friendly features like contextual tips and a split-pane layout for a more interactive editing experience. Localization files have been improved with new translations, while global CSS refinements provide a modernized visual appeal. Collectively, these modifications enrich user experience and application usability.

Changes

Files Change Summary
designer-demo/public/mock/bundle.json Added tips property in widget to provide contextual user tips with demo data for better configurability.
packages/common/component/MetaCodeEditor.vue Restructured layout to a split-pane for improved demo display; removed demo toggle and added dynamic width management.
packages/common/i18n/en-us.json Introduced new localization entry for "Example Code" to enhance UI language support.
packages/common/i18n/zh-cn.json Added a translation for "example code" in Chinese, expanding localization capabilities.
packages/theme/common/global.less Updated .tiny-dialog-box with a border-radius for a modernized visual appeal of dialog components.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MetaCodeEditor
    participant DemoComponent

    User->>MetaCodeEditor: Open Editor
    MetaCodeEditor->>DemoComponent: Load Demo
    DemoComponent->>MetaCodeEditor: Display Demo
    MetaCodeEditor->>User: Show Split-pane Layout
Loading

Poem

🐰 In the fields where ideas bloom,
A tip for you, a demo to loom.
With split panes wide and borders round,
In code we play, new joys abound!
Celebrate with a hop and cheer,
For changes bright, we hold so dear! 🌼


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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 20e7f4f and 3c5d137.

Files selected for processing (5)
  • designer-demo/public/mock/bundle.json (1 hunks)
  • packages/common/component/MetaCodeEditor.vue (7 hunks)
  • packages/common/i18n/en-us.json (1 hunks)
  • packages/common/i18n/zh-cn.json (1 hunks)
  • packages/theme/common/global.less (1 hunks)
Files skipped from review due to trivial changes (3)
  • packages/common/i18n/en-us.json
  • packages/common/i18n/zh-cn.json
  • packages/theme/common/global.less
Additional comments not posted (29)
packages/common/component/MetaCodeEditor.vue (25)

24-25: Introduce tiny-split component for split-pane layout.

The introduction of the tiny-split component enhances the user interface by providing a split-pane layout for the code editor and demo content. This change improves usability and organization.


26-27: Add monaco-editor within the left pane of tiny-split.

The monaco-editor is placed within the left pane of the split layout, ensuring the code editor is prominently displayed.


35-36: Add demo content within the right pane of tiny-split.

The demo content is placed within the right pane of the split layout, providing a side-by-side view of the code editor and the demo content.


37-40: Display demo content with proper styling.

The demo content is displayed with appropriate styling, including a header and a preformatted code block. This enhances the readability and presentation of the demo content.


43-43: Close tiny-split component.

The tiny-split component is properly closed, ensuring the split-pane layout is correctly structured.


70-70: Update import statements to include Split component.

The import statements are updated to include the Split component from @opentiny/vue, which is used for the split-pane layout.


77-77: Add TinySplit to components.

The TinySplit component is added to the list of components, making it available for use within the template.


97-97: Change default value of title prop.

The default value of the title prop is changed to '编辑代码', providing a more descriptive default title for the editor dialog.


134-134: Add splitWidth reactive reference.

The splitWidth reactive reference is added to manage the width of the split panes dynamically. The default value is set to 0.7, ensuring the left pane (code editor) occupies 70% of the width.


256-256: Adjust .editor-wrap styling.

The .editor-wrap class is adjusted to ensure proper styling for the editor container.


267-267: Add .btn-box styling.

The .btn-box class is added to style the button container, ensuring proper alignment and spacing of buttons.


276-276: Add .full-width styling.

The .full-width class is added to style the full-width container, ensuring proper alignment and spacing of its child elements.


306-306: Add deep selector for .tiny-dialog-box__header.

The deep selector is used to style the header of the tiny-dialog-box component, ensuring proper padding.


310-310: Add deep selector for .tiny-dialog-box__title.

The deep selector is used to style the title of the tiny-dialog-box component, ensuring proper font size.


314-314: Add deep selector for .view-line.

The deep selector is used to style the view lines within the editor, ensuring proper font size.


322-322: Add .source-code styling.

The .source-code class is added to style the source code container, ensuring proper height and display properties.


328-328: Add .header-tips-container styling.

The .header-tips-container class is added to style the container for header tips, ensuring proper display and color properties.


330-330: Add .header-tips-title styling.

The .header-tips-title class is added to style the title within the header tips container, ensuring proper color and text overflow properties.


339-339: Add .source-code-content styling.

The .source-code-content class is added to style the content within the source code container, ensuring proper height and overflow properties.


343-343: Add .demo-split-pane styling.

The .demo-split-pane class is added to style the split-pane container, ensuring proper height and display properties.


346-346: Add deep selector for .tiny-split-trigger.

The deep selector is used to style the trigger of the tiny-split component, ensuring proper width.


349-349: Hide .tiny-split-trigger-bar-con.

The .tiny-split-trigger-bar-con class is hidden to ensure the split trigger bar is not displayed.


354-354: Add .demo-split-pane-right styling.

The .demo-split-pane-right class is added to style the right pane of the split layout, ensuring proper padding.


357-357: Add pre styling within .demo-split-pane-right.

The pre tag within the .demo-split-pane-right class is styled to ensure proper margin.


361-361: Add code styling within .demo-split-pane-right.

The code tag within the .demo-split-pane-right class is styled to ensure proper font family and color.

designer-demo/public/mock/bundle.json (4)

9419-9420: Verify the appropriateness of the title language.

The title "设置表格的数据" is in Chinese. Ensure that this is consistent with the localization strategy of the application.


9419-9439: LGTM! The addition of the tips property is approved.

The tips property enhances the configurability and usability of the CodeConfigurator component by providing contextual examples.


9422-9429: LGTM! The first object in the demo array is approved.

The sample object provides a clear and comprehensive example of company data.


9430-9437: LGTM! The second object in the demo array is approved.

The sample object provides another clear and comprehensive example of company data.

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 3c5d137 and b661c80.

Files selected for processing (1)
  • packages/common/component/MetaCodeEditor.vue (7 hunks)
Additional comments not posted (4)
packages/common/component/MetaCodeEditor.vue (4)

24-43: Enhanced user experience with split panel layout.

The introduction of the split panel layout using tiny-split enhances the user experience by allowing simultaneous viewing of the editor and example code. The implementation is well-structured and improves usability.


70-80: Component imports updated correctly.

The component imports have been updated to include TinySplit: Split and remove IconChevronDown and IconChevronUp, aligning with the new split panel layout and removal of the demo toggle functionality.


97-97: Improved default title for title prop.

The title prop's default value has been changed from an empty string to '编辑代码', providing a more descriptive default title for the editor dialog. This enhances readability and user experience.


134-134: Dynamic adjustment of split panel width.

The addition of the splitWidth reactive reference allows dynamic adjustment of the split panel width, enhancing the flexibility and usability of the editor layout.

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 b661c80 and c313ee0.

Files selected for processing (1)
  • packages/common/component/MetaCodeEditor.vue (6 hunks)
Additional comments not posted (4)
packages/common/component/MetaCodeEditor.vue (4)

24-43: LGTM! The split-pane layout enhances user experience.

The introduction of the tiny-split component for a split-pane layout is a great improvement, providing a more interactive and organized user experience.


Line range hint 70-97: LGTM! Component imports and prop updates are appropriate.

The import of Split and the update to the title prop default value to '编辑代码' align well with the new layout and localization improvements.


132-133: LGTM! Dynamic splitWidth initialization enhances layout flexibility.

The initialization of splitWidth based on the presence of demo tips allows for a more dynamic and flexible layout adjustment.


Line range hint 255-360: LGTM! Style updates are consistent with the new layout.

The style changes effectively accommodate the new split-pane layout and enhance the visual appeal of the component.

hexqi
hexqi previously approved these changes Aug 23, 2024
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 c313ee0 and 466bc43.

Files selected for processing (1)
  • packages/common/component/MetaCodeEditor.vue (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/common/component/MetaCodeEditor.vue

@hexqi
Copy link
Collaborator

hexqi commented Aug 24, 2024

怎么有这么多文件修改,合并主干有问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Why are there so many file modifications? There is a problem merging the trunk.

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 466bc43 and 5ec11de.

Files selected for processing (1)
  • packages/common/component/MetaCodeEditor.vue (6 hunks)
Additional comments not posted (8)
packages/common/component/MetaCodeEditor.vue (8)

24-43: LGTM!

The introduction of the split panel layout enhances the user experience by providing a more interactive and organized layout.

The code changes are approved.


70-70: LGTM!

The new component imports support the updated layout and functionality.

The code changes are approved.


77-80: LGTM!

The components object has been updated to include the new components used in the updated layout.

The code changes are approved.


97-97: LGTM!

The default value of the title prop has been updated to reflect localization.

The code changes are approved.


132-133: LGTM!

The editorState object has been updated to include splitWidth, which is used to manage the width of the split panel.

The code changes are approved.


255-255: LGTM!

New CSS styles have been added to support the updated layout and functionality.

The code changes are approved.


266-266: LGTM!

New CSS styles have been added to support the updated layout and functionality.

The code changes are approved.


305-305: LGTM!

New CSS styles have been added to support the updated layout and functionality.

The code changes are approved.

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 5ec11de and 0d1a33b.

Files selected for processing (3)
  • packages/common/i18n/en-us.json (1 hunks)
  • packages/common/i18n/zh-cn.json (1 hunks)
  • packages/theme/common/global.less (1 hunks)
Files skipped from review due to trivial changes (3)
  • packages/common/i18n/en-us.json
  • packages/common/i18n/zh-cn.json
  • packages/theme/common/global.less

@hexqi hexqi merged commit bf68247 into opentiny:refactor/develop Aug 26, 2024
1 check passed
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat: Edit code style

* feat: Edit code style
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.

5 participants