From 6bb0cd535a035e5fce39c63743729b90e43e163d Mon Sep 17 00:00:00 2001 From: Hanzalah Waheed Date: Wed, 13 Aug 2025 02:36:58 +0400 Subject: [PATCH] fix: rm redundant states. track feedback state w prop var --- .../src/conversation/ConversationBubble.tsx | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index f1af7862..3be40df7 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -92,8 +92,7 @@ const ConversationBubble = forwardRef< const [editInputBox, setEditInputBox] = useState(''); const messageRef = useRef(null); const [shouldShowToggle, setShouldShowToggle] = useState(false); - const [isLikeClicked, setIsLikeClicked] = useState(false); - const [isDislikeClicked, setIsDislikeClicked] = useState(false); + const [activeTooltip, setActiveTooltip] = useState(null); const [isSidebarOpen, setIsSidebarOpen] = useState(false); const editableQueryRef = useRef(null); @@ -574,20 +573,12 @@ const ConversationBubble = forwardRef< }`} > { - if (feedback === undefined || feedback === null) { - handleFeedback?.('LIKE'); - setIsLikeClicked(true); - setIsDislikeClicked(false); - } else if (feedback === 'LIKE') { + if (feedback === 'LIKE') { handleFeedback?.(null); - setIsLikeClicked(false); - setIsDislikeClicked(false); - } else if (feedback === 'DISLIKE') { + } else { handleFeedback?.('LIKE'); - setIsDislikeClicked(false); - setIsLikeClicked(true); } }} onMouseEnter={() => setIsLikeHovered(true)} @@ -607,20 +598,12 @@ const ConversationBubble = forwardRef< }`} > { - if (feedback === undefined || feedback === null) { - handleFeedback?.('DISLIKE'); - setIsDislikeClicked(true); - setIsLikeClicked(false); - } else if (feedback === 'DISLIKE') { + if (feedback === 'DISLIKE') { handleFeedback?.(null); - setIsLikeClicked(false); - setIsDislikeClicked(false); - } else if (feedback === 'LIKE') { + } else { handleFeedback?.('DISLIKE'); - setIsDislikeClicked(true); - setIsLikeClicked(false); } }} onMouseEnter={() => setIsDislikeHovered(true)}