From a7120a8d3b3d10fb68876fed178a73769b1fd69f Mon Sep 17 00:00:00 2001 From: Don <100505855+DonFungible@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:24:34 -0500 Subject: [PATCH] cleanup --- ...ConfigureLicenseWriteAccordionInputForm.tsx | 18 +++++++++--------- app/admin/LicenseWriteAccordionInputForm.tsx | 15 +++++++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/admin/ConfigureLicenseWriteAccordionInputForm.tsx b/app/admin/ConfigureLicenseWriteAccordionInputForm.tsx index 2e9dc38..a99e950 100644 --- a/app/admin/ConfigureLicenseWriteAccordionInputForm.tsx +++ b/app/admin/ConfigureLicenseWriteAccordionInputForm.tsx @@ -1,10 +1,15 @@ 'use client'; -import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; + +import { useEffect, useState } from 'react'; +import { ConfigureLicenseRequest } from '@story-protocol/core-sdk'; +import { useAccount, useNetwork } from 'wagmi'; +import { ConnectButton } from '@rainbow-me/rainbowkit'; +import * as z from 'zod'; import { useForm } from 'react-hook-form'; + +import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { zodResolver } from '@hookform/resolvers/zod'; -import * as z from 'zod'; import { Input } from '@/components/ui/input'; -import { useEffect, useState } from 'react'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { Dialog, @@ -16,11 +21,7 @@ import { } from '@/components/ui/dialog'; import { ArrowPathIcon, CheckIcon, ExclamationCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'; import EtherscanLink from '@/utils/EtherscanLink'; -import { useAccount, useNetwork } from 'wagmi'; -// import ConnectWalletButton from '@/components/Navbar/ConnectWalletButton2'; -import { ConnectButton } from '@rainbow-me/rainbowkit'; import { cn } from '@/utils'; -import { ConfigureLicenseRequest } from '@story-protocol/core-sdk'; type InputFormProps = { formSchema: z.ZodObject; @@ -41,10 +42,9 @@ function getDefaultValuesFromSchema( const values: Record = {}; for (const key in shape) { - values[key] = defaultValues[key] || ''; // Use the default value if available, or set an empty string as a fallback + values[key] = defaultValues[key] || ''; } - // Set default values for keys that are in defaultValues but not in the form schema for (const key in defaultValues) { if (!values[key]) { values[key] = defaultValues[key]; diff --git a/app/admin/LicenseWriteAccordionInputForm.tsx b/app/admin/LicenseWriteAccordionInputForm.tsx index baaa459..1896655 100644 --- a/app/admin/LicenseWriteAccordionInputForm.tsx +++ b/app/admin/LicenseWriteAccordionInputForm.tsx @@ -1,10 +1,13 @@ 'use client'; -import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; +import { useEffect, useState } from 'react'; +import * as z from 'zod'; import { useForm } from 'react-hook-form'; +import { useAccount, useNetwork } from 'wagmi'; +import { ConnectButton } from '@rainbow-me/rainbowkit'; + +import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { zodResolver } from '@hookform/resolvers/zod'; -import * as z from 'zod'; import { Input } from '@/components/ui/input'; -import { useEffect, useState } from 'react'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { Dialog, @@ -16,9 +19,6 @@ import { } from '@/components/ui/dialog'; import { ArrowPathIcon, CheckIcon, ExclamationCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'; import EtherscanLink from '@/utils/EtherscanLink'; -import { useAccount, useNetwork } from 'wagmi'; -// import ConnectWalletButton from '@/components/Navbar/ConnectWalletButton2'; -import { ConnectButton } from '@rainbow-me/rainbowkit'; import { cn } from '@/utils'; import { CreateLicenseRequest } from '@story-protocol/core-sdk'; @@ -41,10 +41,9 @@ function getDefaultValuesFromSchema( const values: Record = {}; for (const key in shape) { - values[key] = defaultValues[key] || ''; // Use the default value if available, or set an empty string as a fallback + values[key] = defaultValues[key] || ''; } - // Set default values for keys that are in defaultValues but not in the form schema for (const key in defaultValues) { if (!values[key]) { values[key] = defaultValues[key];