From 5c4753555e53e3d4304feabdb7c3bbf8cc63efda Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Mon, 3 Feb 2025 21:06:29 -0800 Subject: [PATCH] chatbubble add edit button (need to refactor InputBox to finish) --- .../react/src/sidebar-tsx/SidebarChat.tsx | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index d6e48017..1854d6cf 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -21,6 +21,7 @@ import { useScrollbarStyles } from '../util/useScrollbarStyles.js'; import { VOID_CTRL_L_ACTION_ID } from '../../../actionIDs.js'; import { filenameToVscodeLanguage } from '../../../helpers/detectLanguage.js'; import { VOID_OPEN_SETTINGS_ACTION_ID } from '../../../voidSettingsPane.js'; +import { Pencil } from 'lucide-react'; export const IconX = ({ size, className = '', ...props }: { size: number, className?: string } & React.SVGProps) => { @@ -428,89 +429,88 @@ export const SelectedFiles = ( } - -const ChatBubble_ = ({ isEditMode, isLoading, children, role }: { role: ChatMessage['role'], children: React.ReactNode, isLoading: boolean, isEditMode: boolean }) => { - - return
-
- {children} - {isLoading && } -
- - {/* edit button */} - {/* {role === 'user' && - { setIsEditMode(v => !v); }} - /> - } */} -
-} - - +type ChatBubbleMode = 'display' | 'edit' const ChatBubble = ({ chatMessage, isLoading }: { chatMessage: ChatMessage, isLoading?: boolean, }) => { const role = chatMessage.role // edit mode state - const [isEditMode, setIsEditMode] = useState(false) - + const [mode, setMode] = useState('display') + const [editText, setEditText] = useState(chatMessage.displayContent ?? '') + const [isHovered, setIsHovered] = useState(false) if (!chatMessage.content && !isLoading) { // don't show if empty and not loading (if loading, want to show) return null } + // set chat bubble contents let chatbubbleContents: React.ReactNode - if (role === 'user') { - chatbubbleContents = <> - - {chatMessage.displayContent} - - {/* {!isEditMode ? chatMessage.displayContent : <>} */} - {/* edit mode content */} - {/* TODO this should be the same input box as in the Sidebar */} - {/*