start terminals logic (frontend)
This commit is contained in:
parent
894de9990a
commit
a0c2bb1bc3
@ -14,7 +14,10 @@ import {
|
|||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
FileJson,
|
FileJson,
|
||||||
|
Plus,
|
||||||
RotateCw,
|
RotateCw,
|
||||||
|
Shell,
|
||||||
|
SquareTerminal,
|
||||||
TerminalSquare,
|
TerminalSquare,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
import Tab from "../ui/tab"
|
import Tab from "../ui/tab"
|
||||||
@ -26,6 +29,7 @@ import { io } from "socket.io-client"
|
|||||||
import { processFileType, validateName } from "@/lib/utils"
|
import { processFileType, validateName } from "@/lib/utils"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import EditorTerminal from "./terminal"
|
import EditorTerminal from "./terminal"
|
||||||
|
import { Button } from "../ui/button"
|
||||||
|
|
||||||
export default function CodeEditor({
|
export default function CodeEditor({
|
||||||
userId,
|
userId,
|
||||||
@ -47,6 +51,7 @@ export default function CodeEditor({
|
|||||||
const [activeFile, setActiveFile] = useState<string | null>(null)
|
const [activeFile, setActiveFile] = useState<string | null>(null)
|
||||||
const [tabs, setTabs] = useState<TTab[]>([])
|
const [tabs, setTabs] = useState<TTab[]>([])
|
||||||
const [activeId, setActiveId] = useState<string | null>(null)
|
const [activeId, setActiveId] = useState<string | null>(null)
|
||||||
|
const [terminals, setTerminals] = useState<string[]>([])
|
||||||
|
|
||||||
const socket = io(
|
const socket = io(
|
||||||
`http://localhost:4000?userId=${userId}&sandboxId=${sandboxId}`
|
`http://localhost:4000?userId=${userId}&sandboxId=${sandboxId}`
|
||||||
@ -301,8 +306,17 @@ export default function CodeEditor({
|
|||||||
className="p-2 flex flex-col"
|
className="p-2 flex flex-col"
|
||||||
>
|
>
|
||||||
<div className="h-10 w-full flex gap-2 shrink-0">
|
<div className="h-10 w-full flex gap-2 shrink-0">
|
||||||
<Tab selected>Node</Tab>
|
<Tab selected>
|
||||||
<Tab>Console</Tab>
|
<SquareTerminal className="w-4 h-4 mr-2" />
|
||||||
|
Shell
|
||||||
|
</Tab>
|
||||||
|
<Button
|
||||||
|
size="smIcon"
|
||||||
|
variant={"secondary"}
|
||||||
|
className={`font-normal select-none text-muted-foreground`}
|
||||||
|
>
|
||||||
|
<Plus className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full relative grow h-full overflow-hidden rounded-md bg-secondary">
|
<div className="w-full relative grow h-full overflow-hidden rounded-md bg-secondary">
|
||||||
{socket ? <EditorTerminal socket={socket} /> : null}
|
{socket ? <EditorTerminal socket={socket} /> : null}
|
||||||
|
@ -25,6 +25,7 @@ const buttonVariants = cva(
|
|||||||
sm: "h-8 rounded-md px-3 text-xs",
|
sm: "h-8 rounded-md px-3 text-xs",
|
||||||
lg: "h-10 rounded-md px-8",
|
lg: "h-10 rounded-md px-8",
|
||||||
icon: "h-9 w-9",
|
icon: "h-9 w-9",
|
||||||
|
smIcon: "h-8 w-8",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user