diff --git a/backend/storage/src/startercode.ts b/backend/storage/src/startercode.ts index 495bbfb..a277023 100644 --- a/backend/storage/src/startercode.ts +++ b/backend/storage/src/startercode.ts @@ -56,7 +56,7 @@ import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], server: { - port: 8000, + port: 3000, }, }) `, diff --git a/frontend/components/editor/preview/index.tsx b/frontend/components/editor/preview/index.tsx index 3373ec9..b937a34 100644 --- a/frontend/components/editor/preview/index.tsx +++ b/frontend/components/editor/preview/index.tsx @@ -4,10 +4,13 @@ import { ChevronLeft, ChevronRight, Globe, + Link, RotateCw, TerminalSquare, UnfoldVertical, } from "lucide-react"; +import { useRef } from "react"; +import { toast } from "sonner"; export default function PreviewWindow({ collapsed, @@ -18,6 +21,8 @@ export default function PreviewWindow({ open: () => void; sandboxId: string; }) { + const ref = useRef(null); + return ( <>
Preview - localhost:8000 + localhost:3000
@@ -39,16 +44,28 @@ export default function PreviewWindow({ ) : ( <> - console.log("Terminal")}> + {/* Todo, make this open inspector */} + {}}> - console.log("Back")}> - + + { + navigator.clipboard.writeText( + `http://${sandboxId}.sandbox.ishaand.com` + ); + toast.info("Copied preview link to clipboard"); + }} + > + - console.log("Forward")}> - - - console.log("Reload")}> + { + if (ref.current) { + ref.current.contentWindow?.location.reload(); + } + }} + > @@ -59,9 +76,10 @@ export default function PreviewWindow({ {collapsed ? null : (