diff --git a/packages/i18n/locales/en/translation.json b/packages/i18n/locales/en/translation.json index 843bdab6d..5f3fc61e3 100644 --- a/packages/i18n/locales/en/translation.json +++ b/packages/i18n/locales/en/translation.json @@ -32,6 +32,8 @@ "rebalancerLabel": "Rebalancer", "smartContractingDescription": "Create, execute, and manage smart contracts.", "smartContractingLabel": "Smart Contracting", + "subDaosDescription": "Manage SubDAOs or become a SubDAO.", + "subDaosLabel": "SubDAOs", "treasuryDescription_dao": "Manage this DAO's treasury (for example, send payments, stake or swap tokens, etc.).", "treasuryDescription_gov": "Manage the community pool (for example, send payments, stake or swap tokens, etc.).", "treasuryDescription_wallet": "Manage your tokens (for example, send payments, stake or swap tokens, etc.).", @@ -315,6 +317,7 @@ "cameraWithFlash": "Camera with flash", "chains": "Chains", "chart": "Chart", + "check": "Check", "clock": "Clock", "closedLockWithKey": "Closed lock with key", "computerDisk": "Computer disk", @@ -537,7 +540,7 @@ "unsupportedWallet": "Unsupported wallet. Please use a different wallet." }, "form": { - "acceptSubDaoAddressInputLabel": "SubDAO to approve", + "acceptSubDaoAddressInputLabel": "SubDAO to accept", "addAnImage": "Add an image", "address": "Address", "addressInputPlaceholder_any": "Search profile or DAO name or enter an address...", @@ -568,7 +571,7 @@ "automaticallyAddTokensTitle": "Automatically add tokens", "automaticallyAddTokensTooltip": "Should tokens sent to the DAO get added to the treasury?", "baseToken": "Base token", - "becomeSubDaoAdminInputLabel": "DAO to join", + "becomeSubDaoAdminInputLabel": "New parent DAO", "blocksToPauseFor": "Blocks to pause for", "buttonLabel": "Button label", "calls": "Calls", @@ -897,8 +900,8 @@ }, "info": { "abstainVote": "Abstain", - "acceptSubDaoActionDescription": "Approve the ownership transfer request from your SubDAO. Be sure that your SubDAO has already requested to join your DAO through the \"Become SubDAO\" action.\"", - "acceptSubDaoDescription": "Approve SubDAO ownership transfer.", + "acceptSubDaoActionDescription": "Accept a pending SubDAO's ownership transfer request. Be sure that the SubDAO-to-be has already requested to join your DAO through the \"Become SubDAO\" action.", + "acceptSubDaoDescription": "Accept a DAO's request to become a SubDAO.", "acknowledgeServiceFee": "We acknowledge that {{fee}} will be charged from the treasury for registration to the rebalancer.", "acknowledgeServiceFee_none": "We acknowledge that there is no fee to register for the rebalancer.", "actionLibraryDescription": "Choose one or more actions to perform upon execution.", @@ -948,8 +951,8 @@ "available": "available", "availableBalance": "Available balance", "availableHistoryLoaded": "All available history has been loaded.", - "becomeSubDaoActionDescription": "Provide your parent DAO address to request join as its SubDAO. Your parent DAO will need to approve your request to complete the ownership transfer.", - "becomeSubDaoDescription": "Request to join DAO as SubDAO.", + "becomeSubDaoActionDescription": "Provide the address of a DAO to request to become its SubDAO. The DAO will then need to accept your request to complete the ownership transfer and become your parent. Once the transfer is complete, only your new parent DAO can transfer ownership in the future. Keep in mind that your parent DAO will have full authority to execute anything it wants to on behalf of this DAO.", + "becomeSubDaoDescription": "Request to become a SubDAO of a DAO.", "betterNonPfmIbcPathAvailable": "A better path exists that unwinds the IBC token properly, but it requires hops that cannot be performed in a single proposal due to the configuration of one or more of the chains involved. You may safely use the direct path above, though it likely results in an undesirable IBC token on the final chain that will eventually need to be unwound. If you wish to unwind it manually, follow the path below by creating an individual proposal for the first hop, then a second proposal once the first one is passed and executed, and so on.", "betterPfmIbcPathAvailable_one": "A better path exists that unwinds the IBC token properly, but it requires you to have an account on {{chains}}. An account must exist on each intermediary chain in a multi-hop transaction to act as a failsafe in the event of catastrophic failure (unlikely). Either a cross-chain or ICA account works and will be automatically detected once created. You may safely use the direct path above, though it likely results in an undesirable IBC token on the final chain that will eventually need to be unwound.", "betterPfmIbcPathAvailable_other": "A better path exists that unwinds the IBC token properly, but it requires you to have accounts on the following chains: {{chains}}. An account must exist on each intermediary chain in a multi-hop transaction to act as a failsafe in the event of catastrophic failure (unlikely). Either a cross-chain or ICA account works and will be automatically detected once created. You may safely use the direct path above, though it likely results in an undesirable IBC token on the final chain that will eventually need to be unwound.", @@ -1570,7 +1573,7 @@ "title": { "404": "404: Not Found", "500": "500: Error", - "acceptSubDao": "Approve SubDAO join", + "acceptSubDao": "Accept SubDAO Request", "accepted": "Accepted", "acceptingSubmissions": "Accepting submissions", "account": "Account", diff --git a/packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.tsx b/packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.tsx deleted file mode 100644 index a0589b3d9..000000000 --- a/packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { Close } from '@mui/icons-material' -import { ComponentType } from 'react' -import { useFormContext } from 'react-hook-form' -import { useTranslation } from 'react-i18next' - -import { IconButton, 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> -} - -export const AcceptSubDaoComponent: ActionComponent< - AcceptSubDaoDataOptions, - AcceptSubDaoData -> = ({ fieldNamePrefix, errors, isCreating, options: { AddressInput } }) => { - const { t } = useTranslation() - const { - chain: { bech32_prefix: bech32Prefix }, - } = useActionOptions() - - const { register, resetField } = useFormContext() - - const addressFieldName = (fieldNamePrefix + 'address') as 'address' - - return ( - <> -
-

- {t('info.acceptSubDaoActionDescription')} -

- - - -
-
-
- - {isCreating && ( - { - resetField(addressFieldName) - }} - size="sm" - variant="ghost" - /> - )} -
- -
-
-
- - ) -} diff --git a/packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.tsx b/packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.tsx deleted file mode 100644 index ae7089626..000000000 --- a/packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { Close } from '@mui/icons-material' -import { ComponentType } from 'react' -import { useFormContext } from 'react-hook-form' -import { useTranslation } from 'react-i18next' - -import { IconButton, 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 BecomeSubDaoData = { - admin: string -} - -type BecomeSubDaoDataOptions = { - AddressInput: ComponentType> -} - -export const BecomeSubDaoComponent: ActionComponent< - BecomeSubDaoDataOptions, - BecomeSubDaoData -> = ({ fieldNamePrefix, errors, isCreating, options: { AddressInput } }) => { - const { t } = useTranslation() - const { - chain: { bech32_prefix: bech32Prefix }, - } = useActionOptions() - - const { register, resetField } = useFormContext() - - const adminFieldName = (fieldNamePrefix + 'admin') as 'admin' - - return ( - <> -
-

- {t('info.becomeSubDaoActionDescription')} -

- - -
-
-
- - {isCreating && ( - { - resetField(adminFieldName) - }} - size="sm" - variant="ghost" - /> - )} -
- -
-
-
- - ) -} diff --git a/packages/stateful/actions/core/dao_governance/index.ts b/packages/stateful/actions/core/dao_governance/index.ts index b73901ddb..ad16d2932 100644 --- a/packages/stateful/actions/core/dao_governance/index.ts +++ b/packages/stateful/actions/core/dao_governance/index.ts @@ -1,14 +1,11 @@ import { ActionCategoryKey, ActionCategoryMaker } from '@dao-dao/types' -import { makeAcceptSubDaoAction } from './AcceptSubDao' -import { makeBecomeSubDaoAction } from './BecomeSubDao' import { makeCreateCrossChainAccountAction } from './CreateCrossChainAccount' import { makeCreateDaoAction } from './CreateDao' import { makeDaoAdminExecAction } from './DaoAdminExec' import { makeEnableMultipleChoiceAction } from './EnableMultipleChoice' import { makeManageStorageItemsAction } from './ManageStorageItems' import { makeManageSubDaoPauseAction } from './ManageSubDaoPause' -import { makeManageSubDaosAction } from './ManageSubDaos' import { makeManageVetoableDaosAction } from './ManageVetoableDaos' import { makeNeutronOverruleSubDaoProposalAction } from './NeutronOverruleSubDaoProposal' import { makeSetUpApproverAction } from './SetUpApprover' @@ -28,9 +25,6 @@ export const makeDaoGovernanceActionCategory: ActionCategoryMaker = ({ }), actionMakers: [ makeEnableMultipleChoiceAction, - makeManageSubDaosAction, - makeAcceptSubDaoAction, - makeBecomeSubDaoAction, makeManageStorageItemsAction, makeDaoAdminExecAction, makeUpgradeV1ToV2Action, diff --git a/packages/stateful/actions/core/index.ts b/packages/stateful/actions/core/index.ts index 62754a3ba..eff4bd6dc 100644 --- a/packages/stateful/actions/core/index.ts +++ b/packages/stateful/actions/core/index.ts @@ -15,6 +15,7 @@ import { makeDaoAppearanceActionCategory } from './dao_appearance' import { makeDaoGovernanceActionCategory } from './dao_governance' import { makeManageNftsActionCategory } from './nfts' import { makeSmartContractingActionCategory } from './smart_contracting' +import { makeSubDaosActionCategory } from './subdaos' import { makeTreasuryActionCategory } from './treasury' import { makeValenceActionCategory } from './valence' @@ -23,6 +24,7 @@ export const getCoreActionCategoryMakers = (): ActionCategoryMaker[] => [ makeCommonlyUsedCategory, makeTreasuryActionCategory, makeDaoGovernanceActionCategory, + makeSubDaosActionCategory, makeDaoAppearanceActionCategory, makeManageNftsActionCategory, makeSmartContractingActionCategory, diff --git a/packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.stories.tsx b/packages/stateful/actions/core/subdaos/AcceptSubDao/Component.stories.tsx similarity index 88% rename from packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.stories.tsx rename to packages/stateful/actions/core/subdaos/AcceptSubDao/Component.stories.tsx index 62b2c9c76..cc7d8e1dd 100644 --- a/packages/stateful/actions/core/dao_governance/AcceptSubDao/Component.stories.tsx +++ b/packages/stateful/actions/core/subdaos/AcceptSubDao/Component.stories.tsx @@ -7,7 +7,7 @@ import { AcceptSubDaoComponent } from './Component' export default { title: - 'DAO DAO / packages / stateful / actions / core / dao_governance / AcceptSubDao', + 'DAO DAO / packages / stateful / actions / core / subdaos / AcceptSubDao', component: AcceptSubDaoComponent, decorators: [ReactHookFormDecorator], } as ComponentMeta diff --git a/packages/stateful/actions/core/subdaos/AcceptSubDao/Component.tsx b/packages/stateful/actions/core/subdaos/AcceptSubDao/Component.tsx new file mode 100644 index 000000000..a25c543b3 --- /dev/null +++ b/packages/stateful/actions/core/subdaos/AcceptSubDao/Component.tsx @@ -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> +} + +export const AcceptSubDaoComponent: ActionComponent< + AcceptSubDaoDataOptions, + AcceptSubDaoData +> = ({ fieldNamePrefix, errors, isCreating, options: { AddressInput } }) => { + const { t } = useTranslation() + const { + chain: { bech32_prefix: bech32Prefix }, + } = useActionOptions() + + const { register } = useFormContext() + + const addressFieldName = (fieldNamePrefix + 'address') as 'address' + + return ( + <> +
+

{t('info.acceptSubDaoActionDescription')}

+ +
+ + + +
+
+ + ) +} diff --git a/packages/stateful/actions/core/dao_governance/AcceptSubDao/README.md b/packages/stateful/actions/core/subdaos/AcceptSubDao/README.md similarity index 100% rename from packages/stateful/actions/core/dao_governance/AcceptSubDao/README.md rename to packages/stateful/actions/core/subdaos/AcceptSubDao/README.md diff --git a/packages/stateful/actions/core/dao_governance/AcceptSubDao/index.tsx b/packages/stateful/actions/core/subdaos/AcceptSubDao/index.tsx similarity index 87% rename from packages/stateful/actions/core/dao_governance/AcceptSubDao/index.tsx rename to packages/stateful/actions/core/subdaos/AcceptSubDao/index.tsx index fae9610ff..6a452abf8 100644 --- a/packages/stateful/actions/core/dao_governance/AcceptSubDao/index.tsx +++ b/packages/stateful/actions/core/subdaos/AcceptSubDao/index.tsx @@ -1,4 +1,4 @@ -import { FamilyEmoji } from '@dao-dao/stateless' +import { CheckEmoji } from '@dao-dao/stateless' import { ActionComponent, ActionKey, @@ -11,11 +11,9 @@ import { makeWasmMessage } from '@dao-dao/utils' import { AddressInput } from '../../../../components' import { AcceptSubDaoComponent, AcceptSubDaoData } from './Component' -const defaultAcceptSubDaoData = { +const useDefaults: UseDefaults = () => ({ address: '', -} - -const useDefaults: UseDefaults = () => defaultAcceptSubDaoData +}) const useDecodedCosmosMsg: UseDecodedCosmosMsg = ( msg: Record @@ -62,13 +60,12 @@ export const makeAcceptSubDaoAction: ActionMaker = ({ return { key: ActionKey.AcceptSubDao, - Icon: FamilyEmoji, + Icon: CheckEmoji, label: t('title.acceptSubDao'), description: t('info.acceptSubDaoDescription'), Component, useDefaults, useTransformToCosmos, useDecodedCosmosMsg, - notReusable: true, } } diff --git a/packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.stories.tsx b/packages/stateful/actions/core/subdaos/BecomeSubDao/Component.stories.tsx similarity index 88% rename from packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.stories.tsx rename to packages/stateful/actions/core/subdaos/BecomeSubDao/Component.stories.tsx index 831ed5037..282b0cf7c 100644 --- a/packages/stateful/actions/core/dao_governance/BecomeSubDao/Component.stories.tsx +++ b/packages/stateful/actions/core/subdaos/BecomeSubDao/Component.stories.tsx @@ -7,7 +7,7 @@ import { BecomeSubDaoComponent } from './Component' export default { title: - 'DAO DAO / packages / stateful / actions / core / dao_governance / BecomeSubDao', + 'DAO DAO / packages / stateful / actions / core / subdaos / BecomeSubDao', component: BecomeSubDaoComponent, decorators: [ReactHookFormDecorator], } as ComponentMeta diff --git a/packages/stateful/actions/core/subdaos/BecomeSubDao/Component.tsx b/packages/stateful/actions/core/subdaos/BecomeSubDao/Component.tsx new file mode 100644 index 000000000..8c5a09f29 --- /dev/null +++ b/packages/stateful/actions/core/subdaos/BecomeSubDao/Component.tsx @@ -0,0 +1,54 @@ +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 BecomeSubDaoData = { + admin: string +} + +type BecomeSubDaoDataOptions = { + AddressInput: ComponentType> +} + +export const BecomeSubDaoComponent: ActionComponent< + BecomeSubDaoDataOptions, + BecomeSubDaoData +> = ({ fieldNamePrefix, errors, isCreating, options: { AddressInput } }) => { + const { t } = useTranslation() + const { + chain: { bech32_prefix: bech32Prefix }, + } = useActionOptions() + + const { register } = useFormContext() + + const adminFieldName = (fieldNamePrefix + 'admin') as 'admin' + + return ( + <> +
+

{t('info.becomeSubDaoActionDescription')}

+ +
+ + +
+ +
+ + ) +} diff --git a/packages/stateful/actions/core/dao_governance/BecomeSubDao/README.md b/packages/stateful/actions/core/subdaos/BecomeSubDao/README.md similarity index 100% rename from packages/stateful/actions/core/dao_governance/BecomeSubDao/README.md rename to packages/stateful/actions/core/subdaos/BecomeSubDao/README.md diff --git a/packages/stateful/actions/core/dao_governance/BecomeSubDao/index.tsx b/packages/stateful/actions/core/subdaos/BecomeSubDao/index.tsx similarity index 84% rename from packages/stateful/actions/core/dao_governance/BecomeSubDao/index.tsx rename to packages/stateful/actions/core/subdaos/BecomeSubDao/index.tsx index dd7bcf498..47629f383 100644 --- a/packages/stateful/actions/core/dao_governance/BecomeSubDao/index.tsx +++ b/packages/stateful/actions/core/subdaos/BecomeSubDao/index.tsx @@ -1,4 +1,4 @@ -import { FamilyEmoji } from '@dao-dao/stateless' +import { BabyEmoji } from '@dao-dao/stateless' import { ActionComponent, ActionContextType, @@ -12,11 +12,9 @@ import { makeWasmMessage } from '@dao-dao/utils' import { AddressInput } from '../../../../components' import { BecomeSubDaoComponent, BecomeSubDaoData } from './Component' -const defaultBecomeSubDaoData = { +const useDefaults: UseDefaults = () => ({ admin: '', -} - -const useDefaults: UseDefaults = () => defaultBecomeSubDaoData +}) const useDecodedCosmosMsg: UseDecodedCosmosMsg = ( msg: Record @@ -61,7 +59,7 @@ export const makeBecomeSubDaoAction: ActionMaker = ({ return { key: ActionKey.BecomeSubDao, - Icon: FamilyEmoji, + Icon: BabyEmoji, label: t('title.becomeSubDao'), description: t('info.becomeSubDaoDescription'), Component, @@ -71,6 +69,7 @@ export const makeBecomeSubDaoAction: ActionMaker = ({ notReusable: true, // If parent DAO exists, hide this action. hideFromPicker: - context.type === ActionContextType.Dao && context.info.parentDao !== null, + context.type === ActionContextType.Dao && + context.dao.info.parentDao !== null, } } diff --git a/packages/stateful/actions/core/dao_governance/ManageSubDaos/Component.stories.tsx b/packages/stateful/actions/core/subdaos/ManageSubDaos/Component.stories.tsx similarity index 90% rename from packages/stateful/actions/core/dao_governance/ManageSubDaos/Component.stories.tsx rename to packages/stateful/actions/core/subdaos/ManageSubDaos/Component.stories.tsx index b26ec46a4..afe02b4af 100644 --- a/packages/stateful/actions/core/dao_governance/ManageSubDaos/Component.stories.tsx +++ b/packages/stateful/actions/core/subdaos/ManageSubDaos/Component.stories.tsx @@ -8,7 +8,7 @@ import { ManageSubDaosComponent } from './Component' export default { title: - 'DAO DAO / packages / stateful / actions / core / dao_governance / ManageSubDaos', + 'DAO DAO / packages / stateful / actions / core / subdaos / ManageSubDaos', component: ManageSubDaosComponent, decorators: [ReactHookFormDecorator], } as ComponentMeta diff --git a/packages/stateful/actions/core/dao_governance/ManageSubDaos/Component.tsx b/packages/stateful/actions/core/subdaos/ManageSubDaos/Component.tsx similarity index 100% rename from packages/stateful/actions/core/dao_governance/ManageSubDaos/Component.tsx rename to packages/stateful/actions/core/subdaos/ManageSubDaos/Component.tsx diff --git a/packages/stateful/actions/core/dao_governance/ManageSubDaos/README.md b/packages/stateful/actions/core/subdaos/ManageSubDaos/README.md similarity index 100% rename from packages/stateful/actions/core/dao_governance/ManageSubDaos/README.md rename to packages/stateful/actions/core/subdaos/ManageSubDaos/README.md diff --git a/packages/stateful/actions/core/dao_governance/ManageSubDaos/index.tsx b/packages/stateful/actions/core/subdaos/ManageSubDaos/index.tsx similarity index 100% rename from packages/stateful/actions/core/dao_governance/ManageSubDaos/index.tsx rename to packages/stateful/actions/core/subdaos/ManageSubDaos/index.tsx diff --git a/packages/stateful/actions/core/subdaos/index.ts b/packages/stateful/actions/core/subdaos/index.ts new file mode 100644 index 000000000..111d1af22 --- /dev/null +++ b/packages/stateful/actions/core/subdaos/index.ts @@ -0,0 +1,16 @@ +import { ActionCategoryKey, ActionCategoryMaker } from '@dao-dao/types' + +import { makeAcceptSubDaoAction } from './AcceptSubDao' +import { makeBecomeSubDaoAction } from './BecomeSubDao' +import { makeManageSubDaosAction } from './ManageSubDaos' + +export const makeSubDaosActionCategory: ActionCategoryMaker = ({ t }) => ({ + key: ActionCategoryKey.SubDaos, + label: t('actionCategory.subDaosLabel'), + description: t('actionCategory.subDaosDescription'), + actionMakers: [ + makeManageSubDaosAction, + makeBecomeSubDaoAction, + makeAcceptSubDaoAction, + ], +}) diff --git a/packages/stateless/components/emoji.tsx b/packages/stateless/components/emoji.tsx index 229082db6..8114cd067 100644 --- a/packages/stateless/components/emoji.tsx +++ b/packages/stateless/components/emoji.tsx @@ -276,3 +276,7 @@ export const PlayPauseEmoji = () => ( export const PufferfishEmoji = () => ( ) + +export const CheckEmoji = () => ( + +) diff --git a/packages/types/actions.ts b/packages/types/actions.ts index 5acb22026..e98627896 100644 --- a/packages/types/actions.ts +++ b/packages/types/actions.ts @@ -21,6 +21,7 @@ export enum ActionCategoryKey { ChainGovernance = 'chainGovernance', DaoAppearance = 'daoAppearance', DaoGovernance = 'daoGovernance', + SubDaos = 'subDaos', SmartContracting = 'smartContracting', Treasury = 'treasury', Rebalancer = 'rebalancer',