Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/web/src/components/pr/pr-diff-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { useGlobalChatOptional } from "@/components/shared/global-chat-provider"
import { MarkdownEditor, type MarkdownEditorRef } from "@/components/shared/markdown-editor";
import type { ReviewThread, CheckStatus } from "@/lib/github";
import { ClientMarkdown } from "@/components/shared/client-markdown";
import { ReactionDisplay, type Reactions } from "@/components/shared/reaction-display";
import { CheckStatusBadge } from "@/components/pr/check-status-badge";
import { useMutationEvents } from "@/components/shared/mutation-event-provider";
import { UserTooltip } from "@/components/shared/user-tooltip";
Expand Down Expand Up @@ -88,6 +89,7 @@ interface ReviewComment {
original_line: number | null;
side: string | null;
created_at: string;
reactions?: Reactions;
}

interface ReviewSummary {
Expand Down Expand Up @@ -3506,6 +3508,22 @@ function InlineCommentDisplay({
) : (
<div className="px-3 py-2 text-sm text-foreground/70">
<ClientMarkdown content={comment.body} />
{owner && repo && (
<div className="pt-1">
<ReactionDisplay
reactions={
comment.reactions ??
{}
}
owner={owner}
repo={repo}
contentType="pullRequestReviewComment"
contentId={
comment.id
}
/>
</div>
)}
</div>
)}
</>
Expand Down
38 changes: 28 additions & 10 deletions apps/web/src/components/shared/reaction-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ export function ReactionDisplay({

const getUsersForReaction = (key: string): ReactionWithId[] => {
if (!reactionUsers) return [];
return reactionUsers.filter((u) => u.content === key);
const seen = new Set<string>();
return reactionUsers.filter((u) => {
if (u.content !== key || seen.has(u.login)) return false;
seen.add(u.login);
return true;
});
};

const currentUserReactions = new Set(
Expand Down Expand Up @@ -425,15 +430,28 @@ export function ReactionDisplay({
content,
);
if (result.success && result.reactionId) {
setReactionUsers((prev) => [
...(prev ?? []),
{
id: result.reactionId!,
login: currentUser.login,
avatar_url: currentUser.avatar_url,
content,
},
]);
setReactionUsers((prev) => {
const existing = prev ?? [];
if (
existing.some(
(u) =>
u.login ===
currentUser.login &&
u.content ===
content,
)
)
return existing;
return [
...existing,
{
id: result.reactionId!,
login: currentUser.login,
avatar_url: currentUser.avatar_url,
content,
},
];
});
} else {
setOptimisticReactions((prev) => ({
...prev,
Expand Down
Loading