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

refactor: remove the old Select component #12418

Merged

Conversation

TylerAPfledderer
Copy link
Contributor

@TylerAPfledderer TylerAPfledderer commented Mar 10, 2024

Removes the old Select component and renames the ReactSelect component and it's exports.

This includes removing the Chakra Select component theme, as the ReactSelect custom theme needs to be retained for the specific usage with react-select.

Summary by CodeRabbit

  • New Features
    • Introduced a new Dropdown component with enhanced styling and functionality.
  • Refactor
    • Migrated from ReactSelect to Select component across various components for consistency and integration with Chakra UI.
    • Updated Select component to align with Chakra UI and react-select integration, including style adjustments and onChange handler improvements.
  • Chores
    • Removed the Select component from the exported entities in the @chakra-ui/components module to streamline available components.

Copy link
Contributor

coderabbitai bot commented Mar 10, 2024

Walkthrough

The overarching change involves the refactoring and standardization of select components across the project. The Select component from @chakra-ui/components was removed, prompting updates across various components to integrate a new Select component, which now incorporates Chakra UI and react-select for enhanced styling and functionality. This transition necessitated updates in import statements, type declarations (e.g., from ReactSelectOnChange to SelectOnChange), and component usage, aligning the project's dropdown selection mechanisms more closely with the updated Select component's API.

Changes

Files Change Summary
.../@chakra-ui/components/index.ts Removed Select from exports
.../CentralizedExchanges/index.tsx Updated import and usage from ReactSelect to Select
.../FindWallet/WalletTable/index.tsx Replaced ReactSelect with Select and updated type ReactSelectOnChange to SelectOnChange
.../Layer2/Layer2Onboard.tsx Updated imports and types for Select and SelectOnChange
.../Select/Select.stories.tsx Renamed Select to Dropdown, updated component structure and rendering logic
.../Select/index.tsx Refactored Select for Chakra UI and react-select integration, updated styles and onChange handler
.../Select/innerComponents.tsx Changed useReactSelectStyles import to useSelectStyles
.../Staking/StakingLaunchpadWidget.tsx Replaced ReactSelect with Select and updated handleChange type to SelectOnChange
.../hooks/useCentralizedExchanges.ts Replaced ReactSelectOnChange type with SelectOnChange

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added review needed 👀 tooling 🔧 Changes related to tooling of the project labels Mar 10, 2024
Copy link

netlify bot commented Mar 10, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 058ae6c
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/65edfb3487d8fc000862809c
😎 Deploy Preview https://deploy-preview-12418--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9bd486f and 058ae6c.
Files selected for processing (10)
  • src/@chakra-ui/components/ReactSelect.ts (1 hunks)
  • src/@chakra-ui/components/index.ts (2 hunks)
  • src/components/CentralizedExchanges/index.tsx (2 hunks)
  • src/components/FindWallet/WalletTable/index.tsx (5 hunks)
  • src/components/Layer2/Layer2Onboard.tsx (5 hunks)
  • src/components/Select/Select.stories.tsx (1 hunks)
  • src/components/Select/index.tsx (1 hunks)
  • src/components/Select/innerComponents.tsx (7 hunks)
  • src/components/Staking/StakingLaunchpadWidget.tsx (2 hunks)
  • src/hooks/useCentralizedExchanges.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • src/components/Select/innerComponents.tsx
Additional comments: 13
src/components/Select/Select.stories.tsx (3)
  • 4-4: The import statement correctly imports Select from the current directory. Ensure that the directory structure and export statements in the index.tsx file align with this import.
  • 9-9: Renaming the component to Dropdown in the story title enhances clarity, especially if the project uses multiple select components. This change aligns with the PR's objective to streamline component architecture.
  • 24-48: The update to use HStack instead of VStack for rendering the Select component instances side by side is a good UI decision for horizontal alignment. This change, along with the modifications in the options structure, reflects a thoughtful approach to improving the component's usability and presentation.
src/@chakra-ui/components/index.ts (1)
  • 23-28: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-52]

