Skip to content

[Dashboard] migrate CurrencySelector to shadcn #7137

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

Merged

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented May 23, 2025

Summary

  • migrate shared CurrencySelector from Chakra UI to shadcn/ui
  • use tailwindcss classes and Radix-based Select

Checklist

  • pnpm biome check apps/dashboard/src/components/shared/CurrencySelector.tsx --apply
  • pnpm test (fails: spawn anvil ENOENT)

PR-Codex overview

This PR focuses on refactoring the CurrencySelector component for better usability and styling by integrating new UI components and improving structure.

Detailed summary

  • Updated CurrencySelectorProps interface to include new props: onChange, className, isDisabled.
  • Changed CurrencySelector from a functional component to a standard function.
  • Replaced Flex components with div and added Tailwind CSS classes for better styling.
  • Updated event handling to use onValueChange for the Select component.
  • Refactored currency selection rendering to utilize new Select components.
  • Improved handling of custom currency input and visibility logic.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Refactor
    • Updated the CurrencySelector component to use custom UI components and Tailwind CSS for styling, replacing Chakra UI elements.
    • Simplified the component's props and adjusted event handling for the new select interface.
    • Maintained existing functionality and behavior while improving consistency with the app's design system.

@jnsdls jnsdls requested review from a team as code owners May 23, 2025 04:18
@jnsdls jnsdls added the codex label May 23, 2025 — with ChatGPT Connector
Copy link

changeset-bot bot commented May 23, 2025

⚠️ No Changeset found

Latest commit: 317211a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 4:59am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 23, 2025 4:59am
login ⬜️ Skipped (Inspect) May 23, 2025 4:59am
thirdweb_playground ⬜️ Skipped (Inspect) May 23, 2025 4:59am
wallet-ui ⬜️ Skipped (Inspect) May 23, 2025 4:59am

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 23, 2025 04:18 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 23, 2025 04:18 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 23, 2025 04:18 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 23, 2025 04:18 Inactive
Copy link
Contributor

graphite-app bot commented May 23, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link

coderabbitai bot commented May 23, 2025

Walkthrough

The CurrencySelector component was refactored to replace Chakra UI elements with custom UI components and Tailwind CSS classes. The component's props interface was simplified, event handling was adapted to the new select API, and styling was updated. The core logic, conditional rendering, and value normalization remain unchanged.

Changes

File(s) Change Summary
apps/dashboard/src/components/shared/CurrencySelector.tsx Refactored component to use custom UI primitives instead of Chakra UI; updated select to a compound custom select with new event handling; simplified and updated props interface; replaced Chakra-based styling with Tailwind CSS classes; preserved core logic and conditional rendering.

Suggested labels

Dashboard


📜 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 4e5af56 and 317211a.

📒 Files selected for processing (1)
  • apps/dashboard/src/components/shared/CurrencySelector.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/components/shared/CurrencySelector.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label May 23, 2025
