fix naming bugs
This commit is contained in:
		
							parent
							
								
									9807ba4c42
								
							
						
					
					
						commit
						16513b20de
					
				|  | @ -19,7 +19,7 @@ interface Props { | |||
| 
 | ||||
| export const Sidebar: FC<Props> = ({ loading, conversations, lightMode, selectedConversation, onNewConversation, onToggleLightMode, onSelectConversation, onDeleteConversation, onToggleSidebar, onRenameConversation }) => { | ||||
|   return ( | ||||
|     <div className="flex flex-col bg-[#202123] min-w-[260px]"> | ||||
|     <div className="flex flex-col bg-[#202123] min-w-[260px] max-w-[260px]"> | ||||
|       <div className="flex items-center h-[60px] pl-2"> | ||||
|         <button | ||||
|           className="flex items-center w-[200px] h-[40px] rounded-lg bg-[#202123] border border-neutral-600 text-sm hover:bg-neutral-700" | ||||
|  |  | |||
|  | @ -68,7 +68,6 @@ export default function Home() { | |||
| 
 | ||||
|           updatedConversation = { | ||||
|             ...updatedConversation, | ||||
|             name: message.content, | ||||
|             messages: updatedMessages | ||||
|           }; | ||||
| 
 | ||||
|  | @ -122,12 +121,14 @@ export default function Home() { | |||
|   }; | ||||
| 
 | ||||
|   const handleRenameConversation = (conversation: Conversation, name: string) => { | ||||
|     const updatedConversation = { | ||||
|       ...conversation, | ||||
|       name | ||||
|     }; | ||||
| 
 | ||||
|     const updatedConversations = conversations.map((c) => { | ||||
|       if (c.id === conversation.id) { | ||||
|         return { | ||||
|           ...c, | ||||
|           name | ||||
|         }; | ||||
|       if (c.id === updatedConversation.id) { | ||||
|         return updatedConversation; | ||||
|       } | ||||
| 
 | ||||
|       return c; | ||||
|  | @ -136,11 +137,8 @@ export default function Home() { | |||
|     setConversations(updatedConversations); | ||||
|     localStorage.setItem("conversationHistory", JSON.stringify(updatedConversations)); | ||||
| 
 | ||||
|     setSelectedConversation({ | ||||
|       ...conversation, | ||||
|       name | ||||
|     }); | ||||
|     localStorage.setItem("selectedConversation", JSON.stringify(selectedConversation)); | ||||
|     setSelectedConversation(updatedConversation); | ||||
|     localStorage.setItem("selectedConversation", JSON.stringify(updatedConversation)); | ||||
|   }; | ||||
| 
 | ||||
|   const handleNewConversation = () => { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue