From 9a22ffe769c14ed3992b3369634b99830ca1e7b5 Mon Sep 17 00:00:00 2001 From: Abhijay Jain Date: Mon, 24 Nov 2025 17:00:21 +0530 Subject: [PATCH] feat : add ability to see error message in toast (#5851) Signed-off-by: Abhijay007 --- ui/desktop/src/App.tsx | 2 +- ui/desktop/src/styles/main.css | 6 +++--- ui/desktop/src/toasts.tsx | 34 +++++++++++++++++++++++++++++----- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ui/desktop/src/App.tsx b/ui/desktop/src/App.tsx index 08349f84..33a8d222 100644 --- a/ui/desktop/src/App.tsx +++ b/ui/desktop/src/App.tsx @@ -625,7 +625,7 @@ export function AppInner() { text-text-on-accent bg-background-inverse ` } - style={{ width: '380px' }} + style={{ width: '450px' }} className="mt-6" position="top-right" autoClose={3000} diff --git a/ui/desktop/src/styles/main.css b/ui/desktop/src/styles/main.css index f5432134..f76417a5 100644 --- a/ui/desktop/src/styles/main.css +++ b/ui/desktop/src/styles/main.css @@ -373,9 +373,9 @@ .Toastify__close-button { color: var(--text-prominent-inverse) !important; opacity: 0.7; - align-self: flex-start; - margin-top: 4px; - margin-right: 4px; + align-self: center; + margin-top: 0; + margin-right: 8px; padding: 4px; border-radius: 4px; transition: diff --git a/ui/desktop/src/toasts.tsx b/ui/desktop/src/toasts.tsx index d75cb125..6e3754e2 100644 --- a/ui/desktop/src/toasts.tsx +++ b/ui/desktop/src/toasts.tsx @@ -1,5 +1,7 @@ import { toast, ToastOptions } from 'react-toastify'; import { Button } from './components/ui/button'; +import { Tooltip, TooltipContent, TooltipTrigger } from './components/ui/Tooltip'; +import Copy from './components/icons/Copy'; import { startNewSession } from './sessions'; import { useNavigation } from './hooks/useNavigation'; import { @@ -173,19 +175,41 @@ function ToastErrorContent({ }: Omit) { const setView = useNavigation(); const showRecovery = recoverHints && setView; + const hasBoth = traceback && showRecovery; + + const handleCopyError = async () => { + if (traceback) { + try { + await navigator.clipboard.writeText(traceback); + } catch (error) { + console.error('Failed to copy error:', error); + } + } + }; return ( -
+
{title && {title}} {msg &&
{msg}
}
- {showRecovery ? ( + {showRecovery && ( - ) : traceback ? ( - - ) : null} + )} + {hasBoth && ( + + + + + + Copy error + + + )} + {traceback && !hasBoth && }
);