PageSourceSearch

https://simplyasking.io/assets/RequestDetailPage-DshctNx1.js

js simplyasking.io collected 2026-09-24 15:04:58 UTC 8,536 bytes, 1 lines download raw bytes

1import{r as p,j as e}from"./vendor-ui-B6LJVmB2.js";import{a as W,u as K,L as U}from"./vendor-react-C26fm6iv.js";import{P as R}from"./PageShell-U4mYLSwO.js";import{P as A}from"./PageHeaderV2-BWKQCVLz.js";import{D as $,a as Y}from"./DecisionRecordTimeline-8hV9nD-Z.js";import{aa as L,dT as F,B as v,a3 as V,aq as M,j as N,I as P,ae as b,u as Q,dU as z,b as H,bI as E,ac as I,a0 as X,dW as C,dX as O}from"./index-R7rnvG6Y.js";import{d as Z,a as G,b as J,u as ee,D as se}from"./useDecisionInbox-C5nFtvVI.js";import"./checkbox-CI_DjiDO.js";import{l as ae,c as te,D as ne,d as ie,u as oe,a as re,b as le,e as ce,f as de}from"./useDecisionMutations-C8Mw1sam.js";import{u as me}from"./usePageTitle-6bWRZ9w6.js";import{b as ue,aK as xe}from"./vendor-icons-rWq2ByuV.js";import"./vendor-query-D2dui6iP.js";import"./vendor-supabase-C_jStVHz.js";import"./vendor-markdown--mR8Btqo.js";import"./PaneSection-CGhwOoIG.js";const he="Say what is missing. Sending it back without a reason leaves them guessing twice.";function pe(t,i){return t?t.toLowerCase().startsWith(i.toLowerCase()):!1}function fe(t){if(!t)return null;const i=t.indexOf(":");if(i===-1)return null;const a=t.slice(i+1).trim();return a===""?null:a}function ge({open:t,onOpenChange:i,request:a,onDecide:w,onSendBack:d,isPending:o=!1}){const[l,j]=p.useState(null),[x,m]=p.useState(""),[f,h]=p.useState(!1),[u,S]=p.useState(""),r=Z(a.options),g=fe(a.recommendation),s=a.options.find(n=>n.key===l),k=`${G(r)} · from ${a.requested_by_name??"a teammate"} · ${L(a.created_at,{addSuffix:!0})}`,D=r===J.APPROVAL&&s?s.key===F.APPROVE?"Approve":"Decline":s?`Decide: ${s.label}`:"Pick an option",_=f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(v,{variant:"ghost",onClick:()=>h(!1),children:"Never mind"}),e.jsx(v,{variant:"primary",disabled:u.trim()===""||o,loading:o,onClick:()=>d(u.trim()),children:"Send it back"})]}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(v,{variant:"ghost",onClick:()=>h(!0),children:"Send back with a note"}),e.jsx(v,{variant:"primary",disabled:!s||o,loading:o,onClick:()=>s&&w(s.key,x.trim()),children:D})]});return e.jsx(V,{open:t,onOpenChange:i,title:a.question,tier:"form",description:a.title,footer:_,children:e.jsxs("div",{className:"flex flex-col gap-3.5",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--gold)"},children:k}),f?e.jsxs(e.Fragment,{children:[e.jsx(M,{value:u,onChange:n=>S(n.target.value),"aria-label":"What is missing",placeholder:"What would you need before you can answer this?",rows:4}),e.jsx("p",{className:"text-xs",style:{color:"var(--platform-text-muted)"},children:he})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2",role:"radiogroup","aria-label":"Your answer",children:a.options.map(n=>{const c=n.key===l,y=pe(a.recommendation,n.label);return e.jsxs("button",{type:"button",role:"radio","aria-checked":c,disabled:o,onClick:()=>j(n.key),className:N("flex items-center gap-3 rounded-[10px] border px-3.5 py-3 text-left",c?"border-[var(--gold)] bg-[var(--gold-rich-8)]":"border-white/10 bg-white/[0.04]"),children:[e.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:"var(--platform-text-primary)"},children:n.label}),e.jsx("span",{className:"text-xs",style:{color:"var(--platform-text-muted)"},children:n.means})]}),y&&e.jsx("span",{className:"ml-auto shrink-0 text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--gold)"},children:"Suggested"})]},n.key)})}),g&&e.jsxs("div",{className:"flex gap-2 rounded-lg border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[e.jsx("span",{className:"shrink-0 text-[11px]",style:{color:"var(--gold)"},children:"Why"}),e.jsx("span",{className:"text-xs leading-relaxed",style:{color:"var(--platform-text-secondary)"},children:g})]}),e.jsx(P,{value:x,onChange:n=>m(n.target.value),"aria-label":"Add a note with your answer",placeholder:`Add a note for ${a.requested_by_name??"them"} (optional)`})]})]})})}const ye="Keep at least two options, and say what each one would mean.";function be({request:t,events:i,onResend:a,onWithdraw:w,isPending:d=!1,className:o}){const[l,j]=p.useState(t.options),[x,m]=p.useState(t.recommendation??""),f=ae(i),h=te(l),u=h.length>=2&&h.length===l.length,S=t.assignee_name??t.assignee_role??"the team";return e.jsxs("div",{className:N(b.card,"flex flex-col gap-4",o),children:[e.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--gold)"},children:["Sent back",t.assignee_name?` · by ${t.assignee_name}`:"",` · ${L(t.updated_at,{addSuffix:!0})}`]}),e.jsx("h2",{className:"text-base font-medium leading-snug",style:{color:"var(--platform-text-primary)"},children:t.question}),f&&e.jsx("blockquote",{className:"rounded-lg px-3 py-2.5 text-xs leading-relaxed",style:{borderLeft:"2px s
1olid var(--gold)",backgroundColor:"rgba(227,206,165,0.06)",color:"var(--platform-text-secondary)"},children:f}),e.jsx(ne,{options:l,onChange:j,addLabel:"Add an option",disabled:d}),e.jsx(P,{value:x,onChange:r=>m(r.target.value),"aria-label":"What you would suggest",placeholder:"What you would suggest (optional)",disabled:d}),!u&&e.jsx("p",{role:"status",className:"text-xs",style:{color:"var(--platform-text-secondary)"},children:ye}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(v,{variant:"ghost",disabled:d,onClick:w,children:"Withdraw"}),e.jsxs(v,{variant:"primary",disabled:!u||d,loading:d,onClick:()=>a(h.map((r,g)=>({key:r.key||ie(r.label,g),label:r.label.trim(),means:r.means.trim()})),x.trim()||null),children:["Resend to ",S]})]})]})}const q=3;function Le(){const{id:t}=W(),i=K(),{data:a,isLoading:w,error:d}=ee(t),{user:o}=Q(),[l,j]=p.useState(!1),[x,m]=p.useState(!1),f=oe(),h=re(),u=le(),S=ce(),r=de();me((a==null?void 0:a.request.title)??"Request");const g=e.jsx("nav",{className:b.breadcrumb,children:e.jsxs(U,{to:E(C,O),className:b.breadcrumbLink,children:[e.jsx(xe,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:"Requests"})]})});if(w)return e.jsx(R,{children:e.jsx("div",{className:N(b.platformPage,"flex flex-col gap-8"),children:e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(ue,{className:"h-5 w-5 animate-spin",style:{color:"var(--gold)"},"aria-label":"Loading this request"})})})});if(d||!a)return e.jsx(R,{children:e.jsx("div",{className:N(b.platformPage,"flex flex-col gap-8"),children:e.jsx(A,{title:"We could not find that request",subtitle:"It may have been withdrawn, or it may not be yours to see.",leftContent:g})})});const{request:s,events:k}=a,D=s.requested_by===(o==null?void 0:o.id),_=s.status===z.SENT_BACK,n=async(c,y,B)=>{j(!0);try{await c(),I({title:y,variant:"success"})}catch(T){X(I,T,B)}finally{j(!1)}};return e.jsx(R,{children:e.jsxs("div",{className:N(b.platformPage,"flex flex-col gap-8"),children:[e.jsx(A,{title:s.title,subtitle:s.due_at?`Needs an answer by ${H(s.due_at,"MMM d, yyyy")}`:"Waiting on an answer",leftContent:g}),e.jsx("div",{className:"border-t border-[rgba(197,160,90,0.25)]"}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex flex-col gap-6",children:[_&&D?e.jsx(be,{request:s,events:k,isPending:l,onResend:(c,y)=>void n(()=>r.mutateAsync({requestId:s.id,options:c,recommendation:y}),"Sent back to them","resending this request"),onWithdraw:()=>void n(async()=>{await u.mutateAsync({requestId:s.id}),i(E(C,O))},"Request withdrawn","withdrawing this request")}):e.jsx(se,{request:s,density:"full",isPending:l,onDecide:()=>m(!0),onSendBack:()=>m(!0),onDefer:()=>void n(()=>h.mutateAsync({requestId:s.id,until:new Date(Date.now()+q*24*60*60*1e3).toISOString()}),`Snoozed for ${q} days`,"snoozing this request"),onWithdraw:()=>void n(async()=>{await u.mutateAsync({requestId:s.id}),i(E(C,O))},"Request withdrawn","withdrawing this request")}),x&&e.jsx(ge,{open:x,onOpenChange:m,request:s,isPending:l,onDecide:(c,y)=>void n(async()=>{await f.mutateAsync({requestId:s.id,optionKey:c,note:y}),m(!1)},"Answer recorded","recording your answer"),onSendBack:c=>void n(async()=>{await S.mutateAsync({requestId:s.id,note:c}),m(!1)},"Sent back with your note","sending this request back")}),e.jsxs("div",{children:[e.jsx("h2",{className:b.sectionTitle,children:"What has happened"}),e.jsx($,{events:k})]})]}),e.jsx(Y,{context:s.context})]})]})})}export{Le 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.