Spaces:
Running
Running
File size: 2,345 Bytes
3f76ff4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | "use client";
import { useState } from "react";
import type { WorkPackageOutput } from "@/lib/work-package-types";
import { SIMULATED_EXECUTION_DISCLAIMER } from "@/lib/work-package-types";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { MarkdownContent } from "@/components/MarkdownContent";
import { ChevronDown, ChevronUp } from "lucide-react";
export function WorkPackageOutputCard(props: {
output: WorkPackageOutput;
defaultOpen?: boolean;
}) {
const { output, defaultOpen = false } = props;
const [open, setOpen] = useState(defaultOpen);
const disclaimer =
output.disclaimer?.trim() || SIMULATED_EXECUTION_DISCLAIMER;
return (
<Card className="rounded-2xl border-0 bg-background/88 shadow-sm ring-1 ring-black/5">
<CardHeader className="flex flex-row items-start justify-between gap-2 space-y-0 p-3">
<div className="min-w-0">
<CardTitle className="truncate text-xs font-semibold">
{output.title}
</CardTitle>
<div className="mt-1 flex flex-wrap items-center gap-1">
<Badge variant="secondary" className="text-[11px]">
{output.executionMode === "simulated"
? "Simulated Execution"
: "LLM Automation"}
</Badge>
<Badge variant="outline" className="text-[11px]">
{output.type}
</Badge>
</div>
</div>
<Button
variant="ghost"
size="icon"
className="h-7 w-7 shrink-0"
onClick={() => setOpen((v) => !v)}
aria-label={open ? "Collapse output" : "Expand output"}
>
{open ? (
<ChevronUp className="h-4 w-4" />
) : (
<ChevronDown className="h-4 w-4" />
)}
</Button>
</CardHeader>
<CardContent className="space-y-2 p-3 pt-0">
<div className="rounded-xl bg-muted/32 p-2.5 text-[11px] leading-5 text-muted-foreground">
{disclaimer}
</div>
{open ? (
<div className="rounded-xl bg-muted/18 p-3">
<MarkdownContent content={output.content} />
</div>
) : null}
</CardContent>
</Card>
);
}
|