From 6ac2d6d228ef41d0778b6d9a9cf9bd660dc5808d Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sat, 8 Mar 2025 00:48:53 +0530 Subject: [PATCH] (fix:tile) hover behaviour on rename --- frontend/src/conversation/ConversationTile.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index 4da096c2..c9efcd02 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -20,6 +20,7 @@ import { ShareConversationModal } from '../modals/ShareConversationModal'; import { useTranslation } from 'react-i18next'; import ContextMenu from '../components/ContextMenu'; import { MenuOption } from '../components/ContextMenu'; +import { useOutsideAlerter } from '../hooks'; interface ConversationProps { name: string; @@ -163,6 +164,17 @@ export default function ConversationTile({ }, ]; + useOutsideAlerter( + tileRef, + () => { + if (isEdit) { + onClear(); + } + }, + [isEdit], + true, + ); + return ( <>
{ - setIsHovered(false); + if (!isEdit) { + setIsHovered(false); + } }} onClick={() => { onCoversationClick(); @@ -179,7 +193,7 @@ export default function ConversationTile({ selectConversation(conversation.id); }} className={`my-auto mx-4 mt-4 flex h-9 cursor-pointer items-center justify-between pl-4 gap-4 rounded-3xl hover:bg-bright-gray dark:hover:bg-dark-charcoal ${ - conversationId === conversation.id || isOpen || isHovered + conversationId === conversation.id || isOpen || isHovered || isEdit ? 'bg-bright-gray dark:bg-dark-charcoal' : '' }`}