"use client"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { FilePlus2, Archive, Zap } 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"; import { ThemeToggle } from "../theme-toggle"; import { ThreadCard, ThreadCardLoading } from "./thread-card"; import { GitHubInstallationBanner } from "../github/installation-banner"; import { QuickActions } from "./quick-actions"; import { useState } from "react"; import { DraftsSection } from "./drafts-section"; import { GitHubLogoutButton } from "../github/github-oauth-button"; import { MANAGER_GRAPH_ID } from "@open-swe/shared/constants"; import { TooltipIconButton } from "../ui/tooltip-icon-button"; import { InstallationSelector } from "../github/installation-selector"; import { Settings } from "lucide-react"; import NextLink from "next/link"; function OpenSettingsButton() { return ( Open Settings ); } interface DefaultViewProps { threads: ThreadDisplayInfo[]; threadsLoading: boolean; } export function DefaultView({ threads, threadsLoading }: DefaultViewProps) { const router = useRouter(); const [quickActionPrompt, setQuickActionPrompt] = useState(""); const apiUrl: string | undefined = process.env.NEXT_PUBLIC_API_URL ?? ""; const [draftToLoad, setDraftToLoad] = useState(""); const assistantId: string | undefined = MANAGER_GRAPH_ID; const { contentBlocks, setContentBlocks, handleFileUpload, dropRef, removeBlock, dragOver, handlePaste, } = useFileUpload(); const [autoAccept, setAutoAccept] = useState(false); const handleLoadDraft = (content: string) => { setDraftToLoad(content); }; if (!apiUrl) { return
Missing API URL environment variable
; } return (
{/* Header */}
Open SWE
ready
{/* Main Content */}
{/* Terminal Chat Input */}
Attach files setAutoAccept((prev) => !prev)} side="bottom" >
{/* Recent & Running Threads */}

Recent & Running Threads

{threadsLoading || threads.length ? (
{threadsLoading && threads.length === 0 && ( <> )} {threads.slice(0, 4).map((thread) => ( ))}
) : (
No threads found
)}
{/* TODO: Better multiple draft handling. Not actually used right now */}
); }