Skip to content

Commit

Permalink
❀️ > πŸ‘
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Feb 11, 2025
1 parent b4447b5 commit 08159c8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 76 deletions.
33 changes: 15 additions & 18 deletions web/components/comments/comment-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,20 @@ export function LikeAndDislikeComment(props: {
'none'
)
return (
<>
<ReactButton
contentCreatorId={comment.userId}
contentId={comment.id}
user={user}
contentType={'comment'}
size={'xs'}
contentText={richTextToString(comment.content)}
disabled={isBlocked(privateUser, comment.userId)}
trackingLocation={trackingLocation}
iconType={'thumb'}
reactionType={'like'}
userReactedWith={userReactedWith}
onReact={() => setUserReactedWith('like')}
onUnreact={() => setUserReactedWith('none')}
className={'min-w-[60px]'}
/>
</>
<ReactButton
contentCreatorId={comment.userId}
contentId={comment.id}
user={user}
contentType={'comment'}
size={'xs'}
contentText={richTextToString(comment.content)}
disabled={isBlocked(privateUser, comment.userId)}
trackingLocation={trackingLocation}
reactionType={'like'}
userReactedWith={userReactedWith}
onReact={() => setUserReactedWith('like')}
onUnreact={() => setUserReactedWith('none')}
className={'min-w-[60px]'}
/>
)
}
73 changes: 16 additions & 57 deletions web/components/contract/react-button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeartIcon, ThumbDownIcon, ThumbUpIcon } from '@heroicons/react/outline'
import { HeartIcon } from '@heroicons/react/outline'
import clsx from 'clsx'
import { DisplayUser } from 'common/api/user-types'
import { Reaction, ReactionContentTypes, ReactionType } from 'common/reaction'
Expand Down Expand Up @@ -38,7 +38,6 @@ export const ReactButton = memo(function ReactButton(props: {
className?: string
placement?: 'top' | 'bottom'
reactionType?: ReactionType
iconType?: 'heart' | 'thumb'
size?: SizeType
disabled?: boolean
feedReason?: string
Expand All @@ -61,7 +60,6 @@ export const ReactButton = memo(function ReactButton(props: {
placement = 'bottom',
feedReason,
size,
iconType = 'heart',
contractId,
commentId,
heartClassName,
Expand Down Expand Up @@ -149,7 +147,6 @@ export const ReactButton = memo(function ReactButton(props: {

const otherLikes = reacted ? totalReactions - 1 : totalReactions
const showList = otherLikes > 0 && !hideReactList
const thumbIcon = iconType == 'thumb' || reactionType == 'dislike'

return (
<>
Expand Down Expand Up @@ -186,31 +183,13 @@ export const ReactButton = memo(function ReactButton(props: {
>
<Row className={'text-ink-600 items-center gap-0.5'}>
<div className="relative">
{thumbIcon ? (
reactionType == 'dislike' ? (
<ThumbDownIcon
className={clsx(
'stroke-ink-500 h-4 w-4',
reacted && 'stroke-scarlet-500 fill-scarlet-200'
)}
/>
) : (
<ThumbUpIcon
className={clsx(
'stroke-ink-500 h-4 w-4',
reacted && 'fill-teal-200 stroke-teal-500 '
)}
/>
)
) : (
<HeartIcon
className={clsx(
'stroke-ink-500 h-4 w-4',
reacted &&
'fill-scarlet-200 stroke-scarlet-300 dark:stroke-scarlet-600'
)}
/>
)}
<HeartIcon
className={clsx(
'stroke-ink-500 h-4 w-4',
reacted &&
'fill-scarlet-200 stroke-scarlet-300 dark:stroke-scarlet-600'
)}
/>
</div>
{totalReactions > 0 && (
<div className=" text-sm disabled:opacity-50">
Expand All @@ -233,34 +212,14 @@ export const ReactButton = memo(function ReactButton(props: {
>
<Row className={'items-center gap-1.5'}>
<div className="relative">
{thumbIcon ? (
reactionType == 'dislike' ? (
<ThumbDownIcon
className={clsx(
'h-6 w-6',
heartClassName,
reacted && 'fill-scarlet-200 stroke-scarlet-500 '
)}
/>
) : (
<ThumbUpIcon
className={clsx(
'h-6 w-6',
heartClassName,
reacted && 'fill-teal-200 stroke-teal-500 '
)}
/>
)
) : (
<HeartIcon
className={clsx(
'h-6 w-6',
heartClassName,
reacted &&
'fill-scarlet-200 stroke-scarlet-300 dark:stroke-scarlet-600'
)}
/>
)}
<HeartIcon
className={clsx(
'h-6 w-6',
heartClassName,
reacted &&
'fill-scarlet-200 stroke-scarlet-300 dark:stroke-scarlet-600'
)}
/>
</div>
{totalReactions > 0 && (
<div className="my-auto h-5 text-sm disabled:opacity-50">
Expand Down
2 changes: 1 addition & 1 deletion web/components/notifications/notification-types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ function UserLikeNotification(props: {
icon={
<MultipleAvatarIcons
notification={notification}
symbol={sourceType == 'comment_like' ? 'πŸ‘' : 'πŸ’–'}
symbol={'πŸ’–'}
setOpen={setOpen}
/>
}
Expand Down

0 comments on commit 08159c8

Please sign in to comment.