From 0751debff7ad82c83d0f64bd9c00e72a15c83fc8 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Thu, 2 Jan 2025 02:31:29 +0530 Subject: [PATCH] (feat:nav) add enter/esc to rename in tile --- frontend/src/conversation/ConversationTile.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index dd3e6e1d..c29b9d71 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -115,6 +115,19 @@ export default function ConversationTile({ setConversationsName(conversation.name); setIsEdit(false); } + + const handleRenameKeyDown = (e: React.KeyboardEvent) => { + e.stopPropagation(); + if (e.key === 'Enter') { + handleSaveConversation({ + id: conversation.id, + name: conversationName, + }); + } else if (e.key === 'Escape') { + onClear(); + } + }; + return ( <>
setConversationsName(e.target.value)} + onKeyDown={handleRenameKeyDown} /> ) : (

@@ -239,7 +253,7 @@ export default function ConversationTile({ >