From f9b609e7a2e2820f7f2742e905e8b6a64036b4cb Mon Sep 17 00:00:00 2001 From: jnsdls Date: Fri, 23 May 2025 18:00:04 +0000 Subject: [PATCH] [Dashboard] replace Chakra fieldset with shadcn (#7143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 `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}` ## 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. --- .../networks-fieldset.tsx | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git 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 index 9a6e9f567d1..88ae10af080 100644 --- 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 @@ -1,5 +1,12 @@ import { MultiNetworkSelector } from "@/components/blocks/NetworkSelectors"; -import { Flex, FormControl, Select } from "@chakra-ui/react"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { cn } from "@/lib/utils"; import { useFormContext } from "react-hook-form"; import type { ThirdwebClient } from "thirdweb"; import { Heading, Text } from "tw-components"; @@ -16,30 +23,32 @@ export const NetworksFieldset: React.FC = ({ const form = useFormContext(); return ( - - +
+
Networks that your contract can be deployed to - - +
+
- +
{!form.watch("networksForDeployment.allNetworks") && ( - +
Please select the networks you want to enable: = ({ form.watch("networksForDeployment.networksEnabled") || [] } /> - +
)} -
+
); };