import{r as n,j as e,c}from"./index-CUDottTv.js";import{T as m}from"./topbar-892TvyNb.js";import{B as d}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{u as x}from"./use-connected-3Ljk-Uwv.js";const i=[{name:"Vercel",id:"vercel",configured:!1,envVar:"VERCEL_TOKEN + VERCEL_PROJECT_ID",docsUrl:"https://vercel.com/docs/rest-api",description:"Deploy logs, build status, and runtime errors from Vercel."},{name:"Cloudflare",id:"cloudflare",configured:!1,envVar:"CF_API_TOKEN + CF_ACCOUNT_ID",docsUrl:"https://developers.cloudflare.com/api/",description:"Worker deployments, analytics, and error logs."},{name:"Railway",id:"railway",configured:!1,envVar:"RAILWAY_TOKEN + RAILWAY_PROJECT_ID",docsUrl:"https://docs.railway.app/reference/public-api",description:"Service deployments, build logs, and runtime metrics."}];function v(){const[t,o]=n.useState("overview");x();const[r,l]=n.useState(i);n.useEffect(()=>{l(i)},[]);const a=r.filter(s=>s.configured).length;return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[e.jsx(m,{tabs:[{id:"overview",label:"Overview"},{id:"setup",label:"Setup"}],activeTab:t,onTabChange:o}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[t==="overview"&&e.jsxs("div",{className:"p-5 space-y-4 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Platform Connections"}),e.jsxs(d,{size:"sm",variant:a>0?"green":"default",children:[a,"/",r.length," connected"]})]}),e.jsx("div",{className:"grid gap-3",children:r.map(s=>e.jsx(u,{platform:s},s.id))}),a===0&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border border-border-muted bg-bg-surface",children:e.jsxs("p",{className:"text-sm text-text-muted",children:["No platforms connected yet. Switch to the"," ",e.jsx("button",{className:"text-accent hover:underline",onClick:()=>o("setup"),children:"Setup"})," ","tab to configure your deployment platforms."]})})]}),t==="setup"&&e.jsxs("div",{className:"p-5 space-y-6 max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:"Infrastructure Setup"}),e.jsx("p",{className:"text-sm text-text-muted",children:"Connect your deployment platforms to see deploy logs, build status, and runtime errors directly in RuntimeScope."})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"How it works"}),e.jsxs("ol",{className:"text-sm text-text-secondary space-y-2 list-decimal list-inside",children:[e.jsx("li",{children:"Set the required environment variables for your platform"}),e.jsx("li",{children:"Configure the platform in your RuntimeScope config file"}),e.jsx("li",{children:"Restart the collector — deploy data will appear automatically"})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong bg-bg-surface space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Configuration"}),e.jsxs("p",{className:"text-sm text-text-muted",children:["Add platforms to ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-bg-elevated text-text-secondary font-mono text-xs",children:"~/.runtimescope/config.json"}),":"]}),e.jsx("pre",{className:"text-xs font-mono bg-bg-elevated p-3 rounded-lg overflow-x-auto text-text-secondary",children:`{
  "infra": {
    "vercel": {
      "projectId": "prj_...",
      "token": "your-vercel-token"
    },
    "cloudflare": {
      "accountId": "abc123",
      "workerName": "my-worker",
      "token": "your-cf-token"
    }
  }
}`})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Supported Platforms"}),r.map(s=>e.jsxs("div",{className:"p-4 rounded-lg border border-border-strong space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:s.name}),e.jsx(d,{size:"sm",variant:s.configured?"green":"default",children:s.configured?"Connected":"Not configured"})]}),e.jsx("p",{className:"text-xs text-text-muted",children:s.description}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-text-muted",children:"Required:"}),e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-bg-elevated text-text-secondary font-mono",children:s.envVar})]})]},s.id))]}),e.jsxs("div",{className:"p-4 rounded-lg border border-amber/20 bg-amber/5 space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-amber",children:"MCP Server Only"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Infrastructure monitoring currently requires the MCP server (not the standalone collector). Claude Code can access deploy logs, build status, and runtime errors through MCP tools even when this dashboard tab shows no data."})]})]})]})]})}function u({platform:t}){return e.jsxs("div",{className:c("flex items-center gap-4 p-4 rounded-lg border",t.configured?"border-green/20 bg-green/5":"border-border-muted bg-bg-surface"),children:[e.jsx("div",{className:c("w-10 h-10 rounded-lg flex items-center justify-center text-sm font-bold",t.configured?"bg-green/10 text-green":"bg-bg-elevated text-text-muted"),children:t.name[0]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:t.name}),e.jsx(d,{size:"sm",variant:t.configured?"green":"default",children:t.configured?"Connected":"Not configured"})]}),e.jsx("p",{className:"text-xs text-text-muted mt-0.5",children:t.description})]})]})}export{v as InfraPage};
