Spaces:
Running
Running
Commit
·
ee69336
1
Parent(s):
be5bb51
fix in the UI too
Browse files
src/app/interface/like-button/generic.tsx
CHANGED
@@ -32,6 +32,8 @@ export function GenericLikeButton({
|
|
32 |
numberOfDislikes?: number
|
33 |
}) {
|
34 |
|
|
|
|
|
35 |
const classNames = cn(
|
36 |
likeButtonClassName,
|
37 |
className,
|
@@ -48,7 +50,7 @@ export function GenericLikeButton({
|
|
48 |
)}
|
49 |
onClick={() => {
|
50 |
try {
|
51 |
-
onLike?.()
|
52 |
} catch (err) {
|
53 |
|
54 |
}}}
|
@@ -66,7 +68,7 @@ export function GenericLikeButton({
|
|
66 |
)}
|
67 |
onClick={() => {
|
68 |
try {
|
69 |
-
onDislike?.()
|
70 |
} catch (err) {
|
71 |
|
72 |
}}}
|
|
|
32 |
numberOfDislikes?: number
|
33 |
}) {
|
34 |
|
35 |
+
const hasAlreadyVoted = isLikedByUser || isDislikedByUser
|
36 |
+
|
37 |
const classNames = cn(
|
38 |
likeButtonClassName,
|
39 |
className,
|
|
|
50 |
)}
|
51 |
onClick={() => {
|
52 |
try {
|
53 |
+
if (!isLikedByUser) onLike?.()
|
54 |
} catch (err) {
|
55 |
|
56 |
}}}
|
|
|
68 |
)}
|
69 |
onClick={() => {
|
70 |
try {
|
71 |
+
if (!isDislikedByUser) onDislike?.()
|
72 |
} catch (err) {
|
73 |
|
74 |
}}}
|