New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reactions #1
Conversation
|
||
type ReactionString = keyof typeof defaultReactions; | ||
type ReactionEmoji = (typeof defaultReactions)[ReactionString]; | ||
type ReactionEntries = [ReactionString, ReactionEmoji][]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did some type-fu here so typescript is happier
} | ||
)} | ||
|
||
{!isFullyReacted ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we've reacted with every available emoji, don't display anything else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this stateful per person in the chat? Like only do I not see it if I've react with all of them but others in the chat would still see them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, this is a per person, per message state.
</button> | ||
); | ||
}) | ||
.filter(Boolean)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this filters out emoji that have already been reacted with
) : ( | ||
<button | ||
className="text-xs text-zinc-500" | ||
onClick={() => setIsReacting((prev) => !prev)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor update here to prevent a possible rare edge case where the committed react state may not represent the actual state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Pat Nakajima <patnakajima@gmail.com>
Pulling in @rygine's work from xmtp/xmtp-js#402, I started adding reactions here. We can delete the copy/pasted content types once they land in the content types repo.
Note: There's still some race conditions here that we'll need to iron out.
Screen.Recording.2023-06-20.at.5.18.19.PM.mov