From 09097e580c3df87b076836d5d20187304bf85690 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Fri, 17 Jan 2025 07:19:13 -0800 Subject: [PATCH] UI improvements to chat and bug selection (#5) --- app/components/chat/BaseChat.tsx | 19 ++----------------- app/components/chat/SendButton.client.tsx | 18 +++++++++++------- app/components/workbench/Preview.tsx | 7 +++++-- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index 99e373415..5f3db5de4 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -377,7 +377,7 @@ export const BaseChat = React.forwardRef( <> 0 || isStreaming || uploadedFiles.length > 0} - simulation={false} + fixBug={false} isStreaming={isStreaming} onClick={(event) => { if (isStreaming) { @@ -392,7 +392,7 @@ export const BaseChat = React.forwardRef( /> 0 || uploadedFiles.length > 0) && chatStarted} - simulation={true} + fixBug={true} isStreaming={isStreaming} onClick={(event) => { if (input.length > 0 || uploadedFiles.length > 0) { @@ -408,21 +408,6 @@ export const BaseChat = React.forwardRef( handleFileUpload()}>
- { - enhancePrompt?.(); - toast.success('Prompt enhanced!'); - }} - > - {enhancingPrompt ? ( -
- ) : ( -
- )} -
) => void; @@ -11,17 +11,17 @@ interface SendButtonProps { const customEasingFn = cubicBezier(0.4, 0, 0.2, 1); -export const SendButton = ({ show, simulation, isStreaming, disabled, onClick }: SendButtonProps) => { - const className = simulation +export const SendButton = ({ show, fixBug, isStreaming, disabled, onClick }: SendButtonProps) => { + const className = fixBug ? "absolute flex justify-center items-center top-[18px] right-[60px] p-1 bg-accent-500 hover:brightness-94 color-white rounded-md w-[34px] h-[34px] transition-theme disabled:opacity-50 disabled:cursor-not-allowed" : "absolute flex justify-center items-center top-[18px] right-[22px] p-1 bg-accent-500 hover:brightness-94 color-white rounded-md w-[34px] h-[34px] transition-theme disabled:opacity-50 disabled:cursor-not-allowed"; // Determine tooltip text based on button state - const tooltipText = simulation - ? "Start Recording" + const tooltipText = fixBug + ? "Fix Bug" : isStreaming ? "Stop Generation" - : "Send Message"; + : "Make Improvement"; return ( @@ -43,7 +43,11 @@ export const SendButton = ({ show, simulation, isStreaming, disabled, onClick }: }} >
- {simulation ?
: !isStreaming ?
:
} + {fixBug + ?
+ : !isStreaming + ?
+ :
}
) : null} diff --git a/app/components/workbench/Preview.tsx b/app/components/workbench/Preview.tsx index 753a0640b..d1de04bae 100644 --- a/app/components/workbench/Preview.tsx +++ b/app/components/workbench/Preview.tsx @@ -127,6 +127,8 @@ export const Preview = memo(() => { if (iframeRef.current) { iframeRef.current.src = iframeRef.current.src; } + setIsSelectionMode(false); + setSelectionPoint(null); }; const toggleFullscreen = async () => { @@ -257,8 +259,9 @@ export const Preview = memo(() => {
setIsSelectionMode(!isSelectionMode)} + icon="i-ph:bug-beetle" + title="Point to Bug" + onClick={() => { setSelectionPoint(null); setIsSelectionMode(!isSelectionMode); }} className={isSelectionMode ? 'bg-bolt-elements-background-depth-3' : ''} />