Skip to content

[Dashboard] replace Chakra fieldset with shadcn #7143

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

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented May 23, 2025

Migrates the NetworksFieldset component from Chakra UI to shadcn/ui and Tailwind.

  • Drop Chakra Flex, FormControl and Select
  • Use shadcn Select primitives with tailwind classes
  • Adjust layout with Tailwind via cn

Fixes #0


PR-Codex overview

This PR focuses on refactoring the NetworksFieldset component in the contract-publish-form to use a new Select component from a UI library, enhancing the styling and structure of the form.

Detailed summary

  • Replaced Flex and FormControl components with div elements and a new Select component.
  • Updated event handling from onChange to onValueChange for the Select.
  • Changed option elements to SelectItem within SelectContent.
  • Adjusted class names for styling consistency.

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

Summary by CodeRabbit

  • Refactor
    • Updated the network selection field to use a custom select component and Tailwind-based layout for a more consistent user interface.
  • Style
    • Improved the visual appearance and spacing of the network selection field.

@jnsdls jnsdls requested review from a team as code owners May 23, 2025 17:40
@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: f9b609e

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 6:10pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 23, 2025 6:10pm
login ⬜️ Skipped (Inspect) May 23, 2025 6:10pm
thirdweb_playground ⬜️ Skipped (Inspect) May 23, 2025 6:10pm
wallet-ui ⬜️ Skipped (Inspect) May 23, 2025 6:10pm

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 23, 2025 17:40 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 23, 2025 17:40 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 23, 2025 17:40 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 23, 2025 17:40 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
Contributor

coderabbitai bot commented May 23, 2025

"""

Walkthrough

The component refactors the network selection UI by replacing Chakra UI and native HTML elements with custom select components from a local UI library and Tailwind CSS for styling. The event handling is updated to use the custom select's API, but the form logic and component signature remain unchanged.

Changes

File(s) Change Summary
apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx Replaces Chakra UI and native select elements with custom select components and Tailwind CSS; updates event handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NetworksFieldset
    participant CustomSelect
    participant FormContext

    User->>NetworksFieldset: Interacts with network select field
    NetworksFieldset->>CustomSelect: Renders select options
    User->>CustomSelect: Selects network option
    CustomSelect-->>NetworksFieldset: onValueChange(selectedNetwork)
    NetworksFieldset->>FormContext: setValue("network", selectedNetwork)
    FormContext-->>NetworksFieldset: Updates form state
Loading

Suggested reviewers

  • MananTank
  • joaquim-verges
    """

📜 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 d996087 and f9b609e.

