Skip to content

Commit

Permalink
moved actions and cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Jul 17, 2024
1 parent a5f5ba9 commit 431b0e7
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 183 deletions.
17 changes: 10 additions & 7 deletions packages/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.).",
Expand Down Expand Up @@ -315,6 +317,7 @@
"cameraWithFlash": "Camera with flash",
"chains": "Chains",
"chart": "Chart",
"check": "Check",
"clock": "Clock",
"closedLockWithKey": "Closed lock with key",
"computerDisk": "Computer disk",
Expand Down Expand Up @@ -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...",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions packages/stateful/actions/core/dao_governance/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -28,9 +25,6 @@ export const makeDaoGovernanceActionCategory: ActionCategoryMaker = ({
}),
actionMakers: [
makeEnableMultipleChoiceAction,
makeManageSubDaosAction,
makeAcceptSubDaoAction,
makeBecomeSubDaoAction,
makeManageStorageItemsAction,
makeDaoAdminExecAction,
makeUpgradeV1ToV2Action,
Expand Down
2 changes: 2 additions & 0 deletions packages/stateful/actions/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -23,6 +24,7 @@ export const getCoreActionCategoryMakers = (): ActionCategoryMaker[] => [
makeCommonlyUsedCategory,
makeTreasuryActionCategory,
makeDaoGovernanceActionCategory,
makeSubDaosActionCategory,
makeDaoAppearanceActionCategory,
makeManageNftsActionCategory,
makeSmartContractingActionCategory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof AcceptSubDaoComponent>
Expand Down
53 changes: 53 additions & 0 deletions packages/stateful/actions/core/subdaos/AcceptSubDao/Component.tsx
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>
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FamilyEmoji } from '@dao-dao/stateless'
import { CheckEmoji } from '@dao-dao/stateless'
import {
ActionComponent,
ActionKey,
Expand All @@ -11,11 +11,9 @@ import { makeWasmMessage } from '@dao-dao/utils'
import { AddressInput } from '../../../../components'
import { AcceptSubDaoComponent, AcceptSubDaoData } from './Component'

const defaultAcceptSubDaoData = {
const useDefaults: UseDefaults<AcceptSubDaoData> = () => ({
address: '',
}

const useDefaults: UseDefaults<AcceptSubDaoData> = () => defaultAcceptSubDaoData
})

const useDecodedCosmosMsg: UseDecodedCosmosMsg<AcceptSubDaoData> = (
msg: Record<string, any>
Expand Down Expand Up @@ -62,13 +60,12 @@ export const makeAcceptSubDaoAction: ActionMaker<AcceptSubDaoData> = ({

return {
key: ActionKey.AcceptSubDao,
Icon: FamilyEmoji,
Icon: CheckEmoji,
label: t('title.acceptSubDao'),
description: t('info.acceptSubDaoDescription'),
Component,
useDefaults,
useTransformToCosmos,
useDecodedCosmosMsg,
notReusable: true,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof BecomeSubDaoComponent>
Expand Down
Loading

0 comments on commit 431b0e7

Please sign in to comment.