"use client"; import { Button } from "@/components/ui/button"; import Tab from "@/components/ui/tab"; import { closeTerminal, createTerminal } from "@/lib/terminal"; import { Terminal } from "@xterm/xterm"; import { Loader2, Plus, SquareTerminal, TerminalSquare } from "lucide-react"; import { Socket } from "socket.io-client"; import { toast } from "sonner"; import EditorTerminal from "./terminal"; import { useState } from "react"; export default function Terminals({ terminals, setTerminals, socket, }: { terminals: { id: string; terminal: Terminal | null }[]; setTerminals: React.Dispatch< React.SetStateAction< { id: string; terminal: Terminal | null; }[] > >; socket: Socket; }) { const [activeTerminalId, setActiveTerminalId] = useState(""); const [creatingTerminal, setCreatingTerminal] = useState(false); const [closingTerminal, setClosingTerminal] = useState(""); const activeTerminal = terminals.find((t) => t.id === activeTerminalId); return ( <>