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

fix: network add form #5405

Merged
merged 1 commit into from
May 22, 2024
Merged

fix: network add form #5405

merged 1 commit into from
May 22, 2024

Conversation

alter-eggo
Copy link
Contributor

@alter-eggo alter-eggo commented May 21, 2024

Try out Leather build 0d0468bExtension build, Test report, Storybook, Chromatic

This pr fixes bitcoin network api selector, regtest network address generation, refactors network form to use our new Select component, also contains small ui fix for select component.

Summary by CodeRabbit

  • New Features

    • Introduced a new Select component for improved network selection.
  • Enhancements

    • Updated the useAddNetwork function to include bitcoinApi field for better network configuration.
  • UI Improvements

    • Enhanced the Item component within the Select for a more consistent styling experience.

Copy link

coderabbitai bot commented May 21, 2024

Walkthrough

The recent updates aim to enhance the network selection functionality within the application. A new Select component replaces the custom select component in add-network-form.tsx. The useAddNetwork hook now includes support for bitcoinApi, streamlining network configuration. select.tsx incorporates styled components, improving UI consistency.

Changes

File Path Change Summary
src/app/features/add-network/add-network-form.tsx Replaced custom select component with new Select component and updated network selection handling.
src/app/features/add-network/use-add-network.tsx Added bitcoinApi to form values, updated onSubmit function to include bitcoinApi.
src/app/ui/components/select/select.tsx Introduced styled from 'leather-styles/jsx' and wrapped RadixSelect.Item in a styled div.

🐇
In code we trust, with bits and bytes,
We weave new paths, set fresh sights.
A network's form, a select anew,
Bitcoin's modes, a clearer view.
Styled with care, in leather's glow,
Our app evolves, onward we go.
🚀


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

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

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9b77421 and c4f645e.
Files selected for processing (3)
  • src/app/features/add-network/add-network-form.tsx (4 hunks)
  • src/app/features/add-network/use-add-network.tsx (1 hunks)
  • src/app/ui/components/select/select.tsx (2 hunks)
Additional comments not posted (6)
src/app/ui/components/select/select.tsx (2)

5-5: The addition of the styled import aligns with the usage in the Item component. Good to see consistent use of styling across components.


80-82: Refactoring the Item component to use a styled div enhances its styling flexibility. This is a good use of the styled-components library to maintain styling consistency and modularity.

src/app/features/add-network/use-add-network.tsx (2)

30-30: The addition of the bitcoinApi field to AddNetworkFormValues and its initialization in initialFormValues are well-implemented. This change supports the new functionality for handling different Bitcoin network APIs.

Also applies to: 38-38


53-53: The refactoring of the onSubmit function to destructure and use the bitcoinApi field simplifies the submission logic and enhances readability. This is a positive change for maintaining clean and manageable code.

src/app/features/add-network/add-network-form.tsx (2)

8-8: The integration of the new Select component and its configuration, including the use of SelectItemLayout and icons, is well-executed. This change enhances the form's usability and aligns with the PR's objectives to improve the network selection UI.

Also applies to: 9-9, 87-121


Line range hint 52-70: The dynamic handling of bitcoinApi values in the useEffect hook to set appropriate URLs based on the selected network is a crucial enhancement. This implementation ensures that the form behaves correctly with the new network API functionality.

@alter-eggo alter-eggo force-pushed the fix/regtest-address branch from c4f645e to e2a71e2 Compare May 21, 2024 13:07
@alter-eggo alter-eggo requested review from kyranjamie and fbwoolf May 21, 2024 13:08
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c4f645e and e2a71e2.
Files selected for processing (3)
  • src/app/features/add-network/add-network-form.tsx (4 hunks)
  • src/app/features/add-network/use-add-network.tsx (1 hunks)
  • src/app/ui/components/select/select.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/app/features/add-network/add-network-form.tsx
  • src/app/features/add-network/use-add-network.tsx
  • src/app/ui/components/select/select.tsx

@fbwoolf
Copy link
Contributor

fbwoolf commented May 21, 2024

@alter-eggo is this related to an issue that can be linked here?

@alter-eggo alter-eggo linked an issue May 21, 2024 that may be closed by this pull request
@kyranjamie
Copy link
Collaborator

kyranjamie commented May 21, 2024

@alter-eggo does this fix the issue where Regtest addresses aren't generated with the correct prefix?

@alter-eggo
Copy link
Contributor Author

@kyranjamie yes, btc address starts from bcrt1
Screenshot 2024-05-21 at 18 02 12

Copy link
Collaborator

@kyranjamie kyranjamie left a comment

Choose a reason for hiding this comment

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

Naming comment, otherwise 👍🏼

src/app/features/add-network/use-add-network.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@fbwoolf fbwoolf left a comment

Choose a reason for hiding this comment

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

Good to see the Select component being used. 👍

@alter-eggo alter-eggo force-pushed the fix/regtest-address branch from e2a71e2 to 0d0468b Compare May 21, 2024 14:09
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e2a71e2 and 0d0468b.
Files selected for processing (3)
  • src/app/features/add-network/add-network-form.tsx (4 hunks)
  • src/app/features/add-network/use-add-network.tsx (3 hunks)
  • src/app/ui/components/select/select.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/app/features/add-network/add-network-form.tsx
  • src/app/features/add-network/use-add-network.tsx
  • src/app/ui/components/select/select.tsx

@alter-eggo alter-eggo added this pull request to the merge queue May 22, 2024
Merged via the queue into dev with commit 0c6c4d1 May 22, 2024
28 checks passed
@alter-eggo alter-eggo deleted the fix/regtest-address branch May 22, 2024 06:12
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.

Fix regtest addresses
3 participants