Skip to content

Commit

Permalink
fix old proposals (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
abrzezinski94 authored Aug 13, 2023
1 parent 837529c commit f539d0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
14 changes: 11 additions & 3 deletions components/VotePanel/VotePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,29 @@ const VotePanel = () => {
proposal.account.state !== ProposalState.Draft &&
!isVoteCast

const isMulti = proposal?.account.voteType !== VoteType.SINGLE_CHOICE;
const isMulti = proposal?.account.voteType !== VoteType.SINGLE_CHOICE

return (
<>
{didNotVote && (
<div className="bg-bkg-2 p-4 md:p-6 rounded-lg flex flex-col items-center justify-center">
<h3 className="text-center mb-0">{isMulti ? "You did not vote on this proposal" : "You did not vote electorally"}</h3>
<h3 className="text-center mb-0">
{isMulti
? 'You did not vote on this proposal'
: 'You did not vote electorally'}
</h3>
<Tooltip content="You did not vote on this proposal">
<BanIcon className="h-[34px] w-[34px] fill-white/50 mt-2" />
</Tooltip>
</div>
)}
{/* START: Note that these components control for themselves whether they are displayed and may not be visible */}
<YouVoted quorum="electoral" />
{proposal && isMulti ? <CastMultiVoteButtons proposal={proposal.account} /> : <CastVoteButtons /> }
{proposal && isMulti && proposal.account.options ? (
<CastMultiVoteButtons proposal={proposal.account} />
) : (
<CastVoteButtons />
)}
<YouVoted quorum="veto" />
{!isMulti && <VetoButtons />}
{/* END */}
Expand Down
13 changes: 8 additions & 5 deletions pages/dao/[symbol]/proposal/[pk]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Proposal = () => {
const governance = useProposalGovernanceQuery().data?.result
const descriptionLink = proposal?.account.descriptionLink
const allowDiscussion = realmInfo?.allowDiscussion ?? true
const isMulti = proposal?.account.voteType !== VoteType.SINGLE_CHOICE;
const isMulti = proposal?.account.voteType !== VoteType.SINGLE_CHOICE

const [description, setDescription] = useState('')
const voteData = useProposalVotes(proposal?.account)
Expand Down Expand Up @@ -176,11 +176,14 @@ const Proposal = () => {
</div>
)}

{isMulti ?
<MultiChoiceVotes proposal={proposal.account} limit={proposal.account.options.length}/>
:
{isMulti && proposal.account.options ? (
<MultiChoiceVotes
proposal={proposal.account}
limit={proposal.account.options.length}
/>
) : (
<VoteResults proposal={proposal.account} />
}
)}
{proposal && (
<div className="flex justify-end mt-4">
<Link
Expand Down

1 comment on commit f539d0a

@vercel
Copy link

@vercel vercel bot commented on f539d0a Aug 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

governance-ui – ./

governance-ui-solana-labs.vercel.app
app.realms.today
governance-ui-git-main-solana-labs.vercel.app

Please sign in to comment.