"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 ; case "completed": return ; case "failed": return ; default: return null; } }; const getPRStatusColor = (status: string) => { switch (status) { case "merged": return "text-purple-400"; case "open": return "text-green-400"; case "draft": return "text-gray-400"; case "closed": return "text-red-400"; default: return "text-gray-400"; } }; if (!apiUrl || !assistantId) { return
Missing API URL or Assistant ID
; } return (
{/* Header */}
Open SWE
ready
{/* Main Content */}
{/* Terminal Chat Input */}
Attach files
{/* Recent & Running Threads */}

Recent & Running Threads

{threads.slice(0, 4).map((thread) => ( { router.push(`/chat/${thread.id}`); }} >
{thread.title}
{thread.repository}
{getStatusIcon(thread.status)} {thread.status}
{thread.taskCount === 0 ? "No tasks" : `${thread.taskCount} tasks`} • {thread.lastActivity}
{thread.githubIssue && ( )} {thread.pullRequest && ( )}
))}
{/* Quick Actions */}

Quick Actions

Debug Code Find and fix issues in your codebase Add Feature Implement new functionality Refactor Code Improve code structure and performance
); }