- {sandboxData.name}
-
-
+ <>
+
+
+
+
+
+
+
+
+ {sandboxData.name}
+
+
+
+
+
-
-
+ >
)
}
diff --git a/frontend/components/editor/navbar/share.tsx b/frontend/components/editor/navbar/share.tsx
new file mode 100644
index 0000000..e49d1b9
--- /dev/null
+++ b/frontend/components/editor/navbar/share.tsx
@@ -0,0 +1,127 @@
+"use client"
+
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@/components/ui/dialog"
+import { z } from "zod"
+import { zodResolver } from "@hookform/resolvers/zod"
+import { useForm } from "react-hook-form"
+
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form"
+import { Input } from "@/components/ui/input"
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select"
+import { Loader2, UserPlus, X } from "lucide-react"
+import { useState } from "react"
+import { Sandbox } from "@/lib/types"
+import { Button } from "@/components/ui/button"
+
+const formSchema = z.object({
+ email: z.string().email(),
+})
+
+export default function ShareSandboxModal({
+ open,
+ setOpen,
+ data,
+}: {
+ open: boolean
+ setOpen: (open: boolean) => void
+ data: Sandbox
+}) {
+ const [loading, setLoading] = useState(false)
+
+ const form = useForm
>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ email: "",
+ },
+ })
+
+ async function onSubmit(values: z.infer) {
+ // if (!user.isSignedIn) return
+ // const sandboxData = { type: selected, userId: user.user.id, ...values }
+ // setLoading(true)
+ // const id = await createSandbox(sandboxData)
+
+ console.log(values)
+ }
+
+ return (
+
+ )
+}
diff --git a/frontend/components/editor/terminal/index.tsx b/frontend/components/editor/terminal/index.tsx
index fffc95b..efe4b40 100644
--- a/frontend/components/editor/terminal/index.tsx
+++ b/frontend/components/editor/terminal/index.tsx
@@ -6,6 +6,7 @@ import "./xterm.css"
import { useEffect, useRef, useState } from "react"
import { Socket } from "socket.io-client"
+import { Loader2 } from "lucide-react"
export default function EditorTerminal({ socket }: { socket: Socket }) {
const terminalRef = useRef(null)
@@ -32,9 +33,8 @@ export default function EditorTerminal({ socket }: { socket: Socket }) {
if (!term) return
const onConnect = () => {
- console.log("Connected to server", socket.connected)
+ // console.log("Connected to server", socket.connected)
setTimeout(() => {
- console.log("sending createTerminal")
socket.emit("createTerminal", { id: "testId" })
}, 500)
}
@@ -42,7 +42,6 @@ export default function EditorTerminal({ socket }: { socket: Socket }) {
const onTerminalResponse = (response: { data: string }) => {
// const res = Buffer.from(response.data, "base64").toString("utf-8")
const res = response.data
- console.log("terminal response", res)
term.write(res)
}
@@ -71,5 +70,17 @@ export default function EditorTerminal({ socket }: { socket: Socket }) {
}
}, [term, terminalRef.current])
- return
+ return (
+
+ {term === null ? (
+
+
+ Connecting to terminal...
+
+ ) : null}
+
+ )
}