diff options
author | polwex <polwex@sortug.com> | 2025-09-18 03:48:14 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-09-18 03:48:14 +0700 |
commit | ad7ebd1756956724e0b167d88f924e707401a9aa (patch) | |
tree | 5f29ab38e41224245a93a2a00318b835278ac596 /front/src/components/post/Reactions.tsx | |
parent | 4b016c908dda2019f3bf89e5a3d2eae535e5fbd2 (diff) |
fuck yeah
Diffstat (limited to 'front/src/components/post/Reactions.tsx')
-rw-r--r-- | front/src/components/post/Reactions.tsx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/front/src/components/post/Reactions.tsx b/front/src/components/post/Reactions.tsx index aabab61..ee40d26 100644 --- a/front/src/components/post/Reactions.tsx +++ b/front/src/components/post/Reactions.tsx @@ -110,9 +110,25 @@ export function stringToReact(s: string) { } export function TrillReactModal({ poast }: { poast: Poast }) { - const { api } = useLocalState(); + const { api, addNotification } = useLocalState((s) => ({ + api: s.api, + addNotification: s.addNotification, + })); + const our = api!.airlock.our!; + async function sendReact(s: string) { - return await api!.addReact(poast.host, poast.id, s); + const result = await api!.addReact(poast.host, poast.id, s); + // Only add notification if reacting to someone else's post + if (result && poast.author !== our) { + addNotification({ + type: "react", + from: our, + message: `You reacted to ${poast.author}'s post`, + reaction: s, + postId: poast.id, + }); + } + return result; } return <ReactModal send={sendReact} />; } |