Skip to content

Commit

Permalink
update proposal page vote-button title to Update Vote if user has voted
Browse files Browse the repository at this point in the history
to make it clearer that you can change your vote if you want to
that you can't
  • Loading branch information
datadanne committed Aug 8, 2023
1 parent 0c18dc7 commit ec2548c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions garage/src/pages/Proposal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,20 @@ type ModuleProps = Omit<React.ComponentProps<typeof Box>, "results"> & {

type VoteState = { [key: number]: { weight: number; comment: string } };

const CastVote = ({ proposal, results, refresh, ...props }: ModuleProps) => {
const CastVote = ({
proposal,
results,
votes: castVotes,
refresh,
...props
}: ModuleProps) => {
const toast = useToast();
const { address } = useAccount();

const userHasVoted = !!castVotes.find(
(v) => v.address.toLowerCase() === address?.toLowerCase()
);

const { validator } = useTablelandConnection();
const { votingPower } = useAddressVotingPower(address, proposal.id);

Expand Down Expand Up @@ -280,7 +290,7 @@ const CastVote = ({ proposal, results, refresh, ...props }: ModuleProps) => {
onClick={write}
width="100%"
>
Vote
Update Vote
</Button>
</Box>
</VStack>
Expand Down

0 comments on commit ec2548c

Please sign in to comment.