import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { useEffect, useRef, useState } from "react"; interface Props { logPath: string | null; open: boolean; onClose: () => void; } export const ShowDeploymentCompose = ({ logPath, open, onClose }: Props) => { const [data, setData] = useState(""); const endOfLogsRef = useRef(null); useEffect(() => { if (!open || !logPath) return; const protocol = window.location.protocol === "https:" ? "wss:" : "ws:"; const wsUrl = `${protocol}//${window.location.host}/listen-deployment?logPath=${logPath}`; const ws = new WebSocket(wsUrl); ws.onmessage = (e) => { setData((currentData) => currentData + e.data); }; return () => ws.close(); }, [logPath, open]); const scrollToBottom = () => { endOfLogsRef.current?.scrollIntoView({ behavior: "smooth" }); }; useEffect(() => { scrollToBottom(); }, [data]); return ( { onClose(); if (!e) setData(""); }} > Deployment See all the details of this deployment
							{data || "Loading..."}
						
); };