-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
153 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.tsx
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/stateful/actions/core/subdaos/AcceptSubDao/Component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { ComponentType } from 'react' | ||
import { useFormContext } from 'react-hook-form' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
import { InputErrorMessage, InputLabel } from '@dao-dao/stateless' | ||
import { AddressInputProps } from '@dao-dao/types' | ||
import { ActionComponent } from '@dao-dao/types/actions' | ||
import { makeValidateAddress, validateRequired } from '@dao-dao/utils' | ||
|
||
import { useActionOptions } from '../../../react' | ||
|
||
export type AcceptSubDaoData = { | ||
address: string | ||
} | ||
|
||
type AcceptSubDaoDataOptions = { | ||
AddressInput: ComponentType<AddressInputProps<AcceptSubDaoData>> | ||
} | ||
|
||
export const AcceptSubDaoComponent: ActionComponent< | ||
AcceptSubDaoDataOptions, | ||
AcceptSubDaoData | ||
> = ({ fieldNamePrefix, errors, isCreating, options: { AddressInput } }) => { | ||
const { t } = useTranslation() | ||
const { | ||
chain: { bech32_prefix: bech32Prefix }, | ||
} = useActionOptions() | ||
|
||
const { register } = useFormContext<AcceptSubDaoData>() | ||
|
||
const addressFieldName = (fieldNamePrefix + 'address') as 'address' | ||
|
||
return ( | ||
<> | ||
<div className="space-y-3"> | ||
<p className="max-w-prose">{t('info.acceptSubDaoActionDescription')}</p> | ||
|
||
<div className="space-y-1"> | ||
<InputLabel name={t('form.acceptSubDaoAddressInputLabel')} /> | ||
<AddressInput | ||
disabled={!isCreating} | ||
error={errors?.address} | ||
fieldName={addressFieldName} | ||
register={register} | ||
type="contract" | ||
validation={[validateRequired, makeValidateAddress(bech32Prefix)]} | ||
/> | ||
<InputErrorMessage error={errors?.address} /> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.