Skip to content

Commit

Permalink
fix: use DAO name for vote symbol for uncharted DAOs
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianBor committed Dec 15, 2021
1 parent f0d30da commit 0645f35
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/chat/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ChatMessage } from '../../models/chat/accounts'
import { abbreviateAddress, fmtTokenAmount } from '../../utils/formatting'
import useRealm from '../../hooks/useRealm'
import { MintInfo } from '@solana/spl-token'
import { isPublicKey } from '@tools/core/pubkey'

const Comment = ({
chatMessage,
Expand All @@ -22,7 +23,13 @@ const Comment = ({
proposalMint: MintInfo | undefined
}) => {
const { author, postedAt, body } = chatMessage
const { symbol } = useRealm()
const { realmInfo } = useRealm()

const voteSymbol = !realmInfo
? ''
: isPublicKey(realmInfo.symbol)
? realmInfo.displayName
: realmInfo.symbol

return (
<div className="border-b border-fgd-4 mt-4 pb-4 last:pb-0 last:border-b-0">
Expand Down Expand Up @@ -65,7 +72,7 @@ const Comment = ({
{`${fmtTokenAmount(
voteRecord.getVoteWeight(),
proposalMint?.decimals
).toLocaleString()} ${symbol}`}
).toLocaleString()} ${voteSymbol}`}
</span>
</div>
)}
Expand Down

0 comments on commit 0645f35

Please sign in to comment.