Skip to content
Snippets Groups Projects
Commit aad30269 authored by xaralis's avatar xaralis
Browse files

feat: only allow thumbs where it makes sense

parent b0778ae3
No related branches found
No related tags found
No related merge requests found
Pipeline #1953 passed
...@@ -8,9 +8,10 @@ const Thumbs = ({ likes, dislikes, myVote, onLike, onDislike, readOnly }) => { ...@@ -8,9 +8,10 @@ const Thumbs = ({ likes, dislikes, myVote, onLike, onDislike, readOnly }) => {
<button <button
className={classNames("flex items-center space-x-1", { className={classNames("flex items-center space-x-1", {
"cursor-pointer": !readOnly, "cursor-pointer": !readOnly,
"cursor-default": readOnly, "cursor-not-allowed": readOnly,
"text-blue-300": myVote === "like", "text-blue-300": myVote === "like",
"text-grey-200 hover:text-blue-300": myVote !== "like", "text-grey-200 ": myVote !== "like",
"hover:text-blue-300": myVote !== "like" && !readOnly,
})} })}
disabled={readOnly} disabled={readOnly}
onClick={onLike} onClick={onLike}
...@@ -21,9 +22,10 @@ const Thumbs = ({ likes, dislikes, myVote, onLike, onDislike, readOnly }) => { ...@@ -21,9 +22,10 @@ const Thumbs = ({ likes, dislikes, myVote, onLike, onDislike, readOnly }) => {
<button <button
className={classNames("flex items-center space-x-1", { className={classNames("flex items-center space-x-1", {
"cursor-pointer": !readOnly, "cursor-pointer": !readOnly,
"cursor-default": readOnly, "cursor-not-allowed": readOnly,
"text-red-600": myVote === "dislike", "text-red-600": myVote === "dislike",
"text-grey-200 hover:text-red-600": myVote !== "dislike", "text-grey-200": myVote !== "dislike",
"hover:text-red-600": myVote !== "dislike" && !readOnly,
})} })}
disabled={readOnly} disabled={readOnly}
onClick={onDislike} onClick={onDislike}
......
...@@ -159,6 +159,9 @@ const Post = ({ ...@@ -159,6 +159,9 @@ const Post = ({
__html: content, __html: content,
}; };
const thumbsEnabled =
canThumb && !archived && (type === "post" || state === "announced");
return ( return (
<div className={wrapperClassName} ref={ref}> <div className={wrapperClassName} ref={ref}>
<img <img
...@@ -196,7 +199,7 @@ const Post = ({ ...@@ -196,7 +199,7 @@ const Post = ({
<Thumbs <Thumbs
likes={ranking.likes} likes={ranking.likes}
dislikes={ranking.dislikes} dislikes={ranking.dislikes}
readOnly={!canThumb} readOnly={!thumbsEnabled}
onLike={onLike} onLike={onLike}
onDislike={onDislike} onDislike={onDislike}
myVote={ranking.myVote} myVote={ranking.myVote}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment