diff --git a/src/components/PolicyForm.tsx b/src/components/PolicyForm.tsx index 0b8eda8..f20683c 100644 --- a/src/components/PolicyForm.tsx +++ b/src/components/PolicyForm.tsx @@ -1,4 +1,5 @@ import { PolicyAddressesForm } from '@/components'; +import { ErrorMessage } from '@hookform/error-message'; // import useMC from '@/hooks/useMC'; import { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'; // import useMCStore from '@/stores/MCStore'; @@ -9,11 +10,95 @@ interface PolicyFormValues { }[]; } +export type PolicyFormType = 'ELIO_DAO'; + interface PolicyFormProps { + formType?: PolicyFormType; formName: string; accountId: string; } +const ElioDAOPolicyForm = (props: { disabled?: boolean; formName: string }) => { + const { disabled, formName } = props; + + const formMethods = useForm({ + defaultValues: { + [`${props.formName}`]: [ + { + address: '', + }, + ], + }, + }); + const { + register, + formState: { errors }, + } = formMethods; + return ( + +
+
+

Core

+ + ( +

{message}

+ )} + /> +
+
+

Assets

+ + ( +

{message}

+ )} + /> +
+
+

Votes

+ + ( +

{message}

+ )} + /> +
+
+
+ ); +}; + const PolicyForm = (props: PolicyFormProps) => { // const {attachPolicy, installPolicyContract, initMulticliquePolicy} = useMC(); @@ -48,4 +133,6 @@ const PolicyForm = (props: PolicyFormProps) => { ); }; +PolicyForm.ELIODAO = ElioDAOPolicyForm; + export default PolicyForm; diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 7a144bc..8c17edf 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -10,6 +10,10 @@ import cn from 'classnames'; import { useState } from 'react'; import PolicyForm from './PolicyForm'; +enum PolicyFormAccordion { + ELIO = 'ELIO', +} + const SettingsTabs: Array<{ id: string; label: string }> = [ { id: 'addSigner', @@ -35,7 +39,7 @@ const Settings = (props: { accountId: string }) => { s.handleErrors, s.addTxnNotification, ]); - const [activeAccordion, setActiveAccordion] = useState(null); + const [activeAccordion, setActiveAccordion] = useState(null); // make this global? const [activeSettingsTab, setActiveSettingsTab] = useState( SettingsTabs.at(0)?.id @@ -259,31 +263,25 @@ const Settings = (props: { accountId: string }) => { })}>

Attach Policy

- {Array(1) - .fill(null) - .map((_item, index) => { - return ( - - setActiveAccordion(activeAccordion === index ? null : index) - } - color='base' - expanded={index === activeAccordion}> - -
{'ELIO_DAO'}
- -
- - - -
- ); - })} + + setActiveAccordion( + activeAccordion === PolicyFormAccordion.ELIO + ? null + : PolicyFormAccordion.ELIO + ) + } + color='base' + expanded={PolicyFormAccordion.ELIO === activeAccordion}> + +
{'ELIO_DAO'}
+ +
+ + + +