Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions ui/desktop/src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
34 changes: 29 additions & 5 deletions ui/desktop/src/toasts.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -173,19 +175,41 @@ function ToastErrorContent({
}: Omit<ToastErrorProps, 'setView'>) {
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 (
<div className="flex gap-4">
<div className="flex gap-4 pr-8">
<div className="flex-grow">
{title && <strong className="font-medium">{title}</strong>}
{msg && <div>{msg}</div>}
</div>
<div className="flex-none flex items-center gap-2">
{showRecovery ? (
{showRecovery && (
<Button onClick={() => startNewSession(recoverHints, setView)}>Ask goose</Button>
) : traceback ? (
<Button onClick={() => navigator.clipboard.writeText(traceback)}>Copy error</Button>
) : null}
)}
{hasBoth && (
<Tooltip>
<TooltipTrigger asChild>
<Button onClick={handleCopyError} shape="round" aria-label="Copy error">
<Copy className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" className="z-[10000]">
Copy error
</TooltipContent>
</Tooltip>
)}
{traceback && !hasBoth && <Button onClick={handleCopyError}>Copy error</Button>}
</div>
</div>
);
Expand Down
Loading