-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENG-4]
Ensure Voting Button disappears after voting
#2688
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,19 +32,23 @@ export function AzoriusOrSnapshotProposalAction({ | |
} = useFractal(); | ||
const { t } = useTranslation(); | ||
const { snapshotProposal } = useSnapshotProposal(proposal); | ||
const { canVote } = useVoteContext(); | ||
const { canVote, hasVoted } = useVoteContext(); | ||
|
||
const isActiveProposal = useMemo( | ||
() => proposal.state === FractalProposalState.ACTIVE, | ||
[proposal.state], | ||
); | ||
|
||
const showActionButton = | ||
(snapshotProposal && canVote && isActiveProposal) || | ||
isActiveProposal || | ||
proposal.state === FractalProposalState.EXECUTABLE || | ||
proposal.state === FractalProposalState.TIMELOCKABLE || | ||
proposal.state === FractalProposalState.TIMELOCKED; | ||
const showActionButton = useMemo(() => { | ||
const isSnapshotProposal = snapshotProposal && canVote && isActiveProposal && !hasVoted; | ||
const isAzoriusProposal = canVote && isActiveProposal && !hasVoted; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So yeah - with ERC-721 it's a little more tricky There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably should rely just on |
||
const isOtherProposalStates = | ||
proposal.state === FractalProposalState.EXECUTABLE || | ||
proposal.state === FractalProposalState.TIMELOCKABLE || | ||
proposal.state === FractalProposalState.TIMELOCKED; | ||
|
||
return isSnapshotProposal || isAzoriusProposal || isOtherProposalStates; | ||
}, [snapshotProposal, canVote, hasVoted, isActiveProposal, proposal.state]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lool I see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, probably memoizing would solve that flickering issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll memoize anyway just a good idea in general but I didn't notice any flickering. but don't doubt it |
||
|
||
const label = useMemo(() => { | ||
if (snapshotProposal) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On snapshot proposal you can re-do your vote - that was intentional to keep the button, cause comparing to Azorius / Multisig - you can not re-cast your vote.
Except for ERC-721 - there's a case when your voting power changed during the vote, and then you can vote once more (even for different option!) with the remaining tokens (aka tokens that weren't used during last time you've casted your vote).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? lol Okay gonna need to have to write this all out on what states and what we want it to look like @nicolaus-sherrill