Skip to content

Commit

Permalink
resolve second round of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehr2github committed Oct 25, 2023
1 parent 3a37e85 commit d73c84a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
23 changes: 21 additions & 2 deletions src/containers/gatingMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ import {useNetwork} from 'context/network';
import {PluginTypes} from 'hooks/usePluginClient';
import WalletIcon from 'public/wallet.svg';
import {Governance, Community} from 'utils/paths';
import {Erc20WrapperTokenDetails} from '@aragon/sdk-client';
import {toDisplayEns} from 'utils/library';
import {
Erc20WrapperTokenDetails,
MajorityVotingSettings,
} from '@aragon/sdk-client';
import {formatUnits, toDisplayEns} from 'utils/library';
import {useExistingToken} from 'hooks/useExistingToken';
import {htmlIn} from 'utils/htmlIn';
import {useGovTokensWrapping} from 'context/govTokensWrapping';
import {useDaoDetailsQuery} from 'hooks/useDaoDetails';
import {useDaoToken} from 'hooks/useDaoToken';
import {useVotingSettings} from 'services/aragon-sdk/queries/use-voting-settings';

export const GatingMenu: React.FC = () => {
const {close, isOpen} = useGlobalModalContext('gating');
Expand All @@ -40,6 +44,11 @@ export const GatingMenu: React.FC = () => {
const {data: daoToken} = useDaoToken(plugins?.[0].instanceAddress);
const {isDAOTokenWrapped} = useExistingToken({daoDetails, daoToken});

const {data: votingSettings} = useVotingSettings({
pluginAddress: plugins?.[0].instanceAddress,
pluginType: plugins?.[0].id as PluginTypes,
});

const handleCloseMenu = () => {
const governancePath = generatePath(Governance, {network, dao: daoName});
navigate(governancePath);
Expand All @@ -61,6 +70,13 @@ export const GatingMenu: React.FC = () => {
(daoToken as Erc20WrapperTokenDetails | undefined)?.underlyingToken
?.symbol || '';

const minProposalThreshold = Number(
formatUnits(
(votingSettings as MajorityVotingSettings)?.minProposerVotingPower ?? 0,
daoToken?.decimals as number
)
);

return (
<ModalBottomSheetSwitcher isOpen={isOpen} onClose={handleCloseMenu}>
<ModalBody>
Expand All @@ -86,7 +102,10 @@ export const GatingMenu: React.FC = () => {
<WarningTitle>{t('alert.gatingUsers.tokenTitle')}</WarningTitle>
<WarningDescription>
{t('alert.gatingUsers.tokenDescription', {
daoName: daoName,
tokenName: daoToken?.name,
amount: minProposalThreshold,
tokenSymbol: daoToken?.symbol,
})}
</WarningDescription>
</WarningContainer>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/setupVotingForm/tokenVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
} from 'utils/date';
import {DateTimeErrors} from './dateTimeErrors';
import {ToggleCheckList, UtcInstance} from './multisig';
import {ProposalFormData} from 'utils/types';
import {ProposalFormData, SupportedVotingSettings} from 'utils/types';

type Props = {
pluginSettings: VotingSettings;
pluginSettings: SupportedVotingSettings;
};

const MAX_DURATION_MILLS = MAX_DURATION_DAYS * MINS_IN_DAY * 60 * 1000;
Expand Down

0 comments on commit d73c84a

Please sign in to comment.