1import{r as s,j as e}from"./framework-BdTzk1lU.js";import{z as A,a1 as D,Y as R,y as u,aj as y,N as b,A as L}from"./icons-D40JOYlY.js";import{A as P}from"./AppLogo-ClQv3tlG.js";import{s as T}from"./integrations-RSRvudgF.js";import{u as E}from"./usePageTitle-BG_KM02W.js";import"./supabase--jJ_z69-.js";import"./index-CcH6CCuW.js";import"./radix-DqCxixhA.js";import"./ui-extras-DY9FYdFI.js";import"./react-query-Bk0odbHV.js";import"./date-fns-Ckb5rtl2.js";import"./forms-BBkrZbpw.js";const F="https://flooagdtojnaceftkaqm.supabase.co",H="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZsb29hZ2R0b2puYWNlZnRrYXFtIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMyOTcyMTcsImV4cCI6MjA4ODg3MzIxN30.18t_UaLO5VsHioSfjPi01-U_JqlQDzPU52ZBZP9OPIo",Q=()=>{E("System Status");const[o,d]=s.useState(null),[m,x]=s.useState(!0),[h,g]=s.useState(null),[j,f]=s.useState(new Date),[p,w]=s.useState({name:"Frontend App",status:"operational",latency_ms:0,message:"All systems normal",checked_at:new Date().toISOString()}),r=s.useCallback(async()=>{x(!0),g(null);const t=performance.now();w({name:"Frontend App",status:"operational",latency_ms:Math.round(performance.now()-t),message:"All systems normal",checked_at:new Date().toISOString()});try{const a=await fetch(`${F}/functions/v1/health-check`,{headers:{"Content-Type":"application/json",apikey:H}});if(!a.ok)throw new Error(`HTTP ${a.status}`);const O=await a.json();d(O)}catch{g("Unable to reach backend health endpoint"),d({overall_status:"major_outage",services:[{name:"Database",status:"down",latency_ms:null,message:"Health check unreachable",checked_at:new Date().toISOString()},{name:"Authentication",status:"down",latency_ms:null,message:"Health check unreachable",checked_at:new Date().toISOString()},{name:"File Storage",status:"down",latency_ms:null,message:"Health check unreachable",checked_at:new Date().toISOString()},{name:"Edge Functions",status:"down",latency_ms:null,message:"Health check unreachable",checked_at:new Date().toISOString()}],checked_at:new Date().toISOString()})}finally{x(!1),f(new Date)}},[]);s.useEffect(()=>(r(),T(r,6e4)),[r]);const n=o!==null,i=o?[p,...o.services]:[p],l=i.every(t=>t.status==="operational"),c=i.some(t=>t.status==="down"),N=n?c?"Major Outage":l?"All Systems Operational":"Partial Outage":"Checking servicesâ¦",S=n?c?"bg-red-500":l?"bg-emerald-500":"bg-amber-500":"bg-gray-400",v=n?c?"text-red-600":l?"text-emerald-600":"text-amber-600":"text-gray-600",k=n?c?"bg-red-50 border-red-200":l?"bg-emerald-50 border-emerald-200":"bg-amber-50 border-amber-200":"bg-gray-50 border-gray-200",I=t=>{switch(t){case"operational":return e.jsx(u,{className:"w-5 h-5 text-emerald-500"});case"degraded":return e.jsx(y,{className:"w-5 h-5 text-amber-500"});case"down":return e.jsx(b,{className:"w-5 h-5 text-red-500"});default:return e.jsx(L,{className:"w-5 h-5 text-gray-400"})}},_=t=>({operational:"bg-emerald-100 text-emerald-700 border-emerald-200",degraded:"bg-amber-100 text-amber-700 border-amber-200",down:"bg-red-100 text-red-700 border-red-200"})[t]||"bg-gray-100 text-gray-700 border-gray-200",C=t=>t===null?"text-gray-400":t<200?"text-emerald-600":t<1e3?"text-amber-600":"text-red-600";return e.jsxs("div",{className:"min-h-svh bg-[#fafbfc]",style:{fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:[e.jsx("header",{className:"border-b border-gray-200 bg-white",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-4 sm:py-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(P,{variant:"icon",iconClassName:"w-8 h-8 rounded-lg"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"HelloGrowthCRM Status"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Real-time system status"})]})]}),e.jsxs("button",{onClick:r,disabled:m,className:"flex items-center gap-1.5 text-sm text-gray-600 hover:text-gray-900 border border-gray-200 rounded-lg px-3 py-1.5 hover:bg-gray-50 transition-colors disabled:opacity-50",children:[e.jsx(A,{className:`w-3.5 h-3.5 ${m?"animate-spin":""}`}),"Refresh"]})]})}),e.jsxs("main",{className:"max-w-3xl mx-auto px-3 sm:px-4 py-6 sm:py-8 space-y-4 sm:sp
1ace-y-6",children:[e.jsxs("div",{className:`rounded-xl border p-6 ${k}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{"aria-hidden":"true",className:`status-pulse-dot w-3 h-3 rounded-full ${S} animate-pulse`}),e.jsx("h2",{className:`text-xl font-semibold ${v}`,children:N})]}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 ml-6",children:["Last checked ",j.toLocaleTimeString()," · Auto-refreshes every 60 seconds"]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-100",children:e.jsxs("h3",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),"Current Status by Service"]})}),e.jsx("div",{className:"divide-y divide-gray-100",children:i.map(t=>e.jsxs("div",{className:"px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between hover:bg-gray-50/50 transition-colors gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[I(t.status),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:t.message})]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 shrink-0",children:[t.latency_ms!==null&&e.jsxs("div",{className:`hidden sm:flex items-center gap-1 text-xs ${C(t.latency_ms)}`,children:[e.jsx(R,{className:"w-3 h-3"}),t.latency_ms,"ms"]}),e.jsx("span",{className:`text-[10px] sm:text-xs font-medium px-1.5 sm:px-2 py-0.5 rounded-full border whitespace-nowrap ${_(t.status)}`,children:t.status==="operational"?"Operational":t.status==="degraded"?"Degraded":"Down"})]})]},t.name))})]}),h&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 text-sm text-red-700",children:[e.jsx("strong",{children:"Note:"})," ",h,". The status shown may not be accurate."]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-3",children:"Status Definitions"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-emerald-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-900",children:"Operational"}),e.jsx("p",{className:"text-xs text-gray-500",children:"System working normally"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"w-4 h-4 text-amber-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-900",children:"Degraded"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Slower than expected"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-red-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-900",children:"Down"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Service unavailable"})]})]})]})]}),e.jsxs("footer",{className:"text-center text-xs text-gray-400 py-4",children:[e.jsx("p",{children:"Powered by HelloGrowthCRM · This page auto-refreshes every 60 seconds"}),e.jsx("p",{className:"mt-1",children:"All checks are performed in real-time against production services"})]})]})]})};export{Q as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.