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