Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Oct 28, 2024

add Swatches parameter

Summary of the changes (Less than 80 chars)

简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号

Description

fixes #4561

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add a 'Swatches' parameter to the ColorPicker component to enable selection from preset colors and enhance the component with opacity support. Update localization files to reflect these changes.

New Features:

  • Introduce a 'Swatches' parameter to the ColorPicker component, allowing users to select from preset candidate colors.

Enhancements:

  • Add support for opacity in the ColorPicker component with the 'IsSupportOpacity' parameter.

Documentation:

  • Update English and Chinese localization files to include descriptions for new ColorPicker attributes.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 28, 2024

Reviewer's Guide by Sourcery

This PR enhances the ColorPicker component by adding support for preset color swatches and transparency options. The implementation includes updates to the component's attributes, JavaScript configuration, and corresponding localization strings in both English and Chinese.

Class diagram for updated ColorPicker component

classDiagram
    class ColorPicker {
        +RenderFragment<string> Template
        +Func<string, Task<string>> Formatter
        +bool IsSupportOpacity
        +bool Swatches
        +Func<string, Task> OnValueChanged
    }
    note for ColorPicker "Added Swatches and IsSupportOpacity parameters"
Loading

File-Level Changes

Change Details Files
Added new parameters and attributes to the ColorPicker component
  • Added 'Swatches' parameter for preset candidate colors
  • Added 'IsSupportOpacity' parameter for transparency support
  • Added 'Formatter' attribute for color value formatting
  • Renamed 'Event1' to more descriptive 'EventOnValueChanged'
  • Updated attribute descriptions and types
src/BootstrapBlazor.Server/Components/Samples/ColorPickers.razor.cs
Updated localization files with new ColorPicker attributes
  • Added translations for new attributes (Template, Formatter, IsSupportOpacity, Swatches)
  • Updated event callback description
  • Added corresponding Chinese translations for all new strings
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json
Modified ColorPicker JavaScript configuration
  • Added handling for null swatches option
  • Updated options processing logic
src/BootstrapBlazor/Components/ColorPicker/ColorPicker.razor.js
Fixed dialog parameter order in ShowModal call
  • Swapped title and content parameters to match correct order
src/BootstrapBlazor.Server/Components/Samples/Dialogs.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#4561 Add a Swatches parameter to ColorPicker component to support preset candidate colors

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 28, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please add documentation and update the demo to show how the new Swatches parameter should be used
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c7be111) to head (9706f39).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4562   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          622       622           
  Lines        26937     26937           
  Branches      3923      3923           
=========================================
  Hits         26937     26937           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 28, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please add documentation explaining what the Swatches parameter does and how to use it, including examples of valid values.
  • The PR template is incomplete - please fill in the risk justification and packaging review sections.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 28, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 28, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

@ArgoZhang
Copy link
Member Author

@microsoft-github-policy-service agree

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 28, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The Swatches parameter is defined as boolean type but appears to be used as a collection of preset colors in the JS code. Please correct the type definition to match its intended use.
  • The DialogService.ShowModal parameter order change should be moved to a separate PR since it's unrelated to the ColorPicker changes.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang enabled auto-merge (squash) October 28, 2024 02:28
@ArgoZhang ArgoZhang disabled auto-merge October 28, 2024 02:28
@ArgoZhang ArgoZhang merged commit 0c5707b into main Oct 28, 2024
4 checks passed
@ArgoZhang ArgoZhang deleted the fix-color branch October 28, 2024 02:31
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.

feat(ColorPicker): add Swatches parameter

2 participants