Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Nov 27, 2025

Link issues

fixes #7190

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 configurable controls for PdfReader demo to toggle download, print, and two-page view options.

New Features:

  • Expose ShowPrint and ShowDownload options on the PdfReader sample via bound switches.

Enhancements:

  • Rename and align the two-page view option from ShowTwoPagesOneViewButton to ShowTwoPagesOneView in the sample for consistency with the PdfReader API.

Copilot AI review requested due to automatic review settings November 27, 2025 03:39
@bb-auto bb-auto bot added the enhancement New feature or request label Nov 27, 2025
@bb-auto bb-auto bot added this to the 10.0.0 milestone Nov 27, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 27, 2025

Reviewer's Guide

Updates the PdfReaders sample component to demonstrate new configurable PdfReader toolbar options (ShowPrint, ShowDownload, ShowTwoPagesOneView) and wires them to the PdfReader control with sensible defaults and improved layout/styling.

Sequence diagram for toggling PdfReader toolbar options at runtime

sequenceDiagram
  actor User
  participant PdfReaders
  participant PdfReader

  User->>PdfReaders: Toggle Switch bound_to__showDownload
  PdfReaders->>PdfReaders: Update _showDownload
  PdfReaders->>PdfReader: Re_render with ShowDownload = _showDownload

  User->>PdfReaders: Toggle Switch bound_to__showPrint
  PdfReaders->>PdfReaders: Update _showPrint
  PdfReaders->>PdfReader: Re_render with ShowPrint = _showPrint

  User->>PdfReaders: Toggle Switch bound_to__showTwoPagesOneView
  PdfReaders->>PdfReaders: Update _showTwoPagesOneView
  PdfReaders->>PdfReader: Re_render with ShowTwoPagesOneView = _showTwoPagesOneView
Loading

Updated class diagram for PdfReaders sample and PdfReader parameters

classDiagram
  class PdfReaders {
    -PdfReader PdfReader
    -bool _showTwoPagesOneView
    -bool _showPrint
    -bool _showDownload
    -string _url
    +Task OnDownloadAsync()
  }

  class PdfReader {
    +string Url
    +bool ShowTwoPagesOneView
    +bool ShowDownload
    +bool ShowPrint
    +string ViewHeight
    +Func Task OnDownloadAsync
  }

  PdfReaders --> PdfReader : uses
Loading

File-Level Changes

Change Details Files
Expose runtime-togglable PdfReader toolbar options in the PdfReaders sample and bind them to the PdfReader component.
  • Add ShowDownload and ShowPrint toggles as BootstrapInputGroup + Switch controls in the demo toolbar section.
  • Rename the existing ShowTwoPagesOneView toggle/binding from _showTwoPagesOneViewButton to _showTwoPagesOneView for consistency with the new PdfReader API.
  • Pass the new _showDownload, _showPrint, and updated _showTwoPagesOneView fields into the PdfReader component using the new ShowDownload, ShowPrint, and ShowTwoPagesOneView parameters.
  • Adjust the layout classes (g-3, input-group label width style) for better alignment of the new controls.
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor
Add backing fields for the new toolbar options and align state with the updated view bindings.
  • Replace the _showTwoPagesOneViewButton field with _showTwoPagesOneView and initialize it to true.
  • Introduce new _showPrint and _showDownload boolean fields initialized to true so print and download are enabled by default in the sample.
  • Keep the existing download handler and URL unchanged, so only the visibility of toolbar actions is controlled by the new flags.
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7190 Add a ShowPrint parameter to the PdfReader component and expose it in the sample so that printing can be toggled.

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

# Conflicts:
#	src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
#	src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor
#	src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor.cs
@ArgoZhang ArgoZhang merged commit 84d42b5 into main Nov 27, 2025
4 checks passed
@ArgoZhang ArgoZhang deleted the feat-pdf branch November 27, 2025 03:41
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 - here's some feedback:

  • The new labels "ShowDownload", "ShowPrint", and "ShowTwoPagesOneView" are hard-coded; consider binding them through Localizer[...] like the rest of the sample text so they participate in localization.
  • The inline style style="--bb-input-group-label-width: 176px;" on the <section> could be moved into a CSS class to keep styling concerns out of the markup and make future adjustments easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new labels "ShowDownload", "ShowPrint", and "ShowTwoPagesOneView" are hard-coded; consider binding them through `Localizer[...]` like the rest of the sample text so they participate in localization.
- The inline style `style="--bb-input-group-label-width: 176px;"` on the `<section>` could be moved into a CSS class to keep styling concerns out of the markup and make future adjustments easier.

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 Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1786ad7) to head (604f457).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7191   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        32583     32583           
  Branches      4515      4515           
=========================================
  Hits         32583     32583           
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 a ShowPrint parameter to the PdfReader component, allowing users to control the visibility of the print button. The demo page has been refactored to showcase individual parameter controls with switches.

  • Refactored the demo to use individual boolean flags instead of a single options object
  • Added ShowPrint, ShowDownload, and ShowTwoPagesOneView switches for user control
  • Upgraded BootstrapBlazor.PdfReader package from 10.0.1-beta05 to 10.0.1-beta07

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor.cs Added dependency injections and download handler; replaced options object with individual boolean flags
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor Updated UI to show individual parameter switches and pass them directly to PdfReader component
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj Updated PdfReader package version to support new ShowPrint parameter

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

Comment on lines +30 to +31
<PdfReader Url="@_url" ShowTwoPagesOneView="_showTwoPagesOneView"
ShowDownload="_showDownload" ShowPrint="_showPrint"
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Parameter bindings should use the '@' prefix for C# expressions. The parameters ShowTwoPagesOneView, ShowDownload, and ShowPrint are bound with quotes but no '@' prefix, which will pass them as string literals rather than boolean values. Change to ShowTwoPagesOneView="@_showTwoPagesOneView", ShowDownload="@_showDownload", and ShowPrint="@_showPrint".

Suggested change
<PdfReader Url="@_url" ShowTwoPagesOneView="_showTwoPagesOneView"
ShowDownload="_showDownload" ShowPrint="_showPrint"
<PdfReader Url="@_url" ShowTwoPagesOneView="@_showTwoPagesOneView"
ShowDownload="@_showDownload" ShowPrint="@_showPrint"

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(PdfReader): add ShowPrint parameter

2 participants