diff --git a/app/modules/plus-server/usePlusVoting.ts b/app/modules/plus-server/usePlusVoting.ts index 2dbdf8f82..8375c900e 100644 --- a/app/modules/plus-server/usePlusVoting.ts +++ b/app/modules/plus-server/usePlusVoting.ts @@ -18,7 +18,7 @@ export function usePlusVoting(usersForVotingFromServer: UsersForVoting) { const [usersForVoting, setUsersForVoting] = React.useState(); const [votes, setVotes] = React.useState([]); - const vote = React.useCallback( + const addVote = React.useCallback( (type: "upvote" | "downvote") => { setVotes((votes) => { const votedId = usersForVoting?.[votes.length]?.user.id; @@ -53,7 +53,7 @@ export function usePlusVoting(usersForVotingFromServer: UsersForVoting) { setVotes, }); - useVoteWithArrowKeysEffect(vote); + useVoteWithArrowKeysEffect(addVote); const currentUser = usersForVoting?.[votes.length]; @@ -61,9 +61,8 @@ export function usePlusVoting(usersForVotingFromServer: UsersForVoting) { usersForVoting ? [votes.length, usersForVoting.length] : undefined; return { - // xxx: rename one of these -> both similar name but completely different votes, - vote, + addVote, undoLast, currentUser, previous: previousUser({ usersForVoting, votes }), diff --git a/app/routes/plus/voting/index.tsx b/app/routes/plus/voting/index.tsx index e8d37d4e8..5081f1100 100644 --- a/app/routes/plus/voting/index.tsx +++ b/app/routes/plus/voting/index.tsx @@ -182,7 +182,7 @@ const tips = [ function Voting(data: Extract) { const [randomTip] = React.useState(tips[Math.floor(Math.random() * 3)]); - const { currentUser, previous, votes, vote, undoLast, isReady, progress } = + const { currentUser, previous, votes, addVote, undoLast, isReady, progress } = usePlusVoting(data.usersForVoting); if (!isReady) return null; @@ -224,14 +224,14 @@ function Voting(data: Extract) {