1import{f as E,r as l,x as B,j as e,S as D,B as j,e as R,a8 as c,z as A}from"./index-c7-_Q3Vy.js";import{P as H,K as h}from"./PanelShell-Bja85FKV.js";import{S as L}from"./SectionCard-SgorG8QP.js";import{B as P}from"./badge-CkQui-AV.js";import{C as k}from"./circle-check-C-lEUFe_.js";import{C as N}from"./circle-alert-DtZuFfBQ.js";import{C as y}from"./circle-minus-CxXQPXIF.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const w=E("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]),T={verified:{label:"Verified",badge:"bg-emerald-50 text-emerald-800 border border-emerald-300",icon:k,rail:"bg-emerald-500"},broken:{label:"Broken",badge:"bg-red-50 text-red-800 border border-red-300",icon:N,rail:"bg-red-500"},not_verified:{label:"Not yet verified",badge:"bg-slate-100 text-slate-700 border border-slate-300",icon:w,rail:"bg-slate-300"},not_applicable:{label:"Not in use",badge:"bg-slate-50 text-slate-500 border border-slate-200",icon:y,rail:"bg-slate-200"}};function O(){const[n,_]=l.useState([]),[b,u]=l.useState(!0),[x,p]=l.useState([]),[g,v]=l.useState(null),f=l.useCallback(async()=>{u(!0);const{data:t,error:s}=await B.from("platform_health_checks").select("*").order("group_key",{ascending:!0}).order("sort_order",{ascending:!0});s?v(s.message):(v(null),_(t??[])),u(!1)},[]);l.useEffect(()=>{f()},[f]);const d=l.useMemo(()=>{const t=new Map;for(const s of n){const r=t.get(s.group_key);r?r.items.push(s):t.set(s.group_key,{label:s.group_label,items:[s]})}return Array.from(t.entries()).map(([s,r])=>({key:s,...r})).sort((s,r)=>Number(s.key.replace(/\D/g,"")||0)-Number(r.key.replace(/\D/g,"")||0))},[n]);l.useEffect(()=>{if(d.length&&x.length===0){const t=d.find(s=>s.items.some(r=>r.status==="broken"||r.status==="not_verified"));p([t?.key??d[0].key])}},[d,x.length]);const i=l.useMemo(()=>{const t={verified:0,broken:0,not_verified:0,not_applicable:0};for(const s of n)t[s.status]+=1;return t},[n]),C=t=>p(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t]);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(H,{title:"Platform Health",subtitle:"Every job a real person does on this platform, and whether it has been proven to work end to end with real data. Nothing here says 'should work'.",icon:D,action:e.jsxs(j,{variant:"outline",onClick:()=>void f(),className:"border-white/30 bg-white/10 text-white hover:bg-white/20 hover:text-white",children:[e.jsx(R,{className:c("mr-2 h-4 w-4",b&&"animate-spin")}),"Refresh"]})}),g&&e.jsxs("div",{className:"rounded-xl border border-red-300 bg-red-50 px-5 py-4 text-sm text-red-800",children:["Could not load the report: ",g]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(h,{label:"Verified",value:String(i.verified),tone:"positive",hint:"Run end to end, evidence recorded",icon:k}),e.jsx(h,{label:"Broken",value:String(i.broken),tone:i.broken>0?"negative":"default",hint:"Failing, fix and retest recorded below",icon:N}),e.jsx(h,{label:"Not yet verified",value:String(i.not_verified),tone:i.not_verified>0?"warning":"default",hint:"Still to be tested",icon:w}),e.jsx(h,{label:"Not in use",value:String(i.not_applicable),hint:"Confirmed out of scope",icon:y})]}),b&&n.length===0&&e.jsx("div",{className:"h-64 animate-pulse rounded-xl bg-slate-200/60","aria-hidden":!0}),d.map(t=>{const s=x.includes(t.key),r=t.items.filter(a=>a.status==="verified").length,m=t.items.filter(a=>a.status==="broken").length,S=m>0?"red":r===t.items.length?"green":"navy";return e.jsx(L,{title:t.label,tone:S,description:`${r} of ${t.items.length} verified${m>0?`, ${m} broken`:""}`,action:e.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>C(t.key),children:[e.jsx(A,{className:c("h-4 w-4 transition-transform",!s&&"-rotate-90")}),e.jsx("span",{className:"ml-1.5",children:s?"Hide":"Show"})]}),bodyClassName:s?void 0:"hidden",children:e.jsx("ul",{className:"space-y-3",children:t.items.map(a=>{const o=T[a.status],M=o.icon;return e.jsxs("li",{className:"relative overflow-hidden rounded-lg border border-slate-200 bg-white pl-4 pr-4 py-3",children:[e.jsx("span",{className:c("absolute inset-y-0 left-0 w-1",o.rail),"aria-hidden":!0}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 shrink-0 text-slate-400"}),e.jsx("span",{className:"font-semibold text-sm text-revlift-navy",children:a.title})]}),a.intent&&e.jsx("p",{className:"mt-1 text-xs text-slate-500 pl-6",children:a.intent})]}
6),e.jsx(P,{className:c("rounded-md shrink-0",o.badge),children:o.label})]}),(a.evidence||a.failure_detail||a.fix_detail||a.retest_result)&&e.jsxs("dl",{className:"mt-3 space-y-2 pl-6 text-xs",children:[a.failure_detail&&e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold text-red-700",children:"What fails"}),e.jsx("dd",{className:"text-slate-600",children:a.failure_detail})]}),a.fix_detail&&e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold text-slate-700",children:"Fix applied"}),e.jsx("dd",{className:"text-slate-600",children:a.fix_detail})]}),a.retest_result&&e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold text-slate-700",children:"Retest"}),e.jsx("dd",{className:"text-slate-600",children:a.retest_result})]}),a.evidence&&e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold text-emerald-700",children:"Evidence"}),e.jsx("dd",{className:"text-slate-600",children:a.evidence})]}),a.verified_at&&e.jsxs("div",{className:"text-slate-400",children:["Last checked ",new Date(a.verified_at).toLocaleString()]})]})]},a.id)})})},t.key)})]})}export{O 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.