Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Dec 28, 2025

closes #11934

Summary by CodeRabbit

  • Refactor
    • Improved code structure and formatting consistency across component implementations to enhance maintainability without affecting user-facing functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

These changes address culture-invariant string formatting for CSS styling in BlazorUI components, replacing culture-dependent interpolated strings with FormattableString.Invariant calls in BitNavPanel, BitPersona, and BitPullToRefresh components. BitCircularTimePicker includes refactoring of expression-bodied methods to block-bodied implementations.

Changes

Cohort / File(s) Summary
Culture-invariant CSS formatting
src/BlazorUI/Bit.BlazorUI.Extras/Components/NavPanel/BitNavPanel.razor.cs, src/BlazorUI/Bit.BlazorUI/Components/Notifications/Persona/BitPersona.razor.cs, src/BlazorUI/Bit.BlazorUI/Components/Utilities/PullToRefresh/BitPullToRefresh.razor.cs
Replaced interpolated string literals for CSS style generation with FormattableString.Invariant-wrapped strings to ensure culture-invariant numeric formatting (translateX, position, margin, width, height, rotation). No control flow changes.
Method refactoring
src/BlazorUI/Bit.BlazorUI/Components/Inputs/CircularTimePicker/BitCircularTimePicker.razor.cs
Converted expression-bodied members (OpenCallout, GetClockHandHeightPercent, GetPointerDegree, GetHours, IsAm) to block-bodied implementations; introduced static helper GetAmPmHours; reintroduced static GetTransformStyle. Logic preserved; public API unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A culture-invariant hop

Through CSS styles, fractional foes did creep,
Where commas replaced dots in cultures deep.
With Invariant wrapped tight, the values now flow,
From fa-IR to all lands, let the styling show! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning BitCircularTimePicker includes code refactoring (expression-bodied to block-bodied members) that extends beyond the stated cultural numeric symbol fix objective. Separate code style refactoring in BitCircularTimePicker into a distinct PR; focus this PR solely on FormattableString.Invariant changes for cultural numeric symbol fixes.
Docstring Coverage ⚠️ Warning Docstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change—fixing cultural numeric symbol issues in BlazorUI components—matching the PR's primary objective.
Linked Issues check ✅ Passed The PR addresses all four affected components (BitCircularTimePicker, BitPersona, BitPullToRefresh, BitNavPanel) by using FormattableString.Invariant to ensure culture-invariant numeric formatting.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/CircularTimePicker/BitCircularTimePicker.razor.cs (7)

257-260: Stylistic refactoring: expression-bodied to block-bodied.

This change is purely stylistic and doesn't address the cultural numeric symbol issue. While not incorrect, it's tangential to the PR objective.


434-439: Stylistic refactoring: expression-bodied to block-bodied.

This change is purely stylistic and doesn't address the cultural numeric symbol issue. While not incorrect, it's tangential to the PR objective.


441-446: Stylistic refactoring: expression-bodied to block-bodied.

This change is purely stylistic and doesn't address the cultural numeric symbol issue. While not incorrect, it's tangential to the PR objective.


470-473: Stylistic refactoring: expression-bodied to block-bodied.

This change is purely stylistic and doesn't address the cultural numeric symbol issue. While not incorrect, it's tangential to the PR objective.


523-526: Stylistic refactoring: expression-bodied to block-bodied.

This change is purely stylistic and doesn't address the cultural numeric symbol issue. While not incorrect, it's tangential to the PR objective.


685-689: Good refactoring: extracted duplicate AM/PM hour conversion logic.

The GetAmPmHours helper correctly converts 24-hour format to 12-hour display format, ensuring that hour 0 and hour 12 both display as 12 (midnight and noon). This eliminates code duplication.


475-478: Stylistic refactoring with improved maintainability.

The change to block-bodied syntax combined with the use of the new GetAmPmHours helper reduces code duplication and improves maintainability. While not directly addressing the cultural numeric symbol issue, this is a beneficial refactoring.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 359493a and 2e4ffe2.

📒 Files selected for processing (4)
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/NavPanel/BitNavPanel.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/CircularTimePicker/BitCircularTimePicker.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Notifications/Persona/BitPersona.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Utilities/PullToRefresh/BitPullToRefresh.razor.cs
🧰 Additional context used
🧬 Code graph analysis (1)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/CircularTimePicker/BitCircularTimePicker.razor.cs (4)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs (17)
  • Task (295-295)
  • Task (340-351)
  • Task (388-396)
  • Task (398-406)
  • Task (408-416)
  • Task (418-423)
  • Task (425-447)
  • Task (449-456)
  • Task (458-468)
  • Task (475-480)
  • Task (482-489)
  • Task (491-503)
  • Task (518-523)
  • Task (525-530)
  • Task (532-557)
  • Task (559-584)
  • IsAm (511-516)
src/BlazorUI/Bit.BlazorUI/Extensions/StringExtensions.cs (1)
  • HasValue (5-10)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DatePicker/BitDatePicker.razor.cs (1)
  • IsAm (1257-1262)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs (1)
  • IsAm (1573-1578)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build Bit.BlazorUI
🔇 Additional comments (5)
src/BlazorUI/Bit.BlazorUI/Components/Utilities/PullToRefresh/BitPullToRefresh.razor.cs (2)

176-194: LGTM! Culture-invariant CSS formatting applied correctly.

The use of FormattableString.Invariant ensures that decimal values are formatted with '.' as the decimal separator regardless of the current culture, preventing CSS breakage in cultures that use ',' (e.g., fa-IR).


218-236: LGTM! Culture-invariant CSS formatting applied correctly.

The use of FormattableString.Invariant ensures that decimal values in the CSS transform and dimensions are formatted with '.' as the decimal separator, preventing CSS breakage in cultures with different numeric symbols.

src/BlazorUI/Bit.BlazorUI/Components/Notifications/Persona/BitPersona.razor.cs (1)

276-288: LGTM! Culture-invariant CSS formatting applied correctly.

The use of FormattableString.Invariant for both the intermediate position string and the final return value ensures that all double values are formatted with '.' as the decimal separator, preventing CSS breakage in cultures with different numeric symbols.

src/BlazorUI/Bit.BlazorUI.Extras/Components/NavPanel/BitNavPanel.razor.cs (1)

389-397: LGTM! Culture-invariant CSS formatting applied correctly.

The use of FormattableString.Invariant ensures that the diffXPanel decimal value is formatted with '.' as the decimal separator in the CSS transform, preventing issues in cultures that use ',' for decimals.

src/BlazorUI/Bit.BlazorUI/Components/Inputs/CircularTimePicker/BitCircularTimePicker.razor.cs (1)

677-683: LGTM! Culture-invariant CSS formatting applied correctly.

The use of FormattableString.Invariant ensures that the double values (x and y coordinates) are formatted with '.' as the decimal separator in the CSS transform, preventing issues in cultures that use ',' for decimals. Making this a static method is also appropriate since it doesn't depend on instance state.

@msynk msynk merged commit 36b3cc7 into bitfoundation:develop Dec 28, 2025
3 checks passed
@msynk msynk deleted the 11934-blazorui-cultural-numeric-symbol-issues branch December 28, 2025 12:21
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.

String manipulation issues for fractional numbers in cultures with different numeric symbols

1 participant