📒 Files selected for processing (1)
  • apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • 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
Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.62%. Comparing base (916ecf4) to head (f9b609e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7143   +/-   ##
=======================================
  Coverage   55.62%   55.62%           
=======================================
  Files         902      902           
  Lines       58190    58190           
  Branches     4098     4098           
=======================================
  Hits        32369    32369           
  Misses      25716    25716           
  Partials      105      105           
Flag Coverage Δ
packages 55.62% <ø> (ø)
🚀 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
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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx (1)

26-64: Consider adding ARIA attributes for improved accessibility

While migrating from Chakra UI to shadcn/ui, consider enhancing accessibility by adding appropriate ARIA attributes, especially for the select component.

- <div className="flex flex-col gap-2" data-required>
+ <div className="flex flex-col gap-2" data-required aria-required="true">

And for the select component:

- <SelectTrigger className="w-full">
+ <SelectTrigger className="w-full" aria-label="Select deployment networks">
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 916ecf4 and d996087.

📒 Files selected for processing (1)
  • apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx (5)

2-9: Imports aligned with shadcn/ui migration

The additions of shadcn UI select components and the cn utility function properly support the migration from Chakra UI to shadcn/ui with Tailwind CSS.


26-27: Container replacement follows Tailwind best practices

The Chakra Flex components have been properly replaced with semantic HTML elements using Tailwind classes. The cn utility appropriately handles conditional spacing based on the fromStandard prop.


33-48: Select implementation follows shadcn/ui pattern

The shadcn/ui Select component is properly implemented with all necessary sub-components (Trigger, Value, Content, Items). The event handler has been correctly updated from the native onChange to shadcn's onValueChange, maintaining the same form update logic.


49-51: Container structure properly maintained

The div structure properly maintains separation between the select control and the conditional network selector.


62-64: Proper closing tags for container structure

The closing tags are properly placed to maintain the same component structure hierarchy.

Comment on lines +31 to +32
</div>
<div className="flex flex-col gap-2" data-required>
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify form validation behavior

The replacement of Chakra's FormControl with a div that has a data-required attribute may affect form validation behavior.


🏁 Script executed:

#!/bin/bash
# Check if there are custom styles or handlers for data-required attribute
rg "data-required" --type css
rg "data-required" --type ts --type tsx -A 5 -B 5

Length of output: 107


🏁 Script executed:

#!/bin/bash
# Search for CSS targeting [data-required] in CSS/SCSS/SASS files
rg "\[data-required\]" -g '*.{css,scss,sass}' -A5 -B5

# Search for any occurrences of data-required in TypeScript/TSX files
rg "data-required" -g '*.{ts,tsx}' -A5 -B5

Length of output: 1550


Fix required: restore form validation semantics

Replacing Chakra’s FormControl with a plain <div data-required> removes built-in handling of required fields (ARIA attributes, label/error associations, styling). Please update networks-fieldset.tsx to re-introduce proper form control semantics:

• Wrap the select in Chakra’s FormControl isRequired instead of a <div data-required>
• Ensure you import FormControl from @chakra-ui/react
• Alternatively, at minimum add aria-required to the actual input/select component

Suggested diff:

--- a/apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx
+++ b/apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx
@@
-     </div>
-     <div className="flex flex-col gap-2" data-required>
+     </div>
+     <FormControl isRequired className="flex flex-col gap-2">

And at the top of the file:

+ import { FormControl } from "@chakra-ui/react";

This will preserve ARIA semantics and Chakra’s error/required styling.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
apps/dashboard/src/components/contract-components/contract-publish-form/networks-fieldset.tsx
around lines 31 to 32, replace the plain div with data-required attribute by
wrapping the select element inside Chakra UI's FormControl component with the
isRequired prop. Import FormControl from @chakra-ui/react at the top of the
file. This will restore proper form validation semantics, including ARIA
attributes and styling. Alternatively, if not using FormControl, add
aria-required to the select element to maintain accessibility.

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%) 160 ms (+117.1% 🔺) 1.3 s
thirdweb (cjs) 309.13 KB (0%) 6.2 s (0%) 587 ms (+3.72% 🔺) 6.8 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 55 ms (+1016.51% 🔺) 169 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 18 ms (+789.28% 🔺) 28 ms
thirdweb/react (minimal + tree-shaking) 19.5 KB (0%) 390 ms (0%) 58 ms (+368.42% 🔺) 448 ms

Copy link
Contributor

graphite-app bot commented May 23, 2025

Merge activity

Migrates the NetworksFieldset component from Chakra UI to shadcn/ui and Tailwind.

- Drop Chakra Flex, FormControl and Select
- Use shadcn Select primitives with tailwind classes
- Adjust layout with Tailwind via `cn`

Fixes #0

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the `NetworksFieldset` component in `networks-fieldset.tsx` to use a new `Select` component from the UI library, improving styling and functionality while maintaining the same overall behavior.

### Detailed summary
- Replaced `Flex` and `FormControl` components with a new `div` structure and `Select` component.
- Updated the `Select` component to use `SelectTrigger`, `SelectContent`, and `SelectItem`.
- Changed event handlers from `onChange` to `onValueChange` for better state management.
- Maintained layout and functionality with updated 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 network selection field to use a custom select component and Tailwind-based layout for a more consistent user interface.
- **Style**
  - Improved the visual appearance and spacing of the network selection field.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot merged commit f9b609e into main May 23, 2025
22 checks passed
@graphite-app graphite-app bot deleted the codex/migrate-dashboard-component-to-schadcn/ui-and-tailwindcss branch May 23, 2025 18:11
@vercel vercel bot temporarily deployed to Production – docs-v2 May 23, 2025 18:11 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui May 23, 2025 18:11 Inactive
@vercel vercel bot temporarily deployed to Production – login May 23, 2025 18:11 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground May 23, 2025 18:11 Inactive
@graphite-app graphite-app bot force-pushed the codex/migrate-dashboard-component-to-schadcn/ui-and-tailwindcss branch from d996087 to f9b609e Compare May 23, 2025 20:33
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