Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove BitSpinButton component (#10232) #10235

Merged

Conversation

Cyrus-Sushiant
Copy link
Member

@Cyrus-Sushiant Cyrus-Sushiant commented Mar 13, 2025

This closes #10232

Summary by CodeRabbit

  • New Features

    • Added updated routes for numeric input, ensuring legacy URLs now point to the enhanced NumberField.
  • Refactor

    • Replaced the SpinButton component with the NumberField across demos, panels, tooltips, scrollable panes, and ratings.
    • Updated navigation to consolidate numeric input options for a more streamlined user experience.

Copy link

coderabbitai bot commented Mar 13, 2025

Walkthrough

This pull request removes the SpinButton component and all its related files—including tests, styles, and demos—from the codebase. References to SpinButton in demo pages and navigation have been replaced by BitNumberField. Additionally, associated routing and validation models for SpinButton have been removed, and import statements for SpinButton styles updated accordingly. These changes consolidate the numeric input functionality under BitNumberField without altering the underlying data binding or public API declarations.

Changes

File(s) Change Summary
src/BlazorUI/Bit.BlazorUI.Tests/.../SpinButton/BitSpinButtonTestModel.cs
src/BlazorUI/Bit.BlazorUI.Tests/.../SpinButton/BitSpinButtonTests.cs
src/BlazorUI/Bit.BlazorUI.Tests/.../SpinButton/BitSpinButtonValidationTest.razor
Removed test model, unit tests, and validation component for the SpinButton.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor.cs
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.scss
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButtonClassStyles.cs
Deleted the SpinButton implementation, its code-behind, styles, and associated styling classes.
src/BlazorUI/Bit.BlazorUI/Styles/components.scss Removed the import statement for the SpinButton stylesheet.
Multiple demo files in the Demo project:
.../Pages/Components/Extras/ProPanel/BitProPanelDemo.razor[.cs]
.../Pages/Components/Inputs/Rating/BitRatingDemo.razor[.cs]
.../Pages/Components/Surfaces/Panel/BitPanelDemo.razor[.cs]
.../Pages/Components/Surfaces/ScrollablePane/BitScrollablePaneDemo.razor[.cs]
.../Pages/Components/Surfaces/Tooltip/BitTooltipDemo.razor[.cs]
.../Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor[.cs/.scss]
.../Pages/Components/Inputs/SpinButton/BitSpinButtonValidationModel.cs
.../Pages/Components/Inputs/NumberField/BitNumberFieldDemo.razor
Replaced SpinButton with BitNumberField in various demos, added new routes for BitNumberField (including SpinButton URLs), and removed obsolete SpinButton demo files and validation models.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs
Removed the standalone SpinButton navigation link and consolidated its URLs under the NumberField navigation entry.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant D as Demo Page
    participant N as BitNumberField
    participant M as Model
    U->>D: Load the demo page
    D->>N: Render BitNumberField component
    U->>N: Enter/update numeric value
    N->>M: Bind and update the model
    M-->>N: Return updated value
    N-->>D: Reflect new value on the UI
Loading

Poem

I'm a rabbit with a bounce in my code,
Hopping past SpinButtons down the old road.
Now BitNumberField leads the way,
With every bound value bright as day.
I twirl in joy with each new line—
CodeRabbit cheers, "This upgrade is divine!"
🐰✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af8bb32 and 8ead0ef.

📒 Files selected for processing (25)
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonTestModel.cs (0 hunks)
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonTests.cs (0 hunks)
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonValidationTest.razor (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor.cs (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.scss (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButtonClassStyles.cs (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Styles/components.scss (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProPanel/BitProPanelDemo.razor (5 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProPanel/BitProPanelDemo.razor.cs (5 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/NumberField/BitNumberFieldDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Rating/BitRatingDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Rating/BitRatingDemo.razor.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor.cs (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor.scss (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonValidationModel.cs (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Panel/BitPanelDemo.razor (4 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Panel/BitPanelDemo.razor.cs (4 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/ScrollablePane/BitScrollablePaneDemo.razor (2 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/ScrollablePane/BitScrollablePaneDemo.razor.cs (2 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Tooltip/BitTooltipDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Tooltip/BitTooltipDemo.razor.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs (1 hunks)
💤 Files with no reviewable changes (13)
  • src/BlazorUI/Bit.BlazorUI/Styles/components.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.scss
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonTestModel.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonValidationModel.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButton.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SpinButton/BitSpinButtonDemo.razor
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonTests.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SpinButton/BitSpinButtonClassStyles.cs
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/SpinButton/BitSpinButtonValidationTest.razor
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build and test
🔇 Additional comments (14)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/NumberField/BitNumberFieldDemo.razor (1)

4-5: Backward compatibility routing added for SpinButton URLs.

These additional routes ensure users accessing the former SpinButton component URLs will now be redirected to the NumberField component, maintaining backward compatibility during this transition.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Rating/BitRatingDemo.razor (1)

109-109: BitSpinButton replaced with BitNumberField.

The change maintains the same two-way binding functionality while standardizing on BitNumberField for numeric input controls.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Tooltip/BitTooltipDemo.razor.cs (1)

316-316: BitSpinButton replaced with BitNumberField while preserving mode.

The component has been updated while maintaining the same functionality, including the BitSpinButtonMode.Inline parameter for consistent appearance.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/ScrollablePane/BitScrollablePaneDemo.razor.cs (2)

276-276: BitSpinButton replaced with BitNumberField for overflow items count.

Maintains the same functionality with Min attribute and value binding.


315-315: BitSpinButton replaced with BitNumberField for gutter items count.

Maintains the same functionality with Min attribute and value binding.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Tooltip/BitTooltipDemo.razor (1)

81-81: Component replacement looks good

The BitSpinButton has been correctly replaced with BitNumberField while maintaining the same attributes (Label, binding, Mode, Style).

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProPanel/BitProPanelDemo.razor.cs (1)

432-432: Consistent component replacement applied successfully

All instances of BitSpinButton have been properly replaced with BitNumberField components, maintaining the same properties and functionality.

Also applies to: 446-446, 458-458, 470-470, 482-482

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Rating/BitRatingDemo.razor.cs (1)

259-259: Component replacement looks good

The BitSpinButton has been correctly replaced with BitNumberField for the twoWayBinding implementation.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Panel/BitPanelDemo.razor.cs (2)

247-247: Consistent component replacement applied successfully

All instances of BitSpinButton have been properly replaced with BitNumberField while preserving the same attribute structure and functionality.

Also applies to: 259-259, 268-268, 275-275, 284-284


247-247:

✅ Verification successful

Verify compatibility with BitSpinButtonMode

The code is now using BitNumberField but still references BitSpinButtonMode.Inline. Ensure this enum is available to the NumberField component.


🏁 Script executed:

#!/bin/bash
# Find where BitSpinButtonMode is defined and check if BitNumberField references it
echo "Checking for BitSpinButtonMode definition:"
rg -A 3 "enum BitSpinButtonMode" --type csharp

echo -e "\nChecking if BitNumberField references BitSpinButtonMode:"
rg "BitNumberField.*BitSpinButtonMode" --type csharp

Length of output: 3389


Confirmed BitSpinButtonMode Compatibility

  • The enum BitSpinButtonMode is defined in src/BlazorUI/Bit.BlazorUI/Components/Inputs/NumberField/BitSpinButtonMode.cs.
  • Multiple instances where BitNumberField references BitSpinButtonMode.Inline (including tests and demos) confirm that the NumberField component is compatible with this enum.

No changes are required.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Panel/BitPanelDemo.razor (1)

72-72: Component replacement successfully implemented

The BitSpinButton has been replaced with BitNumberField while maintaining the same functionality through the Mode="BitSpinButtonMode.Inline" attribute. This change is consistent with the PR objective to remove the BitSpinButton component from the codebase.

Also applies to: 88-88, 97-97, 104-104, 113-113

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProPanel/BitProPanelDemo.razor (1)

151-151: Consistent component replacement implemented

The BitSpinButton has been correctly replaced with BitNumberField while maintaining the same binding and mode attributes. This consistent approach ensures that the user experience remains unchanged while aligning with the PR objective to remove the BitSpinButton component.

Also applies to: 167-167, 179-179, 191-191, 203-203

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/ScrollablePane/BitScrollablePaneDemo.razor (1)

119-119: Component replacement properly applied

The BitSpinButton components used for item count inputs have been properly replaced with BitNumberField components. This change maintains the same functionality while adhering to the PR objective of removing BitSpinButton.

Also applies to: 142-142

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs (1)

32-32: Navigation routing updated to handle component consolidation

The navigation entry for NumberField has been properly updated to include the URLs previously associated with SpinButton. This ensures that any existing links or bookmarks to the SpinButton component will redirect to the NumberField component, maintaining backwards compatibility while removing the deprecated component.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@msynk msynk merged commit 1f2c1ba into bitfoundation:develop Mar 13, 2025
3 checks passed
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.

Remove BitSpinButton component in favor of BitNumberField
2 participants