Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 28, 2026

Link issues

fixes #7588

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 toolbar visibility to the PDF viewer sample component.

New Features:

  • Introduce a ShowToolbar parameter on the PdfViewer sample to toggle the viewer toolbar at runtime.

Enhancements:

  • Extend the PdfViewers sample UI with a switch control bound to the new toolbar visibility option.

Copilot AI review requested due to automatic review settings January 28, 2026 03:57
@bb-auto bb-auto bot added the enhancement New feature or request label Jan 28, 2026
@bb-auto bb-auto bot added this to the v10.2.0 milestone Jan 28, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a configurable ShowToolbar parameter to the PdfViewer sample and wires it to a new UI switch, while adjusting the sample PDF URL and component backing state to support toolbar visibility toggling.

Sequence diagram for toggling PdfViewer ShowToolbar parameter

sequenceDiagram
    actor User
    participant Browser
    participant PdfViewersComponent
    participant PdfViewer

    User->>Browser: Toggle ShowToolbar switch
    Browser->>PdfViewersComponent: Update _showToolbar via binding
    PdfViewersComponent->>PdfViewer: Render with ShowToolbar = _showToolbar and updated Url
    PdfViewer-->>User: Display PDF with toolbar visibility applied
Loading

Updated class diagram for PdfViewers sample component backing class

classDiagram
    class PdfViewers {
        int _pageIndex
        bool _showToolbar
        Task OnLoaded()
        Task NotSupportCallback()
    }
Loading

File-Level Changes

Change Details Files
Expose and demo a new ShowToolbar toggle for the PdfViewer sample component.
  • Add a Switch-bound _showToolbar input in the sample form to control toolbar visibility.
  • Pass the new ShowToolbar parameter from the Razor sample to the PdfViewer component instance.
  • Initialize the backing _showToolbar field to true in the PdfViewers.razor.cs code-behind.
  • Adjust the sample PdfViewer Url to include query parameters for toolbar and navigation pane behavior.
src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor
src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7588 Add a ShowToolbar (or equivalent) parameter to the PdfViewer component that controls whether the PDF toolbar is shown when rendering. The diff only updates the sample PdfViewers.razor to bind a _showToolbar field and passes ShowToolbar="_showToolbar" into , but there is no change to the PdfViewer component itself (no parameter definition, no rendering logic). Therefore the core feature—implementing a functional ShowToolbar parameter on the PdfViewer component—is not present.
#7588 Update the sample/demo usage of PdfViewer to demonstrate the new ShowToolbar functionality, including a UI control to toggle it.

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 e160cd8 into main Jan 28, 2026
7 checks passed
@ArgoZhang ArgoZhang deleted the feat-viewer branch January 28, 2026 03:57
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 - I've left some high level feedback:

  • In the sample, the URL is hard-coded with #toolbar=0&navpanes=0 while ShowToolbar is bound to _showToolbar; consider aligning these so the new ShowToolbar parameter is the single source of truth for toolbar visibility to avoid confusing or conflicting behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the sample, the URL is hard-coded with `#toolbar=0&navpanes=0` while `ShowToolbar` is bound to `_showToolbar`; consider aligning these so the new `ShowToolbar` parameter is the single source of truth for toolbar visibility to avoid confusing or conflicting behavior.

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 Jan 28, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7594   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          749       749           
  Lines        32988     32988           
  Branches      4578      4578           
=========================================
  Hits         32988     32988           
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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Updates the server demo to expose the new ShowToolbar option for PdfViewer and bumps the BootstrapBlazor.PdfViewer package version to a release that includes the parameter.

Changes:

  • Add _showToolbar state and a UI switch to toggle toolbar visibility in the PdfViewer sample.
  • Pass the new ShowToolbar parameter to <PdfViewer /> in the sample.
  • Update BootstrapBlazor.PdfViewer package reference from 10.0.0 to 10.0.1.

Reviewed changes

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

File Description
src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor.cs Adds backing field to support toolbar toggle in the sample.
src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor Adds a switch and wires ShowToolbar into the PdfViewer demo.
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj Bumps PdfViewer package to pick up the new parameter.
Comments suppressed due to low confidence (1)

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

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

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

</section>
<PdfViewer Url="./samples/sample.pdf" Height="620px" PageIndex="@_pageIndex"
NotSupportCallback="NotSupportCallback" OnLoaded="OnLoaded"
<PdfViewer Url="./samples/sample.pdf#toolbar=0&navpanes=0" Height="620px" PageIndex="@_pageIndex"
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Url is now hardcoded with #toolbar=0&navpanes=0, which will force the browser PDF plugin to hide the toolbar regardless of the new ShowToolbar parameter. This makes the toggle ineffective and can also conflict with PdfViewer’s own URL handling. Consider keeping Url as the raw PDF path and let ShowToolbar control toolbar visibility (or dynamically append/remove the fragment based on _showToolbar).

Suggested change
<PdfViewer Url="./samples/sample.pdf#toolbar=0&navpanes=0" Height="620px" PageIndex="@_pageIndex"
<PdfViewer Url="./samples/sample.pdf" Height="620px" PageIndex="@_pageIndex"

Copilot uses AI. Check for mistakes.

private int _pageIndex = 1;

private bool _showToolbar = true;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Field '_showToolbar' can be 'readonly'.

Suggested change
private bool _showToolbar = true;
private readonly bool _showToolbar = true;

Copilot uses AI. Check for mistakes.
@@ -17,6 +17,8 @@ public partial class PdfViewers

private int _pageIndex = 1;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Field '_pageIndex' can be 'readonly'.

Suggested change
private int _pageIndex = 1;
private readonly int _pageIndex = 1;

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(PdfViewer): add ShowToolbar parameter

1 participant