Skip to content

Commit

Permalink
Added explanation to Apps proposal modal and show warning if no singl…
Browse files Browse the repository at this point in the history
…e choice module.
  • Loading branch information
NoahSaso committed Oct 13, 2023
1 parent 12b1e32 commit 1c3242f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
"noNftSelected": "No NFT selected.",
"noNftsSelected": "No NFTs selected.",
"noSingleChoiceProposalModule": "The DAO does not have a single choice proposal module.",
"noSingleChoiceProposalModuleAppsDisabled": "The DAO does not have a recognizable single choice proposal module, so Apps cannot be used at this time.",
"noValidatorFound": "No validator found.",
"noValidatorSelected": "No validator selected.",
"noVestingContractSelected": "No vesting contract selected.",
Expand Down Expand Up @@ -714,6 +715,7 @@
"allAccountsCreated": "All accounts have been created.",
"andNumMore": "and {{count}} more",
"anyone": "Anyone",
"appsProposalDescription": "Add a title and description, and then review the actions generated by the app. Once it all looks good, publish it to the DAO for voting.",
"areTheyMissingQuestion": "Are they missing?",
"authzAuthorizationDescription": "Grant / revoke authorizations that allow other accounts to perform actions on behalf of the DAO.",
"authzExecDescription": "Perform an action on behalf of another account.",
Expand Down
19 changes: 17 additions & 2 deletions packages/stateful/components/dao/tabs/AppsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Loader,
Modal,
AppsTab as StatelessAppsTab,
WarningCard,
useChainContext,
useDaoInfoContext,
} from '@dao-dao/stateless'
Expand Down Expand Up @@ -51,14 +52,23 @@ import { SuspenseLoader } from '../../SuspenseLoader'
import { ConnectedWalletDisplay, DisconnectWallet } from '../../wallet'

export const AppsTab = () => {
const { t } = useTranslation()
const {
name,
imageUrl,
chainId: currentChainId,
coreAddress,
polytoneProxies,
proposalModules,
} = useDaoInfoContext()

// Ensure we have a single choice proposal module to use for proposals.
const singleChoiceProposalModuleExists = proposalModules.some(
({ contractName }) =>
matchProposalModuleAdapter(contractName)?.id ===
DaoProposalSingleAdapterId
)

const [msgs, setMsgs] = useState<CosmosMsgFor_Empty[]>()
const [fullScreen, setFullScreen] = useState(false)

Expand Down Expand Up @@ -225,7 +235,7 @@ export const AppsTab = () => {
}
}, [wallet])

return (
return singleChoiceProposalModuleExists ? (
<>
<StatelessAppsTab
fullScreen={fullScreen}
Expand All @@ -241,6 +251,10 @@ export const AppsTab = () => {
/>
)}
</>
) : (
<WarningCard
content={t('error.noSingleChoiceProposalModuleAppsDisabled')}
/>
)
}

Expand Down Expand Up @@ -477,7 +491,8 @@ const ActionMatcherAndProposer = ({
)
}
header={{
title: t('title.propose'),
title: t('title.createProposal'),
subtitle: t('info.appsProposalDescription'),
}}
onClose={() => setMsgs(undefined)}
visible
Expand Down

0 comments on commit 1c3242f

Please sign in to comment.