Skip to content

Commit

Permalink
Remove unused stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Feb 13, 2025
1 parent d802df7 commit c6907fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
6 changes: 1 addition & 5 deletions components/groups/modals/voteDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ function VoteDetailsModal({
'vote-details-modal'
);
} catch (error) {
console.error('Failed to vote: ', error);
setIsSigning(false);

Check warning on line 300 in components/groups/modals/voteDetailsModal.tsx

View check run for this annotation

Codecov / codecov/patch

components/groups/modals/voteDetailsModal.tsx#L276-L300

Added lines #L276 - L300 were not covered by tests
console.error('Failed to vote: ', error);
}
};

Expand Down Expand Up @@ -347,10 +347,6 @@ function VoteDetailsModal({
}
};

const executeVote = async () => {
setIsSigning(true);
};

const optionToVote = (option: string) => {
switch (option) {
case 'VOTE_OPTION_YES':
Expand Down
32 changes: 0 additions & 32 deletions components/groups/modals/voteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,8 @@ function VotingPopup({
const { estimateFee } = useFeeEstimation(env.chain);
const { tx, isSigning, setIsSigning } = useTx(env.chain);
const { address } = useChain(env.chain);
const [error, setError] = useState<string | null>(null);

const { vote } = cosmos.group.v1.MessageComposer.withTypeUrl;

const handleVote = async (option: number) => {
const msg = vote({
proposalId: proposal.id,
voter: address ?? '',
option: option,
metadata: '',
exec: 0,
});

const fee = await estimateFee(address ?? '', [msg]);
try {
await tx(
[msg],
{
fee,
onSuccess: () => {
closeModal();
setIsSigning(false);
},
},
'votingPrompt'
);
} catch (error) {
console.error('Failed to vote: ', error);
setError('Failed to cast vote. Please try again.');
setIsSigning(false);
}
};

const closeModal = (vote?: number) => {

Check warning on line 26 in components/groups/modals/voteModal.tsx

View check run for this annotation

Codecov / codecov/patch

components/groups/modals/voteModal.tsx#L26

Added line #L26 was not covered by tests
onClose(vote);
};
Expand All @@ -73,7 +42,6 @@ function VotingPopup({
<h3 className="font-bold text-lg mb-4">
Cast Your Vote for Proposal #{proposal.id.toString()}
</h3>
{error && <div className="alert alert-error mb-4">{error}</div>}
<div className="grid w-full grid-cols-2 gap-4">
{isSigning ? (
<div className="loading loading-dots loading-sm" />
Expand Down

0 comments on commit c6907fd

Please sign in to comment.