Skip to content

Commit

Permalink
enable approval when wallet not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Oct 27, 2023
1 parent 0b81411 commit 9904536
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/pages/proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -516,19 +516,34 @@ export const Proposal: React.FC = () => {
isTokenVotingSettings(votingSettings) &&
votingSettings.votingMode === VotingMode.VOTE_REPLACEMENT;

const votingDisabled =
let votingDisabled =
(proposal && proposal.status !== ProposalStatus.ACTIVE) ||
(isMultisigPlugin && voted) ||
(isTokenVotingPlugin && voted && canRevote === false) ||
(canVote === false && shouldDisplayDelegationVoteGating === false);

if (!address) votingDisabled = false;

const handleApprovalClick = useCallback(
(tryExecution: boolean) => {
if (proposal?.id) {
if (address == null) {
open('wallet');
statusRef.current.wasNotLoggedIn = true;
} else if (isOnWrongNetwork) {
open('network');
statusRef.current.wasOnWrongNetwork = true;
} else if (canVote && proposal?.id) {
handlePrepareApproval({tryExecution, proposalId: proposal.id});
}
},
[handlePrepareApproval, proposal?.id]
[
address,
canVote,
handlePrepareApproval,
isOnWrongNetwork,
open,
proposal?.id,
]
);

const handleVoteClick = useCallback(() => {
Expand Down

0 comments on commit 9904536

Please sign in to comment.