Skip to content

[Dashboard] replace chakra form with shadcn #7216

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented May 30, 2025

Migrates the OP Credits form to use shadcn/ui primitives and Tailwind.

  • removed Chakra UI usage
  • replaced chakra-react-select with Select and MultiSelect components
  • updated markup to Tailwind classes
  • formatted with Biome

Fixes #0


PR-Codex overview

This PR updates the ApplyForOpCreditsForm component by replacing Chakra UI components with custom UI components, enhancing the layout and structure, and improving accessibility with proper form labels.

Detailed summary

  • Replaced Flex and FormControl from Chakra UI with a custom <form> and <Label>.
  • Updated input fields to use the custom <Input> component.
  • Introduced a new <Select> component for industry selection.
  • Added a <MultiSelect> component for chain selection.
  • Improved layout with additional div wrappers for better organization.
  • Removed FormHelperText in favor of <p> elements for instructions.

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

Summary by CodeRabbit

  • Refactor
    • Updated the form to use custom UI components and Tailwind CSS for layout and styling, replacing Chakra UI elements. The overall form structure and validation remain unchanged.
  • Style
    • Improved visual consistency by aligning form elements with the app’s custom design system.

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

changeset-bot bot commented May 30, 2025

⚠️ No Changeset found

Latest commit: 6d48c88

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

@vercel vercel bot temporarily deployed to Preview – wallet-ui May 30, 2025 00:36 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 30, 2025 00:36 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 30, 2025 00:36 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 30, 2025 00:36 Inactive
Copy link
Contributor

graphite-app bot commented May 30, 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 30, 2025

Walkthrough

The ApplyForOpCreditsForm component was refactored to replace Chakra UI and chakra-react-select components with custom or alternative UI components using Tailwind CSS for styling. The structure, validation logic, and exported interface remain unchanged, but all UI elements now use a different component library and styling approach.

Changes

Files/Paths Change Summary
apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx Replaced Chakra UI and chakra-react-select components with custom UI components and Tailwind CSS; updated form layout, select, multi-select, labels, and helper text accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ApplyForOpCreditsForm
    participant CustomUIComponents

    User->>ApplyForOpCreditsForm: Interacts with form fields (input/select)
    ApplyForOpCreditsForm->>CustomUIComponents: Renders Label, Select, MultiSelect, etc.
    CustomUIComponents-->>ApplyForOpCreditsForm: Handle value changes/events
    ApplyForOpCreditsForm-->>User: Updates form state and UI
Loading

Possibly related PRs

Suggested labels

Dashboard

Suggested reviewers

  • joaquim-verges
  • MananTank

📜 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 7c95211 and 6d48c88.

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

2-2: LGTM! Clean import migration from Chakra UI to shadcn/ui.

The import changes correctly replace Chakra UI components with shadcn/ui equivalents. The new imports include all necessary components for the form migration.

Also applies to: 5-12


82-84: Good migration to semantic HTML with proper styling.

The form container has been properly migrated from Chakra's Flex component to a native HTML <form> element with equivalent Tailwind CSS classes for layout and spacing.

Also applies to: 134-134


135-144: Well-structured form field containers with consistent layout.

The migration from Chakra's FormControl structure to div containers with Label components maintains proper accessibility and visual structure. The Tailwind classes provide equivalent spacing and layout behavior.

Also applies to: 146-149, 151-157, 158-167


154-156: Appropriate helper text styling migration.

The migration from Chakra's FormHelperText to styled <p> tags with text-muted-foreground text-sm classes maintains the same visual appearance and semantic meaning.

Also applies to: 164-166, 242-244


233-233: Consistent styling approach for the MultiSelect component.

The className="w-full" prop on the MultiSelect component maintains consistent width styling with other form inputs.


205-234:

❓ Verification inconclusive

Critical: Verify the chain multi-select data handling migration.

The migration from a single select to a MultiSelect component with semicolon-separated values represents a significant change in data handling. The implementation splits and joins values using semicolons, but this needs verification to ensure:

  1. The backend expects semicolon-separated values for the superchain_chain field
  2. Existing data won't be corrupted by this format change
  3. The form validation still works correctly with the new format

🏁 Script executed:

#!/bin/bash
# Description: Verify how superchain_chain field is handled elsewhere in the codebase
# Expected: Find references to confirm the semicolon-separated format is correct

# Search for superchain_chain field usage
rg -A 5 -B 5 "superchain_chain" --type tsx --type ts

# Search for chain selection in other forms or components
rg -A 5 -B 5 "chain.*select|select.*chain" --type tsx --type ts

Length of output: 174


🏁 Script executed:

#!/bin/bash
# Search for superchain_chain references in TS and TSX files
rg -C5 "superchain_chain" -g "*.ts" -g "*.tsx"

# Search API schemas or JSON configs for superchain_chain
rg -C5 "superchain_chain" -g "*.graphql" -g "*.gql" -g "*.json"

# Search backend/service code for handling of superchain_chain
rg -C5 "superchain_chain" -g "*.js" -g "*.ts"

Length of output: 3612


Verify semicolon-delimited “superchain_chain” format

Please confirm that switching from a single-select to a MultiSelect (storing chains as a ;-separated string) aligns with our API schema, data storage, and validation rules:

• File: apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx (≈ lines 205–234)
– selectedValues:
ts (form.watch("superchain_chain") || "") .split(";") .filter(Boolean)
– onSelectedValuesChange:
ts form.setValue("superchain_chain", values.join(";"))
• Verify that the backend/GraphQL schema or REST contract for superchain_chain indeed expects and correctly parses a semicolon-delimited string.
• Ensure existing records (pre-migration) aren’t corrupted or rejected by this new format.
• Confirm that both client-side and server-side validations handle empty, malformed, or unexpected values as intended.


170-201:

❓ Verification inconclusive

Verify the industry select value mapping logic.

The migration from ChakraSelect to the new Select component looks correct, but please verify that the value mapping for "Payments & Finance (DeFi)" → "DeFi" is intentional and properly handled by the form state.


🏁 Script executed:

#!/bin/bash
# Description: Check if the DeFi value mapping is used elsewhere in the codebase
# Expected: Find other references to this mapping to confirm it's intentional

rg -A 3 -B 3 "Payments.*Finance.*DeFi|DeFi.*Payments.*Finance" --type tsx --type ts

Length of output: 113


🏁 Script executed:

#!/bin/bash
# Search for occurrences of the form field and DeFi mapping across the codebase
rg "superchain_verticals" -n .
rg "DeFi" -n .
rg "Payments & Finance" -n .
rg "verticals" -n .

Length of output: 12439


Verify DeFi mapping in industry selector

Please confirm that the abbreviated value "DeFi" (for the full label "Payments & Finance (DeFi)") is intentional and accepted by your backend or any downstream consumers of the superchain_verticals field. Currently this mapping only appears here:

  • File: apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx
  • Lines: 186–194

If your API or form-processing logic expects the full label, you’ll need to adjust this mapping (or handle both values).

✨ 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 30, 2025
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.63%. Comparing base (3bb1fe0) to head (6d48c88).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7216   +/-   ##
=======================================
  Coverage   55.63%   55.63%           
=======================================
  Files         908      908           
  Lines       58546    58546           
  Branches     4127     4127           
=======================================
  Hits        32572    32572           
  Misses      25868    25868           
  Partials      106      106           
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
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.11 KB (0%) 1.3 s (0%) 347 ms (+53.61% 🔺) 1.6 s
thirdweb (cjs) 345.28 KB (0%) 7 s (0%) 1.6 s (+7.61% 🔺) 8.5 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 61 ms (+342.32% 🔺) 175 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 19 ms (+212.06% 🔺) 30 ms
thirdweb/react (minimal + tree-shaking) 19.52 KB (0%) 391 ms (0%) 112 ms (+271.9% 🔺) 502 ms

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.

1 participant