Skip to content

feat(Logout): add AvatarRadius parameter#5969

Merged
ArgoZhang merged 3 commits intomainfrom
feat-logout
May 5, 2025
Merged

feat(Logout): add AvatarRadius parameter#5969
ArgoZhang merged 3 commits intomainfrom
feat-logout

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented May 5, 2025

Link issues

fixes #5968

Summary By Copilot

This pull request introduces enhancements to the Logout component in the BootstrapBlazor library, focusing on improving customization options and refactoring the code for better maintainability. The most important changes include adding support for customizable avatar border radius, updating styles and markup to reflect this new feature, and adding unit tests to validate the changes.

Enhancements to the Logout component:

  • Added a new AvatarRadius parameter to allow customization of the avatar's border radius. This is reflected in the Logout.razor.cs file, where a new private property AvatarStyleString was introduced to dynamically build the CSS style string based on the parameter value. (src/BootstrapBlazor/Components/Logout/Logout.razor.cs, src/BootstrapBlazor/Components/Logout/Logout.razor.csL73-R85)
  • Updated the Logout.razor file to apply the AvatarStyleString to the avatar image's style attribute, enabling the new border-radius customization. (src/BootstrapBlazor/Components/Logout/Logout.razor, src/BootstrapBlazor/Components/Logout/Logout.razorL24-R24)

Styling updates:

  • Modified the SCSS file to include a new CSS variable --bb-logout-user-avatar-border-radius with a default value of 0. This variable is now used to control the avatar's border radius. (src/BootstrapBlazor/Components/Logout/Logout.razor.scss, src/BootstrapBlazor/Components/Logout/Logout.razor.scssR73)

Unit tests:

  • Added a new unit test AvatarRadius_Ok to verify that the AvatarRadius parameter correctly applies the expected CSS style to the component's markup. (test/UnitTest/Components/LogoutTest.cs, test/UnitTest/Components/LogoutTest.csR99-R109)

Code refactoring:

  • Removed the Localizer property from the Logout component and reintroduced the LogoutClassString property, simplifying the component's structure and improving maintainability. (src/BootstrapBlazor/Components/Logout/Logout.razor.cs, [1] [2]

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 customizable avatar border radius to the Logout component

New Features:

  • Introduced AvatarRadius parameter to allow custom border radius for user avatar

Enhancements:

  • Added dynamic style generation for avatar border radius
  • Simplified component structure by removing unnecessary Localizer property

Tests:

  • Added unit test to verify AvatarRadius parameter functionality

@ArgoZhang ArgoZhang requested a review from Copilot May 5, 2025 12:24
@bb-auto bb-auto Bot added the enhancement New feature or request label May 5, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 5, 2025

Reviewer's Guide

This pull request introduces an AvatarRadius parameter to the Logout component, allowing customization of the avatar image's border-radius. This is achieved by adding the parameter to the component's C# code, calculating an inline style based on its value, applying this style to the <img> tag in the Razor file, and defining a corresponding CSS variable in the SCSS file. A unit test is included to verify the new functionality.

File-Level Changes

Change Details Files
Added AvatarRadius parameter for avatar border-radius customization.
  • Added AvatarRadius parameter and AvatarStyleString computed property to Logout.razor.cs.
  • Applied AvatarStyleString to the style attribute of the avatar <img> in Logout.razor.
  • Defined and used the --bb-logout-user-avatar-border-radius CSS variable in Logout.razor.scss.
src/BootstrapBlazor/Components/Logout/Logout.razor.cs
src/BootstrapBlazor/Components/Logout/Logout.razor
src/BootstrapBlazor/Components/Logout/Logout.razor.scss
Added a unit test for the new AvatarRadius parameter.
  • Implemented AvatarRadius_Ok test to verify inline style application.
test/UnitTest/Components/LogoutTest.cs
Refactored C# code-behind for minor cleanup.
  • Removed unused Localizer property injection.
src/BootstrapBlazor/Components/Logout/Logout.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#5968 Add AvatarRadius parameter to the Logout component to allow customization of the avatar's border radius.

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

@bb-auto bb-auto Bot added this to the v9.6.0 milestone May 5, 2025
Copy link
Copy Markdown
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 enhances the Logout component by introducing a customizable AvatarRadius parameter to allow users to specify the avatar's border radius, updating both the component code and its styling.

  • Added the AvatarRadius parameter and built an AvatarStyleString property in Logout.razor.cs.
  • Updated Logout.razor to apply the dynamic border radius via the style attribute on the avatar image.
  • Added a unit test in LogoutTest.cs to validate that the new parameter correctly controls the CSS variable.

Reviewed Changes

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

File Description
test/UnitTest/Components/LogoutTest.cs Added a unit test to verify the AvatarRadius style is applied.
src/BootstrapBlazor/Components/Logout/Logout.razor.cs Introduced the AvatarRadius parameter and refactored Localizer usage.
src/BootstrapBlazor/Components/Logout/Logout.razor Updated the image tag to apply the dynamic style for the avatar.
Files not reviewed (1)
  • src/BootstrapBlazor/Components/Logout/Logout.razor.scss: Language not supported
Comments suppressed due to low confidence (1)

test/UnitTest/Components/LogoutTest.cs:109

  • [nitpick] Consider adding a test case for when AvatarRadius is null to verify that no additional style is applied.
}

Comment thread test/UnitTest/Components/LogoutTest.cs
Copy link
Copy Markdown
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.

We encountered an error and are unable to review this PR. We have been notified and are working to fix it.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@ArgoZhang ArgoZhang merged commit e2ff294 into main May 5, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the feat-logout branch May 5, 2025 12:26
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (897d657) to head (0252d87).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5969   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          670       670           
  Lines        30602     30606    +4     
  Branches      4352      4352           
=========================================
+ Hits         30602     30606    +4     

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

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(Logout): add AvatarRadius parameter

2 participants