"use client"; import { useEffect, useState } from "react"; import { useParams } from "next/navigation"; import { toast } from "sonner"; interface Project { id: string; productName: string; status?: string; giteaRepoUrl?: string; giteaRepo?: string; theiaWorkspaceUrl?: string; coolifyDeployUrl?: string; customDomain?: string; prd?: string; } function SectionLabel({ children }: { children: React.ReactNode }) { return (
{children}
); } function InfoCard({ children, style = {} }: { children: React.ReactNode; style?: React.CSSProperties }) { return (
{children}
); } export default function DeploymentPage() { const params = useParams(); const projectId = params.projectId as string; const [project, setProject] = useState(null); const [loading, setLoading] = useState(true); const [customDomainInput, setCustomDomainInput] = useState(""); const [connecting, setConnecting] = useState(false); useEffect(() => { fetch(`/api/projects/${projectId}`) .then((r) => r.json()) .then((d) => setProject(d.project)) .catch(() => {}) .finally(() => setLoading(false)); }, [projectId]); const handleConnectDomain = async () => { if (!customDomainInput.trim()) return; setConnecting(true); await new Promise((r) => setTimeout(r, 800)); toast.info("Domain connection coming soon — we'll hook this to Coolify."); setConnecting(false); }; if (loading) { return (
Loading…
); } const hasDeploy = Boolean(project?.coolifyDeployUrl || project?.theiaWorkspaceUrl); const hasRepo = Boolean(project?.giteaRepoUrl); const hasPRD = Boolean(project?.prd); return (

Deployment

Links, environments, and hosting for {project?.productName ?? "this project"}

{/* Project URLs */} Project URLs {hasDeploy ? ( <> {project?.coolifyDeployUrl && (
Staging
{project.coolifyDeployUrl}
Open ↗
)} {project?.customDomain && (
Production
{project.customDomain}
SSL Active Open ↗
)} {project?.giteaRepoUrl && (
Build repo
{project.giteaRepo}
View ↗
)} ) : (

{!hasPRD ? "Complete your PRD with Atlas first, then build and deploy." : !hasRepo ? "No repository yet — the Architect agent will scaffold one from your PRD." : "No deployment yet — kick off a build to get a live URL."}

)}
{/* Custom domain */} {hasDeploy && !project?.customDomain && ( Custom Domain

Point your own domain to this project. SSL certificates are handled automatically.

setCustomDomainInput(e.target.value)} style={{ flex: 1, padding: "9px 13px", borderRadius: 7, border: "1px solid #e0dcd4", background: "#faf8f5", fontSize: "0.84rem", fontFamily: "IBM Plex Mono, monospace", color: "#1a1a1a" }} />
)} {/* Environment variables */} Environment Variables {hasDeploy ? (

Manage environment variables in Coolify for your deployed services. {project?.coolifyDeployUrl && ( <> Open Coolify ↗ )}

) : (

Available after first build completes.

)}
{/* Deploy history */} Deploy History

{project?.status === "live" ? "Deploy history will appear here." : "No deploys yet."}

); }