import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{i as u}from"./index-BZu5zewH.js";import{e as p}from"./useEventHooks-CPxcH6zx.js";import{P as b}from"./PageHeader-CR6TpJG_.js";import{S as n}from"./StatCard-DlgF0CJC.js";import{c as j}from"./vendor-react-CXumBFUA.js";import"./vendor-icons-CrrAvF2g.js";const v=[{label:"1h",value:"1h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"},{label:"30d",value:"30d"}];function c({value:i,colorClass:r,onClick:o}){return i===0?e.jsx("span",{className:"text-text-tertiary",children:"0"}):e.jsx("button",{onClick:o,className:`${r} hover:underline tabular-nums font-medium`,children:i})}function $(){var d,x;p();const i=j(),[r,o]=m.useState("24h"),{data:s}=u(r),l=t=>{const h=new URLSearchParams(t).toString();i(`/escalations/available${h?`?${h}`:""}`)},a="pb-2 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary";return e.jsxs("div",{children:[e.jsx(b,{title:"Escalations",docsHash:"#docs:dashboard.md:escalations-overview"}),e.jsx("div",{className:"flex items-center gap-1 mb-6",children:v.map(t=>e.jsx("button",{onClick:()=>o(t.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${r===t.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:t.label},t.value))}),e.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[e.jsx(n,{label:"Open",value:(s==null?void 0:s.pending)??"—",colorClass:"text-status-pending",onClick:()=>l()}),e.jsx(n,{label:"Claimed",value:(s==null?void 0:s.claimed)??"—",colorClass:"text-status-active",onClick:()=>l()}),e.jsx(n,{label:"Created",value:(s==null?void 0:s.created)??"—",onClick:()=>l()}),e.jsx(n,{label:"Resolved",value:(s==null?void 0:s.resolved)??"—",colorClass:"text-status-success",onClick:()=>l()})]}),(((d=s==null?void 0:s.by_role)==null?void 0:d.length)??0)>0&&e.jsx("div",{className:"mb-8",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-surface-border",children:[e.jsx("th",{className:a,children:"Role"}),e.jsx("th",{className:`${a} text-right w-24`,children:"Pending"}),e.jsx("th",{className:`${a} text-right w-24`,children:"Claimed"})]})}),e.jsx("tbody",{children:s.by_role.map(t=>e.jsxs("tr",{className:"border-b border-surface-border last:border-b-0",children:[e.jsx("td",{className:"py-3 text-sm font-mono text-text-primary",children:e.jsx("button",{onClick:()=>l({role:t.role}),className:"hover:text-accent hover:underline",children:t.role})}),e.jsx("td",{className:"py-3 text-sm text-right",children:e.jsx(c,{value:t.pending,colorClass:"text-status-pending",onClick:()=>l({role:t.role})})}),e.jsx("td",{className:"py-3 text-sm text-right",children:e.jsx(c,{value:t.claimed,colorClass:"text-status-active",onClick:()=>l({role:t.role})})})]},t.role))})]})}),(((x=s==null?void 0:s.by_type)==null?void 0:x.length)??0)>0&&e.jsx("div",{children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-surface-border",children:[e.jsx("th",{className:a,children:"Type"}),e.jsx("th",{className:`${a} text-right w-24`,children:"Pending"}),e.jsx("th",{className:`${a} text-right w-24`,children:"Claimed"}),e.jsx("th",{className:`${a} text-right w-24`,children:"Resolved"})]})}),e.jsx("tbody",{children:s.by_type.map(t=>e.jsxs("tr",{className:"border-b border-surface-border last:border-b-0",children:[e.jsx("td",{className:"py-3 text-sm font-mono text-text-primary",children:e.jsx("button",{onClick:()=>l({type:t.type}),className:"hover:text-accent hover:underline",children:t.type})}),e.jsx("td",{className:"py-3 text-sm text-right",children:e.jsx(c,{value:t.pending,colorClass:"text-status-pending",onClick:()=>l({type:t.type})})}),e.jsx("td",{className:"py-3 text-sm text-right",children:e.jsx(c,{value:t.claimed,colorClass:"text-status-active",onClick:()=>l({type:t.type})})}),e.jsx("td",{className:"py-3 text-sm text-right",children:e.jsx(c,{value:t.resolved,colorClass:"text-status-success",onClick:()=>l({type:t.type})})})]},t.type))})]})}),s&&s.by_role.length===0&&s.by_type.length===0&&e.jsx("div",{className:"py-16 text-center",children:e.jsxs("p",{className:"text-sm text-text-tertiary",children:["No escalation activity in the last ",r]})})]})}export{$ as EscalationsOverview};
//# sourceMappingURL=EscalationsOverview-BfSrQ7A5.js.map
