Fix: Close nav bar on conversation click

This commit is contained in:
shatanikmahanty
2024-10-07 10:12:18 +05:30
parent 601ba40cb0
commit 27f97bc55d
2 changed files with 4 additions and 0 deletions

View File

@@ -280,6 +280,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
key={conversation.id} key={conversation.id}
conversation={conversation} conversation={conversation}
selectConversation={(id) => handleConversationClick(id)} selectConversation={(id) => handleConversationClick(id)}
onCoversationClick={() => {if (isMobile) { setNavOpen(false) }}}
onDeleteConversation={(id) => handleDeleteConversation(id)} onDeleteConversation={(id) => handleDeleteConversation(id)}
onSave={(conversation) => onSave={(conversation) =>
updateConversationName(conversation) updateConversationName(conversation)

View File

@@ -22,6 +22,7 @@ interface ConversationProps {
interface ConversationTileProps { interface ConversationTileProps {
conversation: ConversationProps; conversation: ConversationProps;
selectConversation: (arg1: string) => void; selectConversation: (arg1: string) => void;
onCoversationClick: () => void; //Callback to handle click on conversation tile regardless of selected or not
onDeleteConversation: (arg1: string) => void; onDeleteConversation: (arg1: string) => void;
onSave: ({ name, id }: ConversationProps) => void; onSave: ({ name, id }: ConversationProps) => void;
} }
@@ -29,6 +30,7 @@ interface ConversationTileProps {
export default function ConversationTile({ export default function ConversationTile({
conversation, conversation,
selectConversation, selectConversation,
onCoversationClick,
onDeleteConversation, onDeleteConversation,
onSave, onSave,
}: ConversationTileProps) { }: ConversationTileProps) {
@@ -90,6 +92,7 @@ export default function ConversationTile({
setIsHovered(false); setIsHovered(false);
}} }}
onClick={() => { onClick={() => {
onCoversationClick();
conversationId !== conversation.id && conversationId !== conversation.id &&
selectConversation(conversation.id); selectConversation(conversation.id);
}} }}