import { useRef, useState } from "react"; import { t } from "@lingui/core/macro"; import { API_URL } from "../config/api.ts"; import { UserListPopover } from "./UserListPopover.tsx"; interface LikeButtonProps { commentId: string; count: number; liked: boolean; disabled?: boolean; onLike: (commentId: string) => void; onUnlike: (commentId: string) => void; } export function LikeButton( { commentId, count, liked, disabled, onLike, onUnlike }: LikeButtonProps, ) { const [popoverOpen, setPopoverOpen] = useState(false); const countRef = useRef(null); return ( <> {popoverOpen && ( setPopoverOpen(false)} fetchUrl={`${API_URL}/api/comments/${commentId}/likers`} /> )} ); }