Skip to content

Commit

Permalink
Clean up like button w/ cover images and disable for own puzzles
Browse files Browse the repository at this point in the history
  • Loading branch information
mdirolf committed May 6, 2024
1 parent 6a75338 commit 38665bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/components/Buttons.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@
border-color: var(--default-text);
}

.btn:active {
transform: translateY(1px);
}

.btn:hover {
color: var(--onlink);
text-decoration: none;
background-color: var(--link-hover);
}

.btn:enabled:active {
transform: translateY(1px);
}

.btn:hover:disabled {
color: var(--default-text);
background-color: transparent;
Expand Down
1 change: 0 additions & 1 deletion app/components/Images.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@

.topLine[data-has-cover='true'] {
color: white;
mix-blend-mode: difference;
}
2 changes: 1 addition & 1 deletion app/components/ReactionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function ReactionButton(props: ReactionButtonProps) {
className={styles.btn}
onClick={onClick}
hollow={!isSet}
disabled={!mounted || submitting}
disabled={!mounted || submitting || props.puzzle.authorId === user?.uid}
>
<Emoji kind={props.kind} /> {submitting ? '…' : count > 0 ? count : ''}
</Button>
Expand Down
6 changes: 5 additions & 1 deletion app/lib/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export async function moderateComments(
const likes = puzzle.lk || [];
switch (reaction.k) {
case PuzzleReaction.Like:
if (reaction.s && !likes.includes(reaction.u)) {
if (
reaction.s &&
!likes.includes(reaction.u) &&
puzzle.a !== reaction.u
) {
likes.push(reaction.u);
puzzle.lk = likes;
} else if (!reaction.s && likes.includes(reaction.u)) {
Expand Down

0 comments on commit 38665bf

Please sign in to comment.