Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DonFungible committed Dec 15, 2023
1 parent 40653a8 commit a7120a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
18 changes: 9 additions & 9 deletions app/admin/ConfigureLicenseWriteAccordionInputForm.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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<any, any>;
Expand All @@ -41,10 +42,9 @@ function getDefaultValuesFromSchema(
const values: Record<string, any> = {};

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];
Expand Down
15 changes: 7 additions & 8 deletions app/admin/LicenseWriteAccordionInputForm.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';

Expand All @@ -41,10 +41,9 @@ function getDefaultValuesFromSchema(
const values: Record<string, any> = {};

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];
Expand Down

0 comments on commit a7120a8

Please sign in to comment.