refactor(ErrorMessagePreview): simplify error message display by removing Popover component
This commit is contained in:
@@ -16,11 +16,6 @@ import { JsonTreeViewer } from "@/components/json-tree-viewer"
|
|||||||
import { ProjectDialog } from "@/components/project-dialog"
|
import { ProjectDialog } from "@/components/project-dialog"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import {
|
|
||||||
Popover,
|
|
||||||
PopoverContent,
|
|
||||||
PopoverTrigger,
|
|
||||||
} from "@/components/ui/popover"
|
|
||||||
import {
|
import {
|
||||||
fetchAIAgentsAll,
|
fetchAIAgentsAll,
|
||||||
fetchAIWorkflowRun,
|
fetchAIWorkflowRun,
|
||||||
@@ -332,36 +327,16 @@ export default function DashboardAIWorkflowRunsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ErrorMessagePreview({ message }: { message: string }) {
|
function ErrorMessagePreview({ message }: { message: string }) {
|
||||||
const [open, setOpen] = useState(false)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<button
|
||||||
<PopoverTrigger
|
type="button"
|
||||||
render={
|
className="flex w-full min-w-0 items-center gap-1.5 text-left text-xs text-destructive"
|
||||||
<button
|
title={message}
|
||||||
type="button"
|
onClick={(event) => event.stopPropagation()}
|
||||||
className="flex w-full min-w-0 items-center gap-1.5 text-left text-xs text-destructive"
|
>
|
||||||
onClick={(event) => event.stopPropagation()}
|
<AlertTriangleIcon className="size-3.5 shrink-0" />
|
||||||
onMouseEnter={() => setOpen(true)}
|
<span className="block min-w-0 truncate">{message}</span>
|
||||||
onMouseLeave={() => setOpen(false)}
|
</button>
|
||||||
onFocus={() => setOpen(true)}
|
|
||||||
onBlur={() => setOpen(false)}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<AlertTriangleIcon className="size-3.5 shrink-0" />
|
|
||||||
<span className="block min-w-0 truncate">{message}</span>
|
|
||||||
</PopoverTrigger>
|
|
||||||
<PopoverContent
|
|
||||||
align="end"
|
|
||||||
className="max-h-80 w-[30rem] max-w-[min(30rem,calc(100vw-2rem))] overflow-auto whitespace-pre-wrap break-words text-xs text-destructive"
|
|
||||||
onMouseEnter={() => setOpen(true)}
|
|
||||||
onMouseLeave={() => setOpen(false)}
|
|
||||||
onClick={(event) => event.stopPropagation()}
|
|
||||||
>
|
|
||||||
{message}
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user