diff --git a/components/GovernancePower/GovernancePowerCard.tsx b/components/GovernancePower/GovernancePowerCard.tsx
index 18f94cd461..f5d54b0d7f 100644
--- a/components/GovernancePower/GovernancePowerCard.tsx
+++ b/components/GovernancePower/GovernancePowerCard.tsx
@@ -1,7 +1,9 @@
import { ChevronRightIcon } from '@heroicons/react/solid'
import { useGovernancePowerAsync } from '@hooks/queries/governancePower'
+import { useRealmConfigQuery } from '@hooks/queries/realmConfig'
import useQueryContext from '@hooks/useQueryContext'
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
+import { GoverningTokenType } from '@solana/spl-governance'
import Link from 'next/link'
import { useRouter } from 'next/router'
import GovernancePowerForRole from './GovernancePowerForRole'
@@ -42,6 +44,8 @@ const GovernancePowerCard = () => {
communityPower.result.isZero() &&
councilPower.result.isZero()
+ const realmConfig = useRealmConfigQuery().data?.result
+
return (
@@ -60,8 +64,20 @@ const GovernancePowerCard = () => {
) : (
-
-
+ {realmConfig?.account.communityTokenConfig.tokenType ===
+ GoverningTokenType.Dormant ? null : (
+
+ )}
+ {realmConfig?.account.councilTokenConfig.tokenType ===
+ GoverningTokenType.Dormant ? null : (
+
+ )}
)}
diff --git a/components/GovernancePower/GovernancePowerForRole.tsx b/components/GovernancePower/GovernancePowerForRole.tsx
index 4d3c18700e..188b22f64b 100644
--- a/components/GovernancePower/GovernancePowerForRole.tsx
+++ b/components/GovernancePower/GovernancePowerForRole.tsx
@@ -1,5 +1,3 @@
-import classNames from 'classnames'
-
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
import { useAsync } from 'react-async-hook'
import { determineVotingPowerType } from '@hooks/queries/governancePower'
@@ -15,6 +13,7 @@ export default function GovernancePowerForRole({
...props
}: {
role: 'community' | 'council'
+ hideIfZero?: boolean
className?: string
}) {
const { connection } = useConnection()
@@ -30,17 +29,17 @@ export default function GovernancePowerForRole({
return determineVotingPowerType(connection, realmPk, role)
}, [connection, realmPk, role])
- if (connected && kind === undefined) {
+ if (connected && kind === undefined && !props.hideIfZero) {
return (
)
}
return (
-
+ <>
{role === 'community' ? (
kind === 'vanilla' ? (
-
+
) : kind === 'VSR' ? (
) : kind === 'NFT' ? (
@@ -49,8 +48,8 @@ export default function GovernancePowerForRole({
) : null
) : kind === 'vanilla' ? (
-
+
) : null}
-
+ >
)
}
diff --git a/components/GovernancePower/Vanilla/VanillaVotingPower.tsx b/components/GovernancePower/Vanilla/VanillaVotingPower.tsx
index 9e804c4d3c..0a4b041d99 100644
--- a/components/GovernancePower/Vanilla/VanillaVotingPower.tsx
+++ b/components/GovernancePower/Vanilla/VanillaVotingPower.tsx
@@ -1,6 +1,5 @@
import { BigNumber } from 'bignumber.js'
import { useMemo } from 'react'
-import classNames from 'classnames'
import useRealm from '@hooks/useRealm'
@@ -20,15 +19,24 @@ import { getMintMetadata } from '@components/instructions/programs/splToken'
import VotingPowerPct from '@components/ProposalVotingPower/VotingPowerPct'
import { useSelectedDelegatorStore } from 'stores/useSelectedDelegatorStore'
import { abbreviateAddress } from '@utils/formatting'
+import clsx from 'clsx'
+import { useRealmConfigQuery } from '@hooks/queries/realmConfig'
+import { GoverningTokenType } from '@solana/spl-governance'
interface Props {
className?: string
role: 'community' | 'council'
+ hideIfZero?: boolean
}
-export default function VanillaVotingPower({ role, ...props }: Props) {
+export default function VanillaVotingPower({
+ role,
+ hideIfZero,
+ ...props
+}: Props) {
const realm = useRealmQuery().data?.result
const { realmInfo } = useRealm()
+ const realmConfig = useRealmConfigQuery().data?.result
const { data: communityTOR } = useAddressQuery_CommunityTokenOwner()
const { data: councilTOR } = useAddressQuery_CouncilTokenOwner()
@@ -100,27 +108,31 @@ export default function VanillaVotingPower({ role, ...props }: Props) {
const tokenName =
getMintMetadata(relevantMint)?.name ?? realm?.account.name ?? ''
- if (!(realm && realmInfo)) {
- return (
-
- )
- }
+ const disabled =
+ role === 'community'
+ ? realmConfig?.account.communityTokenConfig.tokenType ===
+ GoverningTokenType.Dormant
+ : realmConfig?.account.councilTokenConfig.tokenType ===
+ GoverningTokenType.Dormant
return (
-
- {totalAmount === undefined || totalAmount.isZero() ? (
-
- You do not have any voting power in this dao.
-
- ) : (
+
+ {
-
{tokenName} Votes
+
+ {tokenName}
+ {role === 'council' ? ' Council' : ''} Votes
+
- {formattedTotal}
+ {formattedTotal ?? 0}
{selectedDelegator !== undefined ? (
@@ -141,7 +153,7 @@ export default function VanillaVotingPower({ role, ...props }: Props) {
)}
- )}
+ }
)