@@ -10,7 +10,6 @@ import useRealm from '@hooks/useRealm'
10
10
import {
11
11
getProposal ,
12
12
GoverningTokenType ,
13
- Proposal ,
14
13
ProposalState ,
15
14
} from '@solana/spl-governance'
16
15
import { getUnrelinquishedVoteRecords } from '@models/api'
@@ -26,14 +25,10 @@ import { chunks } from '@utils/helpers'
26
25
import { getProgramVersionForRealm } from '@models/registry/api'
27
26
import { notify } from '@utils/notifications'
28
27
import { ExclamationIcon } from '@heroicons/react/outline'
29
- import { useEffect , useState } from 'react'
28
+ import { useEffect } from 'react'
30
29
import useVotePluginsClientStore from 'stores/useVotePluginsClientStore'
31
30
import { VSR_PLUGIN_PKS } from '@constants/plugins'
32
- import DelegateTokenBalanceCard from '@components/TokenBalance/DelegateTokenBalanceCard'
33
- import RelinquishVoteCount from '@components/TokenBalance/RelinquishVoteCount'
34
- import SerumGovernanceTokenWrapper from './SerumGovernanceTokenWrapper'
35
- import getNumTokens from '@components/ProposalVotingPower/getNumTokens'
36
- import VotingPowerPct from '@components/ProposalVotingPower/VotingPowerPct'
31
+
37
32
import { useMaxVoteRecord } from '@hooks/useMaxVoteRecord'
38
33
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
39
34
import {
@@ -50,102 +45,6 @@ import asFindable from '@utils/queries/asFindable'
50
45
import VanillaVotingPower from '@components/GovernancePower/Vanilla/VanillaVotingPower'
51
46
import { fetchTokenAccountByPubkey } from '@hooks/queries/tokenAccount'
52
47
import { DepositTokensButton } from '@components/DepositTokensButton'
53
- import { useLegacyVoterWeight } from '@hooks/queries/governancePower'
54
- import {
55
- useRealmCommunityMintInfoQuery ,
56
- useRealmCouncilMintInfoQuery ,
57
- } from '@hooks/queries/mintInfo'
58
-
59
- const TokenBalanceCard = ( {
60
- proposal,
61
- inAccountDetails = false ,
62
- children,
63
- } : {
64
- proposal ?: Option < Proposal >
65
- inAccountDetails ?: boolean
66
- children ?: React . ReactNode
67
- } ) => {
68
- const [ hasGovPower , setHasGovPower ] = useState < boolean > ( false )
69
- const realm = useRealmQuery ( ) . data ?. result
70
- const realmProgramId = realm ?. owner
71
- const mint = useRealmCommunityMintInfoQuery ( ) . data ?. result
72
- const councilMint = useRealmCouncilMintInfoQuery ( ) . data ?. result
73
- const wallet = useWalletOnePointOh ( )
74
- const connected = ! ! wallet ?. connected
75
- const isDepositVisible = (
76
- depositMint : MintInfo | undefined ,
77
- realmMint : PublicKey | undefined
78
- ) =>
79
- depositMint &&
80
- ( ! proposal ||
81
- ( proposal . isSome ( ) &&
82
- proposal . value . governingTokenMint . toBase58 ( ) === realmMint ?. toBase58 ( ) ) )
83
-
84
- const communityDepositVisible =
85
- // If there is no council then community deposit is the only option to show
86
- ! realm ?. account . config . councilMint ||
87
- isDepositVisible ( mint , realm ?. account . communityMint )
88
-
89
- const councilDepositVisible = isDepositVisible (
90
- councilMint ,
91
- realm ?. account . config . councilMint
92
- )
93
- const hasLoaded = mint || councilMint
94
-
95
- return (
96
- < >
97
- { hasLoaded ? (
98
- < div
99
- className = { `${
100
- inAccountDetails ? `flex w-full gap-8 md:gap-12` : `space-y-4`
101
- } `}
102
- >
103
- { ! hasGovPower && ! inAccountDetails && connected && (
104
- < div className = { 'text-xs text-white/50 mt-8' } >
105
- You do not have any governance power in this dao
106
- </ div >
107
- ) }
108
- { ! connected && (
109
- < div className = { 'text-xs text-white/50 mt-8' } >
110
- Connect your wallet to see governance power
111
- </ div >
112
- ) }
113
- { communityDepositVisible && (
114
- < TokenDeposit
115
- mint = { mint }
116
- tokenRole = { GoverningTokenRole . Community }
117
- councilVote = { false }
118
- inAccountDetails = { inAccountDetails }
119
- setHasGovPower = { setHasGovPower }
120
- />
121
- ) }
122
- { councilDepositVisible && (
123
- < TokenDeposit
124
- mint = { councilMint }
125
- tokenRole = { GoverningTokenRole . Council }
126
- councilVote = { true }
127
- inAccountDetails = { inAccountDetails }
128
- setHasGovPower = { setHasGovPower }
129
- />
130
- ) }
131
- < DelegateTokenBalanceCard />
132
- < RelinquishVoteCount />
133
- </ div >
134
- ) : (
135
- < >
136
- < div className = "h-12 mb-4 rounded-lg animate-pulse bg-bkg-3" />
137
- < div className = "h-10 rounded-lg animate-pulse bg-bkg-3" />
138
- </ >
139
- ) }
140
- { /* TODO: Restrict to Serum DAO */ }
141
- { realmProgramId ?. toBase58 ( ) ===
142
- 'G41fmJzd29v7Qmdi8ZyTBBYa98ghh3cwHBTexqCG1PQJ' ? (
143
- < SerumGovernanceTokenWrapper />
144
- ) : null }
145
- { children }
146
- </ >
147
- )
148
- }
149
48
150
49
export const TokenDeposit = ( {
151
50
mint,
0 commit comments