feat: highlight your reactions on notes

This commit is contained in:
Alejandro Gomez 2023-01-06 17:04:04 +01:00
parent 4680397e1a
commit 1c6176a397
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
1 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,8 @@ export default function Note(props) {
const login = useSelector(s => s.login.publicKey);
const ev = dataEvent ?? Event.FromObject(data);
const isMine = ev.PubKey === login;
const liked = reactions?.find(({ PubKey, Content }) => Content === "+" || Content === "🤙" && PubKey === login)
const disliked = reactions?.find(({ PubKey, Content }) => Content === "+" && PubKey === login)
const options = {
showHeader: true,
@ -123,11 +125,11 @@ export default function Note(props) {
<FontAwesomeIcon icon={faReply} />
</span>
<span className="pill" onClick={() => like()}>
<FontAwesomeIcon icon={faHeart} /> &nbsp;
<FontAwesomeIcon color={liked ? "red" : "currentColor"} icon={faHeart} /> &nbsp;
{likes}
</span>
<span className="pill" onClick={() => dislike()}>
<FontAwesomeIcon icon={faThumbsDown} /> &nbsp;
<FontAwesomeIcon color={disliked ? "orange" : "currentColor"} icon={faThumbsDown} /> &nbsp;
{dislikes}
</span>
<span className="pill" onClick={() => console.debug(ev)}>