PageSourceSearch

https://knuckl.com/assets/AdminRelay-DX4JPo5C.js

js knuckl.com collected 2026-09-24 14:47:55 UTC 3,610 bytes, 1 lines download raw bytes

1import{u as p,a as x,c as h,j as s}from"./vendor-query-BxlSJxfF.js";import{L as o,r as _,B as c,e as r,s as d}from"./index-DO0aGFYL.js";import{A as f}from"./AdminPage-Bk0BX7la.js";import{I as y}from"./inbox-DKUPAoDr.js";import{M as j}from"./message-square-CLxZQpIa.js";import{L as g}from"./link-2-D-T3A0gX.js";import{C as k}from"./copy-0DH5VK1i.js";import"./vendor-react-DdNhUK9-.js";import"./vendor-supabase-Csx7YFID.js";function R(){const l=p(),[n,a]=x.useState(null),{data:i=[],isLoading:m}=h({queryKey:["admin-unrouted-inbound"],queryFn:async()=>{const{data:e,error:t}=await d.rpc("admin_unrouted_inbound",{_limit:100});if(t)throw t;return e??[]}}),u=async e=>{if(!e.worker_user_id||!e.last_contractor_id)return;a(e.id);const{error:t}=await d.rpc("admin_open_relay_session",{_worker_user_id:e.worker_user_id,_contractor_user_id:e.last_contractor_id});if(a(null),t){r.error(t.message);return}r.success(`Relay session opened with ${e.last_contractor_name??"contractor"}`),l.invalidateQueries({queryKey:["admin-unrouted-inbound"]})};return s.jsx(f,{title:"Relay",subtitle:"Worker texts that arrived with no open conversation",children:m?s.jsx("div",{className:"flex justify-center py-16",children:s.jsx(o,{className:"w-5 h-5 animate-spin text-primary"})}):i.length===0?s.jsxs("div",{className:"text-center py-16",children:[s.jsx("div",{className:"w-14 h-14 rounded-card bg-secondary/60 flex items-center justify-center mx-auto mb-3",children:s.jsx(y,{className:"w-7 h-7 text-muted-foreground/50"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"No unrouted replies. Every text found a thread."})]}):s.jsx("ul",{className:"space-y-2",children:i.map(e=>s.jsxs("li",{className:"rounded-xl border border-border/60 bg-card/60 p-3 flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-sm font-medium text-foreground truncate",children:[e.worker_user_id?e.worker_name||"Unknown worker":e.phone||"Unknown number",e.worker_user_id&&s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:e.phone}),!e.worker_user_id&&s.jsx("span",{className:"ml-2 text-micro uppercase tracking-wide text-muted-foreground",children:"no account"})]}),s.jsxs("p",{className:"mt-1 text-sm text-muted-foreground flex items-start gap-1.5",children:[s.jsx(j,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),s.jsx("span",{className:"line-clamp-3",children:e.body})]}),s.jsxs("p",{className:"mt-1 text-caption text-muted-foreground/70",children:[_(e.received_at),e.worker_user_id?s.jsxs(s.Fragment,{children:[" · ",e.contractor_count," contractor",e.contractor_count===1?"":"s"," invited them",e.last_contractor_name?` · last: ${e.last_contractor_name}`:""]}):" · unknown sender — support signal, reply from the Knuckl line"]})]}),e.worker_user_id?s.jsxs(c,{size:"sm",variant:"outline",className:"shrink-0 gap-1.5",disabled:!e.last_contractor_id||n===e.id,onClick:()=>u(e),title:e.last_contractor_id?"Open a relay session with the last inviting contractor":"No inviting contractor on record",children:[n===e.id?s.jsx(o,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(g,{className:"w-3.5 h-3.5"}),"Open session"]}):s.jsxs(c,{size:"sm",variant:"outline",className:"shrink-0 gap-1.5",disabled:!e.phone,onClick:async()=>{if(e.phone)try{await navigator.clipboard.writeText(e.phone),r.success(`Copied ${e.phone}`)}catch{r.error("Couldn't copy the number")}},title:"Copy the sender's number so you can reply from the Knuckl line",children:[s.jsx(k,{className:"w-3.5 h-3.5"}),"Copy number"]})]},e.id))})})}export{R 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.