Removing the Select component from the @chakra-ui/components module and ensuring that ReactSelect is still exported aligns with the PR's goal to consolidate select component usage. This change simplifies the component architecture and reduces potential confusion between Chakra UI's Select and the custom Select component. However, ensure that all references to the removed Select component are updated across the project to prevent import errors.

src/components/Select/index.tsx (1)
  • 1-78: The refactoring of the Select component to integrate with Chakra UI and react-select is comprehensive, covering imports, styling, and the onChange handler. The use of createStylesContext and useMultiStyleConfig for styling is a good practice for theme consistency. The explicit type declaration for the SelectOnChange handler improves type safety and clarity. However, ensure that the locked props unstyled and menuPlacement are intentionally set and align with the design system's requirements. Additionally, verify that the components prop is correctly importing and using custom components for react-select.
src/components/Staking/StakingLaunchpadWidget.tsx (1)
  • 9-23: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [12-59]

Replacing ReactSelect with the updated Select component and using the SelectOnChange type for the handleChange function aligns with the PR's objectives. This change ensures consistency in component usage and type declarations across the project. It's important to test the Select component's functionality within this context to ensure that the onChange behavior and user experience remain intact.

src/@chakra-ui/components/ReactSelect.ts (1)
  • 3-3: Updating the import path to @/components/Select/innerComponents is a necessary adjustment following the renaming and restructuring of the Select component. This change ensures that the ReactSelect component correctly utilizes the updated inner components. Verify that all inner components are correctly migrated and functional within the new Select component structure.
src/components/CentralizedExchanges/index.tsx (1)
  • 9-15: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [12-106]

Updating the import to use the new Select component and adjusting its usage within the CentralizedExchanges component aligns with the PR's objectives. This change simplifies the component architecture and ensures consistency in select component usage across the project. It's important to verify that the Select component functions as expected in this context, particularly with respect to user interactions and data handling.

src/hooks/useCentralizedExchanges.ts (1)
  • 12-18: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [15-298]

Replacing the ReactSelectOnChange type with SelectOnChange in the useCentralizedExchanges hook aligns with the PR's objectives to streamline component usage. This change ensures type consistency and clarity across the project. It's crucial to test the hook's functionality, especially the handleSelectChange function, to confirm that the Select component's integration works as expected without any regressions.

src/components/Layer2/Layer2Onboard.tsx (1)
  • 173-179: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [31-267]

Updating the import to use the new Select component and adjusting the type declarations for handleLayer2SelectChange and handleExchangeOnboard to use SelectOnChange are consistent with the PR's objectives. These changes ensure that the Layer2Onboard component utilizes the streamlined Select component architecture. It's important to test these changes thoroughly, especially the Select component's integration and the onChange handlers, to ensure that the user experience and functionality remain intact.

src/components/FindWallet/WalletTable/index.tsx (3)
  • 32-32: The import statement correctly updates from ReactSelect to Select, aligning with the PR's objective to standardize the component naming and usage. This change also includes the update of the type from ReactSelectOnChange to SelectOnChange, ensuring type consistency across the component.
  • 249-249: The handleFeatureSelectChange function is updated to use the SelectOnChange type, which is part of the refactor to standardize the component and type naming. This change is correctly implemented and aligns with the PR's objectives.
  • 278-278: The usage of the Select component within the WalletContentHeader for the three feature selection dropdowns is correctly implemented, reflecting the transition from ReactSelect to Select. This change is part of the broader refactor to streamline component architecture and enhance maintainability. It's important to ensure that the options and defaultValue props passed to each Select instance are correctly handled and that the onChange handler functions as expected with the new component.

Also applies to: 293-293, 308-308

Copy link
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

LGTM, nice cleanup 👍🏼

@pettinarip pettinarip merged commit 2ce32ca into ethereum:dev Mar 11, 2024
10 checks passed
@TylerAPfledderer TylerAPfledderer deleted the refactor/remove-old-select branch March 11, 2024 12:13
This was referenced Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling 🔧 Changes related to tooling of the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants