Skip to content

Commit

Permalink
remove auto scroll text area on comment section
Browse files Browse the repository at this point in the history
  • Loading branch information
depapp committed May 7, 2024
1 parent 8bac256 commit f3cc99b
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/pages/post/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -270,33 +270,6 @@ export default function Product({ product }) {
date,
} = localProduct ? localProduct : product;

const handleVote = () => {
if (!user) return router.push("/login");

let totalVotes = votes;
let usersHaveVoted = [...hasVoted];

if (hasVoted.includes(user.uid)) {
totalVotes = votes - 1;
usersHaveVoted = usersHaveVoted.filter((uid) => uid !== user.uid);
} else {
totalVotes = votes + 1;
usersHaveVoted = [...usersHaveVoted, user.uid];
}

firebase.db
.collection("products")
.doc(id)
.update({ votes: totalVotes, hasVoted: usersHaveVoted });

setLocalProduct({
...product,
votes: totalVotes,
});

setQueryDB(true);
};

const isCreator = (id) => {
if (creator.id === id) {
return true;
Expand Down Expand Up @@ -385,7 +358,6 @@ export default function Product({ product }) {
</UserIconContainer>
<TextArea
placeholder="tinggalkan komentarmu disini."
height={height}
value={comment}
onChange={handleChange}
/>
Expand Down

0 comments on commit f3cc99b

Please sign in to comment.