"use client"; import { GitBranch, ArrowRight, ListTodo } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { ThreadWithTasks } from "@/providers/Thread"; import { cn } from "@/lib/utils"; import { StatusIndicator } from "@/components/status-indicator"; import { Skeleton } from "@/components/ui/skeleton"; import { GitHubSVG } from "./icons/github"; import { useQueryState } from "nuqs"; interface ThreadItemProps { thread: ThreadWithTasks; onClick: (thread: ThreadWithTasks) => void; variant?: "sidebar" | "dashboard"; className?: string; } export function ThreadItem({ thread, onClick, variant = "dashboard", className, }: ThreadItemProps) { const [threadId] = useQueryState("threadId"); const isSelected = thread.thread_id === threadId; const isSidebar = variant === "sidebar"; const displayDate = new Date(thread.created_at).toLocaleDateString("en-US", { month: "short", day: "numeric", }); // Check if thread data is still loading/incomplete const isLoading = !thread.threadTitle || thread.threadTitle.includes("undefined") || !thread.repository || thread.repository === "Unknown Repository" || thread.repository.includes("undefined"); if (isLoading) { return (