Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Oct 31, 2025

Link issues

fixes #7041

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

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 documentation and sample code for the ActionButtonTemplate parameter in the CardUpload component

Enhancements:

  • Add a demo block showcasing BeforeActionButtonTemplate and ActionButtonTemplate in the UploadCards sample
  • Implement OnTest1Click and OnTest2Click handlers to demonstrate action button behavior

Documentation:

  • Add localization entries for the new demo block titles and introductions in en-US and zh-CN

Copilot AI review requested due to automatic review settings October 31, 2025 06:52
@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Oct 31, 2025
@bb-auto bb-auto bot added this to the 10.0.0 milestone Oct 31, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 31, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a new ActionButtonTemplate demo to the CardUpload component, implements sample click handlers, and updates corresponding localization entries.

Sequence diagram for ActionButtonTemplate button click handling

sequenceDiagram
    actor User
    participant CardUpload
    participant Button
    participant "UploadCards.razor.cs"
    participant ToastService
    User->>CardUpload: Uploads file
    CardUpload->>Button: Renders action buttons (flag, home)
    User->>Button: Clicks flag/home button
    Button->>"UploadCards.razor.cs": Calls OnTest1Click/OnTest2Click(file)
    "UploadCards.razor.cs"->>ToastService: Show information toast with file name
Loading

Class diagram for new click handler methods in UploadCards.razor.cs

classDiagram
    class UploadCards {
        +OnCardUpload(file: UploadFile): Task
        +OnTest1Click(file: UploadFile): Task
        +OnTest2Click(file: UploadFile): Task
        +SaveToFile(file: UploadFile): Task
    }
    class ToastService {
        +Information(title: string, message: string): void
    }
    UploadCards --> ToastService: uses
Loading

File-Level Changes

Change Details Files
Introduce ActionButtonTemplate parameter in CardUpload demos
  • Insert a DemoBlock for ActionButtonTemplate with Title, Introduction, and Name attributes
  • Add BeforeActionButtonTemplate section containing a custom secondary button
  • Add ActionButtonTemplate section containing a custom secondary button
src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor
Implement click handlers for the new action buttons
  • Add OnTest1Click method invoking ToastService.Information
  • Add OnTest2Click method invoking ToastService.Information
src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs
Add localization entries for ActionButtonTemplate documentation
  • Add UploadActionButtonTemplateTitle key to en-US.json and zh-CN.json
  • Add UploadActionButtonTemplateIntro key to en-US.json and zh-CN.json
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#7041 Add documentation for the ActionButtonTemplate parameter in the CardUpload component.

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@ArgoZhang ArgoZhang merged commit d4e13e8 into main Oct 31, 2025
8 of 9 checks passed
@ArgoZhang ArgoZhang deleted the chore-version branch October 31, 2025 06:53
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 there - I've reviewed your changes and they look great!


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 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (70156e6) to head (05dbbb9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7042   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          743       743           
  Lines        32475     32475           
  Branches      4500      4500           
=========================================
  Hits         32475     32475           
Flag Coverage Δ
BB 100.00% <ø> (?)

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

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

Copy link
Contributor

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 adds support for customizing action buttons in the CardUpload component with two new template parameters (ActionButtonTemplate and BeforeActionButtonTemplate), and updates several package dependencies to stable versions.

  • Adds new template parameters for custom action buttons in CardUpload component
  • Updates three package dependencies from pre-release to stable versions
  • Adds localized strings and demo sample for the new template feature

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/BootstrapBlazor.Server/Locales/zh-CN.json Adds Chinese localization strings for the new action button template feature
src/BootstrapBlazor.Server/Locales/en-US.json Adds English localization strings for the new action button template feature
src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs Adds two event handler methods for demonstrating custom action buttons
src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor Adds a new demo block showcasing the ActionButtonTemplate feature
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj Updates three package references to stable versions
Comments suppressed due to low confidence (11)

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:76

  • Call to 'System.IO.Path.Combine'.
            var uploaderFolder = Path.Combine(WebsiteOption.Value.WebRootPath, "images", "uploader");

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:78

  • Call to 'System.IO.Path.Combine'.
            var fileName = Path.Combine(uploaderFolder, file.FileName);

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:101

  • Poor error handling: empty catch block.
            catch (OperationCanceledException)
            {

            }

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:14

  • Field '_isDirectory' can be 'readonly'.
    private bool _isDirectory = false;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:15

  • Field '_isDisabled' can be 'readonly'.
    private bool _isDisabled = false;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:16

  • Field '_isUploadButtonAtFirst' can be 'readonly'.
    private bool _isUploadButtonAtFirst = false;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:17

  • Field '_showProgress' can be 'readonly'.
    private bool _showProgress = true;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:18

  • Field '_showZoomButton' can be 'readonly'.
    private bool _showZoomButton = true;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:19

  • Field '_showDeleteButton' can be 'readonly'.
    private bool _showDeleteButton = true;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:20

  • Field '_showDownloadButton' can be 'readonly'.
    private bool _showDownloadButton = true;

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs:13

  • Field '_isMultiple' can be 'readonly'.
    private bool _isMultiple = true;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"UploadsWasmError": "In wasm mode, please call the api to save"
"UploadsWasmError": "In wasm mode, please call the api to save",
"UploadActionButtonTemplateTitle": "Custom action button",
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (insert it before the default button)."
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

Grammar issue: 'insert it before' should be 'inserting it before' to match the parallel structure with 'appending it to the end'.

Suggested change
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (insert it before the default button)."
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (inserting it before the default button)."

Copilot uses AI. Check for mistakes.
"UploadsWasmError": "In wasm mode, please call the api to save"
"UploadsWasmError": "In wasm mode, please call the api to save",
"UploadActionButtonTemplateTitle": "Custom action button",
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (insert it before the default button)."
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The backticks before <code> tags are unnecessary. Change `<code>ActionButtonTemplate</code>` to <code>ActionButtonTemplate</code> and `<code>BeforeActionButtonTemplate</code>` to <code>BeforeActionButtonTemplate</code>.

Suggested change
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (insert it before the default button)."
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the <code>ActionButtonTemplate</code> parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the <code>BeforeActionButtonTemplate</code> parameter (insert it before the default button)."

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(CardUpload): add ActionButtonTemplate parameter documentation

2 participants