import clsx from 'clsx'
import { useTranslation } from 'react-i18next'
import { DaoVotingVaultCardProps } from '@dao-dao/types'
import { formatPercentOf100 } from '@dao-dao/utils'
import { TooltipInfoIcon } from '../tooltip'
export const DaoVotingVaultCard = ({
vault: { name, description, info },
vaultVotingPowerPercent,
walletVotingPowerPercent,
}: DaoVotingVaultCardProps) => {
const { t } = useTranslation()
return (
{!info.real && (
)}
{/* Name */}
{NAME_OVERRIDES[name] || name}
{info.real
? t('info.realVotingVaultDescription', {
tokenSymbol: info.bondToken.symbol,
})
: DESCRIPTION_OVERRIDES[name] || description}
{/* Vault voting power */}
{t('info.vaultVotingPower')}
{vaultVotingPowerPercent.loading
? '...'
: formatPercentOf100(vaultVotingPowerPercent.data)}
{/* Wallet's voting power. Hide if undefined because no wallet. */}
{(walletVotingPowerPercent.loading ||
walletVotingPowerPercent.data !== undefined) && (
{t('info.yourVaultVotingPower')}
{walletVotingPowerPercent.loading
? '...'
: formatPercentOf100(walletVotingPowerPercent.data || 0)}
)}
)
}
// Override titles and descriptions for a vault.
const NAME_OVERRIDES: Partial> = {
'CREDITS VAULT': 'Credits Vault',
'Investors Vault': 'Early Backers Vault',
'Timewave Vesting Vault': 'Timewave Vault',
}
const DESCRIPTION_OVERRIDES: Partial> = {
'Lockdrop Vault':
'Voting power generated by the LP tokens locked during the Lockdrop phase of the launch event',
'Investors Vault':
'Voting power generated by locked/vested tokens of early backers.',
'LP Vault':
"Voting power generated by LP tokens from the Liquid Auction that were not locked at the launch event's Lockdrop.",
'Grants SubDAO Vault':
'Voting power generated by the vested grants team allocations.',
'CREDITS VAULT': 'Voting power generated by the vested airdrop tokens.',
'Timewave Vesting Vault':
'Voting power generated by locked/vested tokens from Proposal N-19.',
}
export const DaoVotingVaultCardLoader = () => (
{/* eslint-disable-next-line i18next/no-literal-string */}
Name
{/* eslint-disable-next-line i18next/no-literal-string */}
Description
{/* eslint-disable-next-line i18next/no-literal-string */}
Voting power
{/* eslint-disable-next-line i18next/no-literal-string */}
0%
{/* eslint-disable-next-line i18next/no-literal-string */}
Your voting power
{/* eslint-disable-next-line i18next/no-literal-string */}
0%
)