@jnsdls jnsdls requested a review from MananTank May 23, 2025 04:19
Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.63%. Comparing base (6cd64e7) to head (317211a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7137   +/-   ##
=======================================
  Coverage   55.63%   55.63%           
=======================================
  Files         902      902           
  Lines       58190    58190           
  Branches     4098     4098           
=======================================
  Hits        32373    32373           
  Misses      25712    25712           
  Partials      105      105           
Flag Coverage Δ
packages 55.63% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 (1)
apps/dashboard/src/components/shared/CurrencySelector.tsx (1)

94-95: Type assertion can be improved.

The current type assertion uses a biome-ignore comment to suppress the lint warning, but the code can be improved to be more type-safe.

- onChange({
-   target: { value: editCustomCurrency },
-   // biome-ignore lint/suspicious/noExplicitAny: FIXME
- } as any);
+ onChange({
+   target: { value: editCustomCurrency },
+   currentTarget: { value: editCustomCurrency },
+   preventDefault: () => {},
+   stopPropagation: () => {},
+ } as React.ChangeEvent<HTMLSelectElement>);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0b142 and 4e5af56.

📒 Files selected for processing (1)
  • apps/dashboard/src/components/shared/CurrencySelector.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
apps/dashboard/src/components/shared/CurrencySelector.tsx (9)

1-10: Imports aligned with shadcn/ui migration.

The imports have been appropriately updated to use shadcn/ui components and utilities, replacing the previous Chakra UI imports. The use of the cn utility from @/lib/utils will help with conditional class name merging.


16-27: Props interface simplified and made more explicit.

The CurrencySelectorProps interface has been properly updated to no longer extend SelectProps from Chakra UI, instead explicitly defining the required props. The onChange callback type maintains compatibility with the previous implementation by mimicking a native select event.


29-40: Component declaration updated with new props.

The component has been changed from a React.FC to a named function export, which is better for debugging. The new props (className and isDisabled) are properly destructured and will be used for styling and disabling the component.


107-128: Custom currency UI migrated to Tailwind CSS.

The "add custom currency" UI has been successfully migrated from Chakra UI to use Tailwind CSS classes and shadcn/ui components. The styling maintains the original layout with a left-to-right arrangement of a back button, input field, and save button.


133-139: Container styling updated with Tailwind and conditional classes.

The container has been changed from a Chakra Flex to a div with Tailwind classes. The cn utility is correctly used to conditionally apply margins and merge with the optional className prop.


140-158: Select component implementation updated to shadcn/ui pattern.

The Select component has been properly updated to use the shadcn/ui pattern. The event handling has been migrated from onChange to onValueChange, with a synthetic event created to maintain compatibility with the existing interface.


149-156: Event handling migration preserves backward compatibility.

The event handling has been properly migrated to use shadcn/ui's onValueChange while maintaining backward compatibility by creating a synthetic event that mimics the structure of a native select event.


159-196: Select component UI structure updated to compound pattern.

The Select component has been properly updated to use shadcn/ui's compound component pattern with SelectTrigger, SelectValue, SelectContent, and SelectItem subcomponents. The value normalization logic and conditional rendering of options remain intact.


1-199: Overall migration to shadcn/ui accomplished successfully.

The CurrencySelector component has been successfully migrated from Chakra UI to shadcn/ui while preserving the core functionality. The component still handles custom currencies, default currencies, and payment selector modes as before, with the UI updated to use Tailwind CSS classes and shadcn/ui components.

Copy link
Contributor

github-actions bot commented May 23, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 56.62 KB (0%) 1.2 s (0%) 441 ms (+97.78% 🔺) 1.6 s
thirdweb (cjs) 309.13 KB (0%) 6.2 s (0%) 1.7 s (-4.77% 🔽) 7.8 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 152 ms (+721.09% 🔺) 265 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 110 ms (+2101.21% 🔺) 120 ms
thirdweb/react (minimal + tree-shaking) 19.5 KB (0%) 390 ms (0%) 250 ms (+614.77% 🔺) 640 ms

Copy link
Contributor

graphite-app bot commented May 23, 2025

Merge activity

## Summary
- migrate shared CurrencySelector from Chakra UI to shadcn/ui
- use tailwindcss classes and Radix-based Select

## Checklist
- [x] `pnpm biome check apps/dashboard/src/components/shared/CurrencySelector.tsx --apply`
- [ ] `pnpm test` *(fails: spawn anvil ENOENT)*

<!-- start pr-codex -->

---

## PR-Codex overview
This PR refactors the `CurrencySelector` component to improve its structure and styling. It replaces certain UI elements with a new `Select` component, enhances props for better functionality, and updates the layout for a more modern appearance.

### Detailed summary
- Changed `CurrencySelectorProps` to include new props: `onChange`, `className`, `isDisabled`.
- Refactored the component to use a `Select` from the UI library instead of native HTML elements.
- Updated event handling to utilize `onValueChange` for the `Select`.
- Improved styling and layout for better user experience.
- Replaced `Flex` components with `div` and applied conditional class names for styling.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Updated the CurrencySelector component to use custom UI components and Tailwind CSS for styling, replacing Chakra UI elements.
  - Simplified the component's props and adjusted event handling for the new select interface.
  - Maintained existing functionality and behavior while improving consistency with the app's design system.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the codex/migrate-dashboard-to-schadcn/ui-and-tailwindcss branch from 4e5af56 to 317211a Compare May 23, 2025 04:52
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 23, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 23, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 23, 2025 04:52 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 23, 2025 04:52 Inactive
@graphite-app graphite-app bot merged commit 317211a into main May 23, 2025
24 checks passed
@graphite-app graphite-app bot deleted the codex/migrate-dashboard-to-schadcn/ui-and-tailwindcss branch May 23, 2025 05:00
@vercel vercel bot temporarily deployed to Production – wallet-ui May 23, 2025 05:00 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codex Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants