import { Button } from "@/src/components/ui/button"; import { HoverCard, HoverCardContent, HoverCardTrigger, } from "@/src/components/ui/hover-card"; import { cn } from "@/src/utils/tailwind"; import { api } from "@/src/utils/api"; interface ReactionBarProps { projectId: string; commentId: string; onReactionToggle: (emoji: string, hasReacted: boolean) => void; } export function ReactionBar({ projectId, commentId, onReactionToggle, }: ReactionBarProps) { const { data: reactions } = api.commentReactions.listForComment.useQuery({ projectId, commentId, }); if (!reactions || reactions.length === 0) { return null; } return (
{reactions.map((reaction) => { const button = ( ); // Only show hover card with user details if user has permission if (!reaction.users) { return
{button}
; } return ( {button}
{reaction.users.map((user) => (
{user.name || "Unknown user"}
))}
); })}
); }