Spaces:
Running
Running
| import React from "react"; | |
| import { ExampleTraceLite } from "@/types"; | |
| import { Dialog, DialogContent } from "@/components/ui/dialog"; | |
| import { Button } from "@/components/ui/button"; | |
| import { Badge } from "@/components/ui/badge"; | |
| interface Props { | |
| open: boolean; | |
| example: ExampleTraceLite; | |
| onOpenChange: (open: boolean) => void; | |
| onImport: () => void; | |
| } | |
| const ExampleTraceDetailDrawer: React.FC<Props> = ({ | |
| open, | |
| example, | |
| onOpenChange, | |
| onImport, | |
| }) => { | |
| return ( | |
| <Dialog open={open} onOpenChange={onOpenChange}> | |
| <DialogContent | |
| className="fixed inset-y-0 right-0 m-0 h-full w-full max-w-lg rounded-l-xl bg-background/95 backdrop-blur shadow-xl border-l data-[state=open]:animate-slideInRight" | |
| style={{ top: 0, left: "auto", transform: "none" }} | |
| > | |
| <div className="flex flex-col h-full"> | |
| {/* Scrollable content */} | |
| <div className="flex-1 overflow-y-auto space-y-6 p-6"> | |
| {/* Question */} | |
| <div className="space-y-2"> | |
| <h2 className="text-lg font-semibold leading-relaxed"> | |
| Full Question | |
| </h2> | |
| <p className="whitespace-pre-line break-words"> | |
| {example.question} | |
| </p> | |
| </div> | |
| {/* Agents */} | |
| {example.agents && example.agents.length > 0 && ( | |
| <div className="space-y-2"> | |
| <h3 className="text-sm font-semibold text-muted-foreground"> | |
| Agents | |
| </h3> | |
| <div className="flex flex-wrap gap-2"> | |
| {example.agents.map((a) => ( | |
| <Badge key={a} variant="secondary"> | |
| {a} | |
| </Badge> | |
| ))} | |
| </div> | |
| </div> | |
| )} | |
| {/* Mistake step */} | |
| <div className="space-y-1"> | |
| <h3 className="text-sm font-semibold text-muted-foreground"> | |
| Mistake Step | |
| </h3> | |
| <p className="text-sm text-muted-foreground"> | |
| {example.mistake_step} | |
| </p> | |
| </div> | |
| </div> | |
| {/* Footer */} | |
| <div className="border-t bg-background p-4 flex justify-end gap-2 sticky bottom-0"> | |
| <Button variant="outline" onClick={() => onOpenChange(false)}> | |
| Close | |
| </Button> | |
| <Button | |
| variant="outline" | |
| onClick={() => | |
| navigator.clipboard.writeText(JSON.stringify(example, null, 2)) | |
| } | |
| > | |
| Copy JSON | |
| </Button> | |
| <Button onClick={onImport}>Import</Button> | |
| </div> | |
| </div> | |
| </DialogContent> | |
| </Dialog> | |
| ); | |
| }; | |
| export default ExampleTraceDetailDrawer; | |