-
Notifications
You must be signed in to change notification settings - Fork 538
[Dashboard] migrate solidity inputs to shadcn #7148
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
[Dashboard] migrate solidity inputs to shadcn #7148
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
## Walkthrough
The Solidity input components for booleans, bytes, integers, and strings were refactored to replace Chakra UI and `tw-components` elements with custom UI components and Tailwind CSS classes. The changes focus on layout, styling, and component imports, without altering the functional logic or exported interfaces of the components.
## Changes
| File(s) | Change Summary |
|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| `.../solidity-inputs/bool-input.tsx` | Replaced Chakra UI `ButtonGroup` and `tw-components` `Button` with custom Button and Tailwind CSS styling. |
| `.../solidity-inputs/bytes-input.tsx` | Changed `Input` import from Chakra UI to local custom UI input component. |
| `.../solidity-inputs/int-input.tsx` | Replaced Chakra UI `InputGroup`/`InputRightElement` with divs and Tailwind; added logic for conditional padding. |
| `.../solidity-inputs/string-input.tsx` | Replaced Chakra UI layout components with divs and Tailwind; adjusted input and upload button styling. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant SolidityInputComponent
participant CustomUIComponent
User->>SolidityInputComponent: Interacts with input (bool, int, string, bytes)
SolidityInputComponent->>CustomUIComponent: Renders input/button using custom UI
CustomUIComponent-->>SolidityInputComponent: Handles events (onChange, onClick)
SolidityInputComponent-->>User: Updates value and UI accordingly Suggested labels
Suggested reviewers
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7148 +/- ##
=======================================
Coverage 55.68% 55.68%
=======================================
Files 904 904
Lines 58324 58324
Branches 4113 4113
=======================================
Hits 32476 32476
Misses 25743 25743
Partials 105 105
🚀 New features to boost your workflow:
|
There was a problem hiding this 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
🔭 Outside diff range comments (1)
apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx (1)
15-26
: 🛠️ Refactor suggestionValidation logic runs but errors aren’t surfaced in the UI
You callform.setError
andform.clearErrors
, but the component never displays any error message or invalid styling. To give users feedback:
- Wrap the input in a
<FormControl>
(or equivalent) and pass anisInvalid
flag.- Render the error text below the input (e.g. via
<FormErrorMessage>
or a styled<p>
).This is critical so that users know why their input is invalid.
🧹 Nitpick comments (3)
apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx (2)
10-13
: Streamline prop filtering via types instead of runtime destructuring
Right now you destructure outsize
andname
at runtime and disable the lint rule. Instead, consider updating the prop type to omit those keys (e.g.Omit<SolidityInputWithTypeProps, 'size' | 'name'>
) or alias them in one go:const { name: inputName, size: _size, ...restOfInputProps } = inputProps;This removes the need for
// eslint-disable
and makes the intent clearer.
28-35
: Enhance accessibility with explicit labeling
Relying solely on a placeholder can hamper accessibility. Consider:
- Adding an
id={inputName}
and pairing it with a<label htmlFor={inputName}>…</label>
.- Or, if you don’t want a visible label, use an
aria-label={solidityType}
prop on theInput
.This will help screen‐reader users and improve overall UX.
apps/dashboard/src/contract-ui/components/solidity-inputs/int-input.tsx (1)
50-52
: Consider optimizing the boolean condition for better readability.The condition is functionally correct, but could be more concise:
- const showConversionButton = - formValue.includes(".") || formValue.includes(","); + const showConversionButton = /[.,]/.test(formValue);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/dashboard/src/contract-ui/components/solidity-inputs/bool-input.tsx
(2 hunks)apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx
(1 hunks)apps/dashboard/src/contract-ui/components/solidity-inputs/int-input.tsx
(2 hunks)apps/dashboard/src/contract-ui/components/solidity-inputs/string-input.tsx
(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/contract-ui/components/solidity-inputs/bool-input.tsx (1)
apps/dashboard/src/@/components/ui/button.tsx (1)
Button
(67-67)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx (1)
1-1
: Swapped Chakra’s Input for the localInput
– verify API compatibility
This replaces@chakra-ui/react
’s Input with your custom component. Ensure that the newInput
accepts all the props you’re passing (placeholder
,value
,onChange
, etc.) and that its styling, focus ring, and keyboard behaviour match your design specs.apps/dashboard/src/contract-ui/components/solidity-inputs/bool-input.tsx (1)
1-33
: Clean migration from Chakra UI to shadcn/ui completed successfully.The boolean input component has been migrated effectively with all functionality preserved. The Tailwind CSS styling correctly replicates the button group behavior, and the shadcn/ui Button component integration looks solid.
Key improvements:
- Consistent styling approach with the rest of the dashboard
- Proper button group visual connection using border and radius classes
- Maintained accessibility and interaction patterns
apps/dashboard/src/contract-ui/components/solidity-inputs/int-input.tsx (1)
54-72
: Excellent implementation of conditional layout with proper spacing.The migration successfully replaces Chakra's InputGroup/InputRightElement pattern with:
- Relative positioning container
- Conditional padding to prevent text overlap
- Absolute positioned button with proper alignment
The
cn
utility usage for dynamic className composition is a best practice for this type of conditional styling.apps/dashboard/src/contract-ui/components/solidity-inputs/string-input.tsx (1)
36-74
: Well-executed migration with excellent responsive design handling.The migration from Chakra UI to native elements + Tailwind is implemented thoughtfully:
- Responsive padding (
pr-[90px] md:pr-[160px]
) properly accommodates the upload button- Responsive text visibility (
hidden md:block
) maintains the mobile-first approach- Absolute positioning preserves the original layout behavior
- The
cn
utility ensures proper className mergingThe functionality for IPFS upload and URI handling is correctly preserved, including the trailing slash logic for
updateBatchBaseURI
.
size-limit report 📦
|
Merge activity
|
## Summary - migrate solidity bool, int, bytes, and string inputs to shadcn/ui and tailwind ## Testing - `pnpm biome check --apply apps/dashboard/src/contract-ui/components/solidity-inputs/bool-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/int-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/string-input.tsx` - `pnpm test` *(fails: spawn anvil ENOENT)* <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the UI components in the `solidity-inputs` directory to use a consistent styling approach and improve the layout by replacing certain components with more flexible alternatives. ### Detailed summary - Updated imports from `tw-components` to a local `@/components/ui` for `Button` and `Input`. - Replaced `ButtonGroup` with a `div` for better styling control in `SolidityBoolInput`. - Adjusted button variants from `solid` to `default` for consistency. - Introduced a `showConversionButton` flag in `SolidityIntInput` for conditional rendering. - Changed `InputGroup` to `div` in `SolidityIntInput` and `SolidityStringInput` for layout flexibility. - Used `cn` utility for conditional class names in `Input` components. - Updated button and input placements to enhance responsiveness and 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 - **Style** - Updated input components to use custom UI elements and Tailwind CSS for consistent styling. - Replaced Chakra UI and third-party components with locally defined UI components and native HTML elements. - Improved button and input layouts for better visual consistency across boolean, integer, byte, and string input fields. - **New Features** - Enhanced integer input with conditional display of a conversion button based on input value format. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
11ac5b9
to
6c180b5
Compare
Summary
Testing
pnpm biome check --apply apps/dashboard/src/contract-ui/components/solidity-inputs/bool-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/bytes-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/int-input.tsx apps/dashboard/src/contract-ui/components/solidity-inputs/string-input.tsx
pnpm test
(fails: spawn anvil ENOENT)PR-Codex overview
This PR focuses on refactoring the UI components for Solidity inputs in the dashboard. It updates imports, modifies button structures, and adjusts styles to improve the layout and functionality of the components.
Detailed summary
Button
andInput
components.ButtonGroup
to adiv
with custom styles inSolidityBoolInput
.variant
fromsolid
todefault
inSolidityBoolInput
.showConversionButton
logic inSolidityIntInput
.InputGroup
with adiv
inSolidityIntInput
andSolidityStringInput
.IpfsUploadButton
inSolidityStringInput
.Summary by CodeRabbit
Style
New Features