"use client";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import {
CheckCircle,
XCircle,
Loader2,
GitBranch,
GitPullRequest,
Bug,
FilePlus2,
} from "lucide-react";
import { useRouter } from "next/navigation";
import { ThreadDisplayInfo } from "./types";
import { TerminalInput } from "./terminal-input";
import { useFileUpload } from "@/hooks/useFileUpload";
import { cn } from "@/lib/utils";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "../ui/tooltip";
import { Label } from "../ui/label";
import { ContentBlocksPreview } from "../thread/ContentBlocksPreview";
interface DefaultViewProps {
threads: ThreadDisplayInfo[];
}
export function DefaultView({ threads }: DefaultViewProps) {
const router = useRouter();
const apiUrl: string | undefined = process.env.NEXT_PUBLIC_API_URL ?? "";
const assistantId: string | undefined =
process.env.NEXT_PUBLIC_MANAGER_ASSISTANT_ID ?? "";
const {
contentBlocks,
setContentBlocks,
handleFileUpload,
dropRef,
removeBlock,
dragOver,
handlePaste,
} = useFileUpload();
const getStatusColor = (status: ThreadDisplayInfo["status"]) => {
switch (status) {
case "running":
return "bg-blue-950 text-blue-400";
case "completed":
return "bg-green-950 text-green-400";
case "failed":
return "bg-red-950 text-red-400";
case "pending":
return "bg-yellow-950 text-yellow-400";
default:
return "bg-gray-800 text-gray-400";
}
};
const getStatusIcon = (status: ThreadDisplayInfo["status"]) => {
switch (status) {
case "running":
return