@snagset/server 0.1.42 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +35 -2
- package/dist/app.js.map +1 -1
- package/dist/db/migrations/0015_site_archive.sql +15 -0
- package/dist/holds.js +29 -0
- package/dist/holds.js.map +1 -0
- package/dist/mail/smtp.js +17 -7
- package/dist/mail/smtp.js.map +1 -1
- package/dist/plan.js +2 -2
- package/dist/plan.js.map +1 -1
- package/dist/projectCache.js +1 -1
- package/dist/projectCache.js.map +1 -1
- package/dist/routes/bodyLimit.js +13 -11
- package/dist/routes/bodyLimit.js.map +1 -1
- package/dist/routes/comments.js +7 -0
- package/dist/routes/comments.js.map +1 -1
- package/dist/routes/owner.js +8 -4
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/sites.js +46 -0
- package/dist/routes/sites.js.map +1 -1
- package/dist/routes/threads.js +6 -3
- package/dist/routes/threads.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-LCGvVtac.js → CompositeItem-DqkA27tC.js} +1 -1
- package/static/dashboard/assets/{CompositeList-Cty0rzq_.js → CompositeList-DrnyFTB0.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-DIwxuqY9.js → ConfirmDialog-CLal40kk.js} +1 -1
- package/static/dashboard/assets/{CopyButton-DDGcA3Xd.js → CopyButton-D_EAOrl1.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-EmJLiYBJ.js → FieldItemContext-Dvh77l6C.js} +1 -1
- package/static/dashboard/assets/{InstallTag-DnVvf8zx.js → InstallTag-Cld-E0Bc.js} +1 -1
- package/static/dashboard/assets/InstanceRows-DexbQngM.js +1 -0
- package/static/dashboard/assets/{McpTokens-C6CW9eYK.js → McpTokens-CIjBwfT0.js} +1 -1
- package/static/dashboard/assets/{SaveState-R4390int.js → SaveState-BiYh2KgZ.js} +1 -1
- package/static/dashboard/assets/{_app-DaKVP1n8.js → _app-BSxQmm69.js} +2 -2
- package/static/dashboard/assets/{_app-CAb1BtpQ.js → _app-CrFQJNrf.js} +1 -1
- package/static/dashboard/assets/activity-BUIv_tqh.js +1 -0
- package/static/dashboard/assets/{arrow-left-6KOxG0mI.js → arrow-left-B6jSSfnu.js} +1 -1
- package/static/dashboard/assets/{avatar-BHXI3Cxz.js → avatar-CPcL_-iV.js} +1 -1
- package/static/dashboard/assets/{badge-BVeGUvW4.js → badge-DBzqpvfR.js} +1 -1
- package/static/dashboard/assets/{card-CQykn6b-.js → card-B5svGaqA.js} +1 -1
- package/static/dashboard/assets/{check-C5gLbOCB.js → check-C21x2mpF.js} +1 -1
- package/static/dashboard/assets/{chevron-down-CNIHPCcw.js → chevron-down-qCyXHfGI.js} +1 -1
- package/static/dashboard/assets/{chevron-right-voH028MP.js → chevron-right-ZLZCd12m.js} +1 -1
- package/static/dashboard/assets/{copy-2WiQI5_8.js → copy-Bik19B-3.js} +1 -1
- package/static/dashboard/assets/{dialog-I_D8p4LG.js → dialog-qbXy4GE2.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-BD3iKpyK.js → dropdown-menu-_DGLxfga.js} +1 -1
- package/static/dashboard/assets/{forgot-Buk2U0Iq.js → forgot-BJwCHsE9.js} +1 -1
- package/static/dashboard/assets/{image-off-pz0vPmjw.js → image-off-DkzQHm8a.js} +1 -1
- package/static/dashboard/assets/{index-DGJgBiEe.js → index-CHi2CcHb.js} +20 -20
- package/static/dashboard/assets/index-Ie8QH3El.css +1 -0
- package/static/dashboard/assets/{invite-8sNxyTpF.js → invite-BRZIE9ij.js} +1 -1
- package/static/dashboard/assets/{label-ClUOe0Qf.js → label-Dff2Zjcb.js} +1 -1
- package/static/dashboard/assets/labels--UUyt9uB.js +1 -0
- package/static/dashboard/assets/{layout-grid-DLRb1zmb.js → layout-grid-C3Koxvvp.js} +1 -1
- package/static/dashboard/assets/me-XTwFHhR6.js +1 -0
- package/static/dashboard/assets/{parts-CeW0gqpG.js → parts-CK9SS76R.js} +1 -1
- package/static/dashboard/assets/{plus-DMA0pE49.js → plus-4APMJ4TC.js} +1 -1
- package/static/dashboard/assets/{reset-citpUr97.js → reset-BakGFWJY.js} +1 -1
- package/static/dashboard/assets/s._site-z1oyWNQY.js +1 -0
- package/static/dashboard/assets/{s._site.comments-CupTJMag.js → s._site.comments-C3V2hEnX.js} +2 -2
- package/static/dashboard/assets/s._site.reviewers-BWO0DRhU.js +1 -0
- package/static/dashboard/assets/s._site.settings-Brm50esb.js +1 -0
- package/static/dashboard/assets/{setup-otr5LUWS.js → setup-B1bevXbJ.js} +1 -1
- package/static/dashboard/assets/{sign-in-BRpUPHbi.js → sign-in-DxO2Kh8j.js} +1 -1
- package/static/dashboard/assets/{sign-up-sC_IfvbO.js → sign-up-B8c2f4uf.js} +1 -1
- package/static/dashboard/assets/sites-BzBdEUAz.js +1 -0
- package/static/dashboard/assets/{studio-B02T4EY4.js → studio-BtXg0XzE.js} +1 -1
- package/static/dashboard/assets/studio-CD5SiuzI.js +1 -0
- package/static/dashboard/assets/studio.index-r91Elth-.js +1 -0
- package/static/dashboard/assets/studio.integrations-Df0aQQaP.js +1 -0
- package/static/dashboard/assets/{studio.members-CWZNCLCY.js → studio.members-BAJ3beQC.js} +2 -2
- package/static/dashboard/assets/studio.plan-CcdSeq5g.js +1 -0
- package/static/dashboard/assets/{sun-CgLdWf2g.js → sun-BwWiB8wj.js} +1 -1
- package/static/dashboard/assets/{switch-BZw_bqWh.js → switch-b0ERMUSk.js} +1 -1
- package/static/dashboard/assets/{table-t_7248Aq.js → table-HuNaCQBJ.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-BSClfAH5.js → useAriaLabelledBy-B3107P7l.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-BzwsA17g.js → useBaseQuery-DI4GfUK8.js} +1 -1
- package/static/dashboard/assets/useQuery-U2FOgJPB.js +1 -0
- package/static/dashboard/assets/useRender-B8Yivtih.js +1 -0
- package/static/dashboard/assets/{useValueChanged-CEh0b15T.js → useValueChanged-RTamjQR3.js} +1 -1
- package/static/dashboard/assets/{users-DLfPGZtA.js → users--4QPa7AS.js} +1 -1
- package/static/dashboard/assets/{welcome-qvhXOg78.js → welcome-UZyMZNzL.js} +1 -1
- package/static/dashboard/assets/{widget-signin-CB_pBDz0.js → widget-signin-DXyh_-_V.js} +1 -1
- package/static/dashboard/assets/you-DSHNqgeU.js +1 -0
- package/static/dashboard/assets/{zod-DrXRVGy0.js → zod-dogyqr67.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/dashboard/assets/InstanceRows-376JOINE.js +0 -1
- package/static/dashboard/assets/activity-rK4Sf6B2.js +0 -1
- package/static/dashboard/assets/index-CoiIx5MR.css +0 -1
- package/static/dashboard/assets/labels-ToSuNGQl.js +0 -1
- package/static/dashboard/assets/s._site-BVRYrqWc.js +0 -1
- package/static/dashboard/assets/s._site.reviewers-CgBIszUX.js +0 -1
- package/static/dashboard/assets/s._site.settings-CEuj_wJ1.js +0 -1
- package/static/dashboard/assets/sites-D52Ciw1e.js +0 -1
- package/static/dashboard/assets/studio-0_bXXp2K.js +0 -1
- package/static/dashboard/assets/studio.index-gCE2490t.js +0 -1
- package/static/dashboard/assets/studio.integrations-BrvDZjmR.js +0 -1
- package/static/dashboard/assets/studio.plan-Bwz6dizT.js +0 -1
- package/static/dashboard/assets/useQuery-dbNRhTlt.js +0 -1
- package/static/dashboard/assets/useRender-BJVEua-j.js +0 -1
- package/static/dashboard/assets/you-0VVZ27jc.js +0 -1
package/static/dashboard/assets/{s._site.comments-CupTJMag.js → s._site.comments-C3V2hEnX.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as re,r as x,i as Is,
|
|
1
|
+
import{c as re,r as x,i as Is,a9 as Bs,ac as Ps,e as Qe,ak as Xe,ab as _s,m as Fs,E as Ls,k as os,j as e,al as Os,g as Vs,h as A,B as $,am as is,an as qs,a7 as Ze,ao as Ye,a6 as ls,C as Us,ap as es,p as Ks,aq as Hs,ar as ss,as as Ws,at as Gs,au as Js,av as Qs,aw as Xs,ax as Zs,ay as Ys,az as et,aA as st,aB as tt,q as Re,aC as Ne,L as ds,D as nt,ag as ts,F as pe,aD as at,A as Te}from"./index-CHi2CcHb.js";import{u as we}from"./useQuery-U2FOgJPB.js";import{C as cs}from"./check-C21x2mpF.js";import{q as rt,f as ot,h as it,p as lt,u as ns,k as dt,l as ct,c as ut,n as mt,L as Ke,I as Be}from"./label-Dff2Zjcb.js";import{Q as ht,S as xt,N as pt,A as ft,a2 as gt,E as us,G as ms,I as hs,H as xs,J as ps,K as fs,X as bt}from"./dialog-qbXy4GE2.js";import{u as jt}from"./FieldItemContext-Dvh77l6C.js";import{u as vt}from"./useAriaLabelledBy-B3107P7l.js";import{u as yt}from"./useValueChanged-RTamjQR3.js";import{D as te,e as ne,f as ae,h as he,i as $e,j as H,k as gs,E as as,l as Ee,m as J,S as kt}from"./dropdown-menu-_DGLxfga.js";import{A as fe,b as ge}from"./avatar-CPcL_-iV.js";import{C as bs}from"./ConfirmDialog-CLal40kk.js";import{b as He,S as js,E as qe}from"./parts-CK9SS76R.js";import{C as Ce}from"./chevron-down-qCyXHfGI.js";import{S as be,i as Nt,b as Pe,c as Ie,a as Me}from"./labels--UUyt9uB.js";import{C as wt}from"./copy-Bik19B-3.js";import{I as Ct}from"./image-off-DkzQHm8a.js";import{C as St}from"./chevron-right-ZLZCd12m.js";import{I as $t}from"./InstallTag-Cld-E0Bc.js";import{u as Mt}from"./me-XTwFHhR6.js";import{A as At}from"./arrow-left-B6jSSfnu.js";import"./useBaseQuery-DI4GfUK8.js";import"./CompositeList-DrnyFTB0.js";import"./CompositeItem-DqkA27tC.js";import"./card-B5svGaqA.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -46,4 +46,4 @@ import{c as re,r as x,i as Is,a8 as Bs,ab as Ps,e as Qe,aj as Xe,aa as _s,m as F
|
|
|
46
46
|
*/const Kt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Ht=re("user-round",Kt);function Wt(s){if(!s)return null;for(const n of s.elements){const r=n.tagName;if(r==="BUTTON"||r==="INPUT"){const o=n;if(o.type==="submit")return o}}return null}function ys(s){return{checked(n){return s.indeterminate?{}:n?{"data-checked":""}:{"data-unchecked":""}},...rt}}const Gt=x.createContext(void 0);function Jt(){return x.useContext(Gt)}const ks=x.createContext(void 0);function Qt(){const s=x.useContext(ks);if(s===void 0)throw new Error(Is(14));return s}const Xt="data-parent",Zt=x.forwardRef(function(n,r){const{checked:o,className:p,defaultChecked:l=!1,"aria-labelledby":d,disabled:y=!1,form:m,id:h,indeterminate:g=!1,inputRef:f,name:c,onCheckedChange:N,parent:a=!1,readOnly:w=!1,render:B,required:k=!1,uncheckedValue:b,value:R,nativeButton:T=!1,style:V,...M}=n,{clearErrors:v}=ot(),{disabled:D,name:Q,setDirty:q,setFilled:U,setFocused:C,setTouched:E,state:L,validationMode:je,validityData:oe,validation:F}=it(),ve=jt(),{labelId:u,controlId:O,registerControlId:z,getDescriptionProps:Ae}=lt(),I=Jt(),W=I?.allValues===void 0?void 0:I.parent,ie=W!==void 0,P=D||ve.disabled||I?.disabled||y,X=Q??c,_=R??X,De=ns(),Z=ns();let G=h||O;ie&&(a?G=Z:_!==void 0?G=`${W.id}-${_}`:G||=Z);let t={};ie&&(a?t=W.getParentProps():_!==void 0&&(t=W.getChildProps(_)));const{checked:i=o,indeterminate:S=g,onCheckedChange:Y,...le}=t,ee=I?.value,de=x.useRef(null),xe=Bs(()=>Symbol()),_e=x.useRef(!1),{getButtonProps:Ss,buttonRef:$s}=Ps({disabled:P,native:T}),ye=I?.validation??F,[K,Ms]=dt({controlled:_!==void 0&&ee!==void 0&&!a?ee.includes(_):i,default:l,name:"Checkbox",state:"checked"}),Fe=ie?!!i:K,ke=ie&&S||g;Qe(()=>{z!==Xe&&(_e.current=!0,z(xe.current,G))},[G,z,xe]),x.useEffect(()=>{const j=xe.current;return()=>{!_e.current||z===Xe||(_e.current=!1,z(j,void 0))}},[z,xe]),ct(de,De,K,void 0,!I&&!P,c);const ce=x.useRef(null),Ge=ye.registerInput,Je=I?_:void 0,As=x.useCallback(j=>Ge(j,{controlRef:de,value:Je}),[Ge,Je]),Ds=_s(f,ce,a?void 0:As),zs=vt(d,u,ce,!T,G??void 0);Qe(()=>{ce.current&&(ce.current.indeterminate=ke,K&&U(!0))},[K,ke,U]),yt(K,()=>{I||(v(X),U(K),q(K!==oe.initialValue),ye.change(K))});const Rs=Fs({checked:K,disabled:P,form:m,name:a?void 0:X,id:T?void 0:G??void 0,required:k,ref:Ds,style:X?ht:xt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(j){if(j.nativeEvent.defaultPrevented)return;if(w){j.preventDefault();return}const se=j.currentTarget.checked,ue=ut(mt,j.nativeEvent);if(N?.(se,ue),!ue.isCanceled&&(Y?.(se,ue),!ue.isCanceled&&(Ms(se),_!==void 0&&I!==void 0&&!a&&!ie))){const me=se?[...I.value,_]:I.value.filter(ze=>ze!==_);I.setValue(me,ue)}},onClick(j){j.stopPropagation()},onFocus(){de.current?.focus()}},R!==void 0?{value:(I?K&&R:R)||""}:Ls,Ae,j=>ye.getValidationProps(P,j));x.useEffect(()=>{if(!W||_===void 0)return;const j=W.disabledStatesRef.current;return j.set(_,P),()=>{j.delete(_)}},[W,P,_]);const Le=x.useMemo(()=>({...L,checked:Fe,disabled:P,readOnly:w,required:k,indeterminate:ke}),[L,Fe,P,w,k,ke]),Ts=ys(Le),Es=os("span",n,{state:Le,ref:[$s,de,r],props:[{id:T?G??void 0:De,role:"checkbox","aria-checked":ke?"mixed":Fe,"aria-readonly":w||void 0,"aria-required":k||void 0,"aria-labelledby":zs,[Xt]:a?"":void 0,onFocus(){P||C(!0)},onBlur(){const j=ce.current;j&&(E(!0),C(!1),je==="onBlur"&&ye.commit(I?ee:j.checked))},onKeyDown(j){if(j.key!=="Enter"||(j.preventBaseUIHandler(),j.defaultPrevented))return;const se=ce.current?.form??null,ue=j.currentTarget,me=j.nativeEvent,ze=j.preventDefault,Oe=me.preventDefault;let Ve=!1;j.preventDefault=()=>{Ve=!0,ze.call(j)},me.preventDefault=()=>{Ve=!0,Oe.call(me)},Oe.call(me),Vs(ue).queueMicrotask(()=>{j.preventDefault=ze,me.preventDefault=Oe,Ve||Wt(se)?.click()})},onClick(j){if(w||P)return;j.preventDefault();const se=ce.current;se&&Os(se,j)}},M,le,Ss,Ae,j=>ye.getValidationProps(P,j)],stateAttributesMapping:Ts});return e.jsxs(ks.Provider,{value:Le,children:[Es,!K&&!I&&X&&!a&&b!==void 0&&e.jsx("input",{type:"hidden",form:m,name:X,value:b,disabled:P}),e.jsx("input",{...Rs,suppressHydrationWarning:!0})]})}),Yt=x.forwardRef(function(n,r){const{render:o,className:p,style:l,keepMounted:d=!1,...y}=n,m=Qt(),h=m.checked||m.indeterminate,{mounted:g,transitionStatus:f,setMounted:c}=pt(h),N=x.useRef(null),a={...m,transitionStatus:f};ft({open:h,ref:N,onComplete(){h||c(!1)}});const B={...ys(m),...gt},k=d||g,b=os("span",n,{ref:[r,N],state:a,stateAttributesMapping:B,props:y});return k?b:null});function en({className:s,...n}){return e.jsx(Zt,{"data-slot":"checkbox",className:A("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...n,children:e.jsx(Yt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(cs,{})})})}function Ns({className:s,...n}){return e.jsx("textarea",{"data-slot":"textarea",className:A("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",s),...n})}function sn({rounds:s,active:n,onPick:r,onStart:o,starting:p}){const l=s.find(f=>f.number===n),d=(s[0]?.number??0)+1,[y,m]=x.useState(!1),[h,g]=x.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(Ot,{className:"size-3.5"}),l?.name??`Round ${n}`,e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsxs(ae,{align:"start",className:"w-[260px]",children:[e.jsxs(he,{children:[e.jsx($e,{children:"Rounds"}),s.map(f=>e.jsxs(H,{onClick:()=>r(f.number),children:[e.jsx("span",{className:"truncate",children:f.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[f.closed?"closed":"open",f.unresolved>0?` · ${f.unresolved} to go`:""]})]},f.id))]}),e.jsx(gs,{}),e.jsx(H,{onClick:()=>{g(`Round ${d}`),m(!0)},children:"Start a new round…"})]})]}),l&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[l.closed?"closed":"open",l.unresolved>0?` · ${l.unresolved} to go`:l.closed?"":" · all clear"]}),e.jsx(us,{open:y,onOpenChange:m,children:e.jsx(ms,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:f=>{f.preventDefault(),!(!h.trim()||p)&&(o(h.trim()),m(!1))},children:[e.jsxs(hs,{children:[e.jsx(xs,{children:"Start a new round"}),e.jsx(ps,{children:"A round is one pass of feedback, and it runs beside the others: starting one closes none of them. Reviewers pick a round in the widget and their comments go to it. Close or archive rounds in Settings."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ke,{htmlFor:"round-name",children:"Name"}),e.jsx(Be,{id:"round-name",value:h,onChange:f=>g(f.target.value),autoFocus:!0})]}),e.jsxs(fs,{children:[e.jsx($,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsx($,{type:"submit",disabled:!h.trim()||p,children:p?"Starting…":"Start the round"})]})]})})})]})}function ws({rounds:s,onMove:n,busy:r}){return s.length===0?null:e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx($,{variant:"outline",size:"sm",disabled:r}),children:"Move to round…"}),e.jsx(ae,{align:"start",className:"w-[240px]",children:e.jsxs(he,{children:[e.jsx($e,{children:"Move to round"}),s.map(o=>e.jsxs(H,{onClick:()=>n(o.number),children:[e.jsx("span",{className:"truncate",children:o.name}),e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:o.closed?"closed":"open"})]},o.id))]})})]})}const tn={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function nn(s,n,r={}){const o=r.fence??((v,D)=>D),p=r.statusLabel??(v=>tn[v]??v),l=s.anchor??{},d=s.context??{},y=l.page,m=y?.route??s.route??"/",h=y?.origin??n.origin??"",g=y?.pathname??m,f=h?`${h}${g}`:g,c=typeof l.label=="string"?o("label",l.label):"",N=l.element??l,a=[];a.push(`# ${s.key}${c?` — ${c}`:""}`),a.push(""),a.push(`${n.name} · ${p(s.status)} · left by ${s.createdBy?.name?o("name",s.createdBy.name):"someone"} on ${s.createdAt.slice(0,10)}`+(s.assignee?` · assigned to ${o("name",s.assignee.name)}`:"")),a.push(""),a.push("## Where to look"),a.push(""),a.push(`- Page: ${f}`),h&&a.push(`- Open on the page: ${h}${g}?${is("t")}=${encodeURIComponent(s.key)}`),c&&a.push(`- Element: ${c}`);const w=typeof l.css=="string"?l.css:typeof N.selector=="string"?N.selector:"";if(w&&a.push(`- Selector: \`${o("selector",w)}\``),typeof l.domid=="string"&&a.push(`- DOM id: \`#${o("selector",l.domid)}\``),typeof N.role=="string"){const v=typeof N.accessibleName=="string"?` “${o("label",N.accessibleName)}”`:"";a.push(`- Role: ${o("label",N.role)}${v}`)}typeof N.testId=="string"&&a.push(`- Test id: ${o("label",N.testId)}`);const B=l.text;B?.exact&&a.push(`- Text: “${o("label",B.exact)}”`),a.push(`- Anchor: ${s.anchorState??"unknown"}`),a.push(""),a.push("## What's wrong"),a.push("");const k=(s.comments??[]).filter(v=>v.body!==null);k.length===0&&a.push("> (no comment — a pin with no words)");for(const v of k){const D=v.author?.name?o("name",v.author.name):"Anonymous";a.push(`> **${D}${v.author?.kind==="agent"?" (agent)":""}** — ${v.createdAt.slice(0,16).replace("T"," ")}`);for(const Q of o("body",String(v.body)).split(`
|
|
47
47
|
`))a.push(`> ${Q}`);a.push(">")}a[a.length-1]===">"&&a.pop(),a.push(""),a.push("## Environment"),a.push("");const b=d.derived,R=d.viewport;(b?.browser||b?.os)&&a.push(`- Browser: ${[b.browser,b.os,b.device].filter(Boolean).join(" · ")}`),R?.w&&a.push(`- Viewport: ${R.w} × ${R.h}${R.dpr?` @${Math.round(R.dpr*10)/10}x`:""}`),d.prefersColorScheme&&a.push(`- Colour scheme: ${d.prefersColorScheme}`),d.language&&a.push(`- Language: ${d.language}`),d.ua&&a.push(`- User agent: ${o("label",String(d.ua))}`);const T=d.build;T&&Object.keys(T).length&&a.push(`- Build: ${Object.entries(T).map(([v,D])=>`${v}=${o("label",String(D))}`).join(", ")}`),a.push("");const V=d.breadcrumbs;if(V?.length){a.push(`## Breadcrumbs (${V.length}, oldest first)`),a.push("");for(const v of V)a.push(`- \`${String(v.t).slice(11,19)}\` ${v.type}${v.level?`/${v.level}`:""}: ${o("breadcrumb",String(v.message))}`);a.push("")}const M=s.attachments?.find(v=>v.kind==="screenshot")??s.attachments?.[0];if(M){a.push("## Screenshot"),a.push(""),a.push("Examine this screenshot for visual context — it is the viewport at the moment of the click."),a.push("");const v=M.url.startsWith("http")?M.url:`${n.dashboardOrigin??""}${M.url}`;a.push(``),a.push("")}return a.join(`
|
|
48
48
|
`).trimEnd()+`
|
|
49
|
-
`}function an(s,n){return nn(s,n,{statusLabel:r=>Nt(r)?be[r]:r})}function rn({thread:s,site:n,onStatus:r,onReply:o,replying:p,onClose:l,pool:d,onAssign:y,onAddPerson:m,trackers:h,onCreateIssue:g,creatingIssue:f,onEditComment:c,onDeleteComment:N,onDeleteThread:a,move:w,moderator:B=!0}){const k=s.anchor??{},b=s.context??{},R=typeof k.label=="string"?k.label:"",T=k.page,V=T?.route??s.route??"/",M=T?.origin??n.origin,v=M?`${M}${T?.pathname??V}?${is("t")}=${encodeURIComponent(s.key)}`:"",D=s.attachments?.find(u=>u.kind==="screenshot")??s.attachments?.[0],[Q,q]=x.useState(""),[U,C]=x.useState(""),[E,L]=x.useState(!1),[je,oe]=x.useState(!1),F=d.find(u=>u.isMe)?.id,ve=()=>{navigator.clipboard?.writeText(an(s,{name:n.name,...M?{origin:M}:{},dashboardOrigin:location.origin})),ls.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-1 flex-col","aria-label":`${s.key} — ${R||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(ln,{status:s.status,onStatus:r}),e.jsx(hn,{assignee:s.assignee??null,pool:d,onAssign:y,onAddPerson:m}),(h??[]).map(u=>{const O=s.refs?.find(z=>z.provider===u&&z.kind===qs[u]&&z.status!=="detached");if(O){const z=u==="github"?`Issue #${O.externalId}`:u==="jira"?O.externalId:u==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${Ze[u]} issue`;return e.jsxs($,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(as,{}),z]},u)}return g?e.jsx($,{variant:"ghost",size:"sm",disabled:!!f,onClick:()=>g(u),children:f===u?u==="slack"?"Posting…":"Creating…":u==="slack"?"Post to Slack":`Create ${Ze[u]} issue`},u):null}),e.jsx("div",{className:"flex-1"}),w&&e.jsx(ws,{rounds:w.rounds,onMove:w.onMove,busy:w.busy}),e.jsxs($,{variant:"ghost",size:"sm",onClick:ve,children:[e.jsx(Ct,{}),"Copy as brief"]}),a&&e.jsx($,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${s.key}`,title:"Delete this thread",onClick:()=>L(!0),children:e.jsx(vs,{})}),e.jsx($,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:l,children:e.jsx(bt,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:R||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:V}),M&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${M}${T?.pathname??V}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[M.replace(/^https?:\/\//,""),e.jsx(as,{className:"size-3"})]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:v,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[!s.comments[0]?.body&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.filter(u=>u.body!==null).map(u=>e.jsx(on,{comment:u,reply:u!==s.comments[0],mine:Ye(u,F),...c?{onEdit:O=>c(u.id,O)}:{},...N&&(B||Ye(u,F))?{onDelete:()=>N(u.id)}:{}},u.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async u=>{u.preventDefault();const O=Q.trim();if(!(!O||p)){C("");try{await o(O),q("")}catch(z){C(z instanceof Error?z.message:"Could not send that reply.")}}},children:[e.jsx(fe,{className:"size-6 shrink-0",children:e.jsx(ge,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ns,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:Q,onChange:u=>q(u.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),U&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:U}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("review"),children:"Mark in review"}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("resolved"),children:"Mark resolved"})]}),e.jsx($,{type:"submit",size:"sm",disabled:!Q.trim()||p,children:p?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(He,{children:"Screenshot"}),D?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:D.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:D.url,alt:`The page when ${s.key} was left`,width:D.width,height:D.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[D.width??"?"," × ",D.height??"?",b.prefersColorScheme?` · ${b.prefersColorScheme}`:""," · taken at the click, ",Pe(s.createdAt)," ·"," ",e.jsx("a",{href:D.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(St,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(cn,{ctx:b})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(He,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[R&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:R})]}),typeof k.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:k.css})]}),typeof k.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",k.domid]})]}),typeof k.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[k.role,typeof k.accessibleName=="string"?` “${k.accessibleName}”`:""]})]}),k.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(k.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(dn,{state:s.anchorState})})]})]}),e.jsx(un,{ctx:b}),e.jsx(mn,{ctx:b})]}),a&&e.jsx(bs,{open:E,onOpenChange:L,title:`Delete ${s.key}?`,description:"Removes this comment thread and its screenshot for everyone. Linked issues in your tracker are not deleted.",confirmLabel:"Delete thread",busy:je,onConfirm:async()=>{oe(!0);try{await a(),L(!1)}catch{}finally{oe(!1)}}})]})}function on({comment:s,reply:n,mine:r,onEdit:o,onDelete:p}){const[l,d]=x.useState(!1),[y,m]=x.useState(""),[h,g]=x.useState(!1),[f,c]=x.useState(!1),[N,a]=x.useState(!1),w=r&&!!o,B=!!p,k=async()=>{const b=y.trim();if(!(!b||h||!o)){if(b===s.body){d(!1);return}g(!0);try{await o(b),d(!1)}catch{}finally{g(!1)}}};return e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(fe,{className:"size-6 shrink-0",children:e.jsx(ge,{className:A("text-[10px] font-semibold",s.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:Me(s.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:s.author.name||"Anonymous"}),s.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:Pe(s.createdAt)}),(w||B)&&!l&&e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx($,{variant:"ghost",size:"icon-xs",className:"ml-auto self-center text-muted-foreground","aria-label":`Actions for ${s.author.name||"Anonymous"}’s comment`}),children:e.jsx(Tt,{})}),e.jsxs(ae,{align:"end",className:"min-w-36",children:[w&&e.jsxs(H,{onClick:()=>{m(s.body??""),d(!0)},children:[e.jsx(Ft,{}),"Edit"]}),B&&e.jsxs(H,{variant:"destructive",onClick:()=>c(!0),children:[e.jsx(vs,{}),"Delete"]})]})]})]}),l?e.jsxs("form",{className:"mt-1 flex flex-col gap-2",onSubmit:b=>{b.preventDefault(),k()},children:[e.jsx(Ns,{"aria-label":"Edit your comment",value:y,autoFocus:!0,rows:3,disabled:h,onChange:b=>m(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),k()),b.key==="Escape"&&!h&&(b.preventDefault(),d(!1))}}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>d(!1),children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",loading:h,disabled:!y.trim(),children:h?"Saving…":"Save"})]})]}):e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:s.body})]}),B&&e.jsx(bs,{open:f,onOpenChange:c,title:"Delete this comment?",description:n?"The reply is removed for everyone.":"The comment is removed for everyone. The pin and its replies stay.",confirmLabel:"Delete comment",busy:N,onConfirm:async()=>{a(!0);try{await p(),c(!1)}catch{}finally{a(!1)}}})]})}function ln({status:s,onStatus:n}){return e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(js,{status:s})}),e.jsx(ae,{align:"start",className:"w-[180px]",children:e.jsx(Ee,{value:s,onValueChange:r=>n(r),children:Ie.map(r=>e.jsx(J,{value:r,children:be[r]},r))})})]})}function dn({state:s}){const n=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",r=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:A("rounded-full px-2 py-0.5 text-[11.5px] font-medium",n),children:r})}function cn({ctx:s}){const n=s.capture;if(!n)return null;const r=[];return n.screenshot&&n.screenshot!=="ok"&&r.push(`Screenshot ${n.screenshot}${n.reasons?.length?` — ${n.reasons.join("; ")}`:""}`),n.breadcrumbs&&n.breadcrumbs!=="ok"&&r.push(`Breadcrumbs ${n.breadcrumbs}`),n.blindSpots?.length&&r.push(`${n.blindSpots.length} blind spot${n.blindSpots.length===1?"":"s"}: ${n.blindSpots.join("; ")}`),n.droppedCategories?.length&&r.push(`Dropped: ${n.droppedCategories.join(", ")}`),r.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:r.map(o=>e.jsx("li",{children:o},o))}):null}function un({ctx:s}){const n=s.derived,r=s.viewport,o=s.build,p=[];return n?.browser||n?.os?p.push(["Browser",[n.browser,n.os,n.device].filter(Boolean).join(" · ")]):s.ua&&p.push(["User agent",String(s.ua)]),r?.w&&p.push(["Viewport",`${r.w} × ${r.h}${r.dpr?` @${Math.round(r.dpr*10)/10}x`:""}`]),s.language&&p.push(["Language",String(s.language)]),o&&Object.keys(o).length&&p.push(["Build",Object.entries(o).map(([l,d])=>`${l} ${String(d)}`).join(" · ")]),p.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ls.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:p.map(([l,d])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:l}),e.jsx("dd",{className:A("m-0",l==="Build"&&"font-mono text-[12px] text-ink-soft"),children:d})]},l))})]}):null}function mn({ctx:s}){const n=s.breadcrumbs,[r,o]=x.useState(!1);if(!n?.length)return null;const p=n.filter(l=>l.level==="error"||l.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":r,onClick:()=>o(!r),children:[e.jsx($t,{className:A("size-3.5 text-muted-foreground transition-transform",r&&"rotate-90")}),n.length," breadcrumb",n.length===1?"":"s",p>0?` · ${p} error${p===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:r?"hide":"show"})]}),r&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:n.map((l,d)=>e.jsxs("li",{className:A("flex gap-2",(l.level==="error"||l.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:l.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[l.type,l.level?`/${l.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:l.message})]},d))})]})}function hn({assignee:s,pool:n,onAssign:r,onAddPerson:o}){const[p,l]=x.useState(!1),d=n.find(c=>c.isMe),y=n.filter(c=>c.isTeam),m=n.filter(c=>!c.isTeam&&!c.isAgent),h=n.filter(c=>!c.isTeam&&c.isAgent),g=c=>r({id:c.id,name:c.name,kind:c.kind,isTeam:c.isTeam}),f=c=>e.jsxs(H,{onClick:()=>g(c),children:[e.jsx(fe,{className:"size-4",children:e.jsx(ge,{className:A("text-[8px] font-semibold",c.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(c.name,c.email)})}),e.jsx("span",{className:"truncate",children:c.isMe?`${c.name} (you)`:c.name}),s?.id===c.id&&e.jsx(cs,{className:"ml-auto size-3.5"})]},c.id);return e.jsxs(e.Fragment,{children:[e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx($,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"size-4",children:e.jsx(ge,{className:A("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{}),"Assign"]})}),e.jsxs(ae,{align:"start",className:"min-w-56",children:[d&&s?.id!==d.id||s?e.jsxs(he,{children:[d&&s?.id!==d.id&&e.jsx(H,{onClick:()=>g(d),children:"Assign to me"}),s&&e.jsx(H,{onClick:()=>r(null),children:"Unassign"})]}):null,y.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"The studio"}),y.map(f)]}),m.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"People who commented"}),m.map(f)]}),h.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"Agents"}),h.map(f)]}),e.jsx(gs,{}),e.jsx(he,{children:e.jsxs(H,{onClick:()=>l(!0),children:[e.jsx(Ut,{}),"Add a person…"]})})]})]}),e.jsx(xn,{open:p,onOpenChange:l,onAdd:async c=>{const N=await o(c);g(N)}})]})}function xn({open:s,onOpenChange:n,onAdd:r}){const[o,p]=x.useState(""),[l,d]=x.useState(""),[y,m]=x.useState(!1),[h,g]=x.useState(""),f=async c=>{if(c.preventDefault(),!(!o.trim()||y)){m(!0),g("");try{await r({name:o.trim(),...l.trim()?{email:l.trim()}:{}}),p(""),d(""),n(!1)}catch(N){g(N instanceof Us?N.message:"Could not add the person.")}finally{m(!1)}}};return e.jsx(us,{open:s,onOpenChange:n,children:e.jsx(ms,{children:e.jsxs("form",{onSubmit:c=>void f(c),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(hs,{children:[e.jsx(xs,{children:"Add a person"}),e.jsx(ps,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ke,{htmlFor:"person-name",children:"Name"}),e.jsx(Be,{id:"person-name",placeholder:"Sofia",value:o,onChange:c=>p(c.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ke,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(Be,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:l,onChange:c=>d(c.target.value)})]}),e.jsxs(fs,{children:[e.jsx($,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),e.jsx($,{type:"submit",loading:y,disabled:!o.trim(),children:y?"Adding…":"Add and assign"})]})]})})})}nt({thread:pe().optional(),status:pe().optional(),page:pe().optional(),q:pe().optional(),sort:ts(["newest","oldest"]).optional(),round:at().int().positive().optional(),assignee:pe().optional(),by:pe().optional(),view:ts(["board"]).optional()});const Cs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function qn(){const{site:s}=es.useParams(),n=es.useSearch(),r=Ks(),o=wt(),p=o.projects.find(t=>t.uid===s),l=we(Te.origins(s)),d=we(Te.rounds(s)),y=we(Te.assignees(s)),m=we(Te.siteIntegrations(s)),h=y.data?.data??[],g=h.find(t=>t.isMe)?.id,f=n.round??(d.data?Hs(d.data.data):void 0),c=(d.data?.data??[]).filter(t=>!t.archived||t.number===f),N=x.useMemo(()=>({...f!==void 0?{round:f}:{},...n.page?{route:n.page}:{},...n.q?{q:n.q}:{}}),[f,n.page,n.q]),a=we({...ss(s,N),enabled:d.isSuccess}),w=ss(s,N).queryKey,B=Ws(s,w),k=Gs(w),b=Js(s,w),R=Qs(s),T=Xs(s,w),V=Zs(s),M=Ys(s),v=et(w),D=st(w),Q=tt(s,w),[q,U]=x.useState(new Set),C=t=>void r({to:"/s/$site/comments",params:{site:s},search:i=>({...i,...t}),replace:!0}),E=a.data?.data??[],L=x.useMemo(()=>new Set((n.status??"").split(",").filter(Boolean)),[n.status]),je=x.useMemo(()=>{const t=new Map;for(const i of E)t.set(i.status,(t.get(i.status)??0)+1);return t},[E]),oe=x.useMemo(()=>[...new Set(E.map(t=>We(t)))].sort(),[E]),F=x.useMemo(()=>{let t=L.size?E.filter(i=>L.has(i.status)):E;return n.assignee==="unassigned"?t=t.filter(i=>!i.assignee):n.assignee==="me"?t=t.filter(i=>!!g&&i.assignee?.id===g):n.assignee&&(t=t.filter(i=>i.assignee?.id===n.assignee)),n.by==="me"?t=t.filter(i=>!!g&&i.createdBy.id===g):n.by&&(t=t.filter(i=>rs(i.createdBy.name)===n.by)),n.sort==="oldest"&&(t=[...t].reverse()),t},[E,L,n.sort,n.assignee,n.by,g]),ve=x.useMemo(()=>{const t=new Map;for(const i of F){const S=We(i);t.has(S)||t.set(S,[]),t.get(S).push(i)}return[...t.entries()]},[F]),u=n.thread?E.find(t=>t.key===n.thread)??null:null,O=L.size>0||!!n.page||!!n.q||!!n.assignee||!!n.by,z=x.useMemo(()=>{const t=new Map;for(const i of E){if(i.createdBy.id&&i.createdBy.id===g)continue;const S=rs(i.createdBy.name);S&&!t.has(S)&&t.set(S,i.createdBy.name.trim())}return[...t].sort((i,S)=>i[1].localeCompare(S[1]))},[E,g]),Ae=c.filter(t=>t.number!==f&&t.unresolved>0),I=Re(o.user.role,"review"),W=Re(o.user.role,"moderate"),ie=t=>!!g&&t.comments.every(i=>i.body===null||i.author.id===g),P=I?c.filter(t=>!t.archived&&t.number!==f):[],X=(t,i)=>M.mutate({ids:t,round:i},{onSuccess:()=>{U(new Set),n.thread&&t.includes(u?.id??"")&&C({thread:void 0})}}),_=t=>{const i=new Set(L);i.has(t)?i.delete(t):i.add(t),C({status:[...i].join(",")||void 0})},De=async t=>{const i=[...q];U(new Set);for(const S of i)await B.mutateAsync({id:S,status:t}).catch(()=>{})};x.useEffect(()=>{const t=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;const S=i.target;if(S&&(S.closest("input,textarea,select,[contenteditable]")||S.isContentEditable))return;const Y=i.key.toLowerCase();if(Y!=="j"&&Y!=="k"&&Y!=="e"||F.length===0)return;if(i.preventDefault(),Y==="e"){if(!u)return;B.mutate({id:u.id,status:u.status==="resolved"?"open":"resolved"});return}const le=u?F.findIndex(xe=>xe.id===u.id):-1,ee=Y==="j"?Math.min(le+1,F.length-1):Math.max(le-1,0),de=F[le===-1?0:ee];de&&C({thread:de.key})};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)});const Z=n.view==="board",G=x.useMemo(()=>Ie.map(t=>({status:t,items:F.filter(i=>i.status===t)})),[F]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:q.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[q.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),Ie.map(t=>e.jsx($,{variant:"outline",size:"sm",onClick:()=>void De(t),children:be[t]},t)),e.jsx(ws,{rounds:P,busy:M.isPending,onMove:t=>X([...q],t)}),e.jsx($,{variant:"ghost",size:"sm",onClick:()=>U(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[c.length>0&&f!==void 0&&e.jsx(sn,{rounds:c,active:f,onPick:t=>C({round:t,thread:void 0}),onStart:t=>V.mutate(t,{onSuccess:i=>C({round:i.number,thread:void 0,status:void 0})}),starting:V.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Ue,{on:L.size===0,onClick:()=>C({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:E.length})]}),Ie.map(t=>e.jsxs(Ue,{on:L.has(t),onClick:()=>_(t),children:[e.jsx("span",{className:A("size-[7px] rounded-full",Cs[t])}),be[t]," ",e.jsx("span",{className:"text-muted-foreground",children:je.get(t)??0})]},t)),e.jsx("div",{className:"flex-1"}),e.jsxs(Ue,{on:Z,onClick:()=>C({view:Z?void 0:"board"}),children:[Z?e.jsx(Pt,{className:"size-3.5"}):e.jsx(zt,{className:"size-3.5"}),Z?"List":"Board"]}),e.jsx(fn,{value:n.q??"",onChange:t=>C({q:t||void 0})}),oe.length>1&&e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.page)}),children:[n.page??"All pages",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsxs(ae,{align:"end",children:[e.jsx(H,{onClick:()=>C({page:void 0}),children:"All pages"}),oe.map(t=>e.jsx(H,{onClick:()=>C({page:t}),children:e.jsx("span",{className:"font-mono text-[12px]",children:t})},t))]})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.by),"aria-label":"Filter by who commented"}),children:[n.by==="me"?"By me":n.by?`By ${z.find(([t])=>t===n.by)?.[1]??"someone"}`:"Comments by",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.by??"any",onValueChange:t=>C({by:t==="any"?void 0:t}),children:[e.jsx(J,{value:"any",children:"Anyone"}),g&&e.jsx(J,{value:"me",children:"Me"}),z.map(([t,i])=>e.jsx(J,{value:t,children:i},t))]})})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.assignee),"aria-label":"Filter by assignee"}),children:[pn(n.assignee,h),e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.assignee??"any",onValueChange:t=>C({assignee:t==="any"?void 0:t}),children:[e.jsx(J,{value:"any",children:"Anyone"}),e.jsx(J,{value:"unassigned",children:"Unassigned"}),g&&e.jsx(J,{value:"me",children:"Me"}),h.filter(t=>!t.isMe).map(t=>e.jsx(J,{value:t.id,children:t.name},t.id))]})})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!1)}),children:[n.sort==="oldest"?"Oldest":"Newest",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.sort??"newest",onValueChange:t=>C({sort:t==="oldest"?"oldest":void 0}),children:[e.jsx(J,{value:"newest",children:"Newest first"}),e.jsx(J,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ae.map(t=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>C({round:t.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[t.unresolved," unresolved"]})," in ",t.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},t.id)),e.jsxs("div",{className:A("grid min-h-0 flex-1",u?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:A("min-h-0 overflow-auto lg:border-r lg:border-border",u&&"hidden lg:block"),children:[a.isPending&&e.jsx(bn,{}),a.isError&&e.jsx(qe,{title:"Could not load the comments",children:a.error.message}),a.isSuccess&&E.length===0&&!O&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(qe,{icon:e.jsx(It,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",p.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(Mt,{uid:s})})]})}),a.isSuccess&&E.length>0&&F.length===0&&e.jsx(qe,{title:"Nothing matches",action:e.jsx($,{variant:"outline",size:"sm",onClick:()=>C({status:void 0,page:void 0,q:void 0,assignee:void 0,by:void 0}),children:"Show all"}),children:"No comment matches that filter."}),Z&&a.isSuccess&&F.length>0&&e.jsx(jn,{columns:G,uid:s,selectedId:u?.id??null,onMove:(t,i)=>B.mutate({id:t,status:i})}),!Z&&ve.map(([t,i])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[t," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",i.length]})]}),i.map(S=>e.jsx(gn,{t:S,uid:s,on:u?.id===S.id,picked:q.has(S.id),picking:q.size>0,onPick:Y=>U(le=>{const ee=new Set(le);return Y?ee.add(S.id):ee.delete(S.id),ee})},S.id))]},t))]}),u&&e.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs($,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>C({thread:void 0}),children:[e.jsx(At,{}),"Back to the list"]})}),e.jsx(rn,{thread:u,site:{name:p.name,...l.data?.origins[0]?{origin:l.data.origins[0]}:{}},onStatus:t=>B.mutate({id:u.id,status:t}),onReply:t=>k.mutateAsync({id:u.id,body:t}),replying:k.isPending,pool:h,onAssign:t=>b.mutate({id:u.id,assignee:t}),onAddPerson:t=>R.mutateAsync(t),trackers:(m.data?.data??[]).map(t=>t.provider),...Re(o.user.role,"settings")?{onCreateIssue:t=>T.mutate({id:u.id,provider:t})}:{},creatingIssue:T.isPending?T.variables?.provider:void 0,onEditComment:(t,i)=>v.mutateAsync({threadId:u.id,commentId:t,body:i}),onDeleteComment:t=>D.mutateAsync({threadId:u.id,commentId:t}),moderator:W,...W||Re(o.user.role,"review")&&ie(u)?{onDeleteThread:async()=>{await Q.mutateAsync(u.id),C({thread:void 0})}}:{},...P.length?{move:{rounds:P,busy:M.isPending,onMove:t=>X([u.id],t)}}:{},onClose:()=>C({thread:void 0})})]})]})]})}function pn(s,n){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":n.find(r=>r.id===s)?.name??"Assignee":"Assignee"}function rs(s){return s.trim().toLowerCase()}function We(s){return s.anchor?.page?.route??s.route??"/"}function Se(s){return A("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Ue({on:s,onClick:n,children:r}){return e.jsx("button",{type:"button",className:Se(s),"aria-pressed":s,onClick:n,children:r})}function fn({value:s,onChange:n}){const[r,o]=x.useState(s);return e.jsxs("form",{className:"relative",onSubmit:p=>{p.preventDefault(),n(r.trim())},children:[e.jsx(kt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(Be,{type:"search","aria-label":"Search comments",placeholder:"Search",value:r,onChange:p=>o(p.target.value),onBlur:()=>r.trim()!==s&&n(r.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function gn({t:s,uid:n,on:r,picked:o,picking:p,onPick:l}){const d=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),y=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:A("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",r&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:A("flex items-center",!p&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(en,{checked:o,onCheckedChange:m=>l(!!m),"aria-label":`Select ${s.key}`})}),e.jsxs(ds,{to:"/s/$site/comments",params:{site:n},search:m=>({...m,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[d,y&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:y})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(fe,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ge,{className:A("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(s.assignee.name)})}),e.jsx(js,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:Pe(s.updatedAt)})]})]})]})}function bn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(Ne,{className:"h-3 w-16"})}),[70,55,80,62].map((s,n)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(Ne,{className:"h-3 w-10"}),e.jsx(Ne,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ne,{className:"h-3 w-11"}),e.jsx(Ne,{className:"h-[18px] w-16 rounded-full"})]})]},n))]})}function jn({columns:s,uid:n,selectedId:r,onMove:o}){const[p,l]=x.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:d,items:y})=>e.jsxs("section",{"aria-label":be[d],onDragOver:m=>{m.preventDefault(),l(d)},onDragLeave:()=>l(m=>m===d?null:m),onDrop:m=>{m.preventDefault(),l(null);const h=m.dataTransfer.getData("text/plain");h&&o(h,d)},className:A("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",p===d&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:A("size-[7px] rounded-full",Cs[d])}),be[d],e.jsx("span",{className:"text-muted-foreground",children:y.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[y.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),y.map(m=>e.jsxs(ds,{to:"/s/$site/comments",params:{site:n},search:h=>({...h,thread:m.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",m.id),h.dataTransfer.effectAllowed="move"},className:A("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",r===m.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:m.comments[0]?.body??(typeof m.anchor?.label=="string"?m.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:m.key}),e.jsx("span",{className:"truncate",children:We(m)}),e.jsx("span",{className:"flex-1"}),m.assignee&&e.jsx(fe,{className:"size-4",title:`Assigned to ${m.assignee.name}`,children:e.jsx(ge,{className:A("text-[8px] font-semibold",m.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(m.assignee.name)})}),e.jsx("span",{children:Pe(m.updatedAt)})]})]},m.id))]})]},d))})}export{qn as component,Nt as isStatus};
|
|
49
|
+
`}function an(s,n){return nn(s,n,{statusLabel:r=>Nt(r)?be[r]:r})}function rn({thread:s,site:n,onStatus:r,onReply:o,replying:p,onClose:l,pool:d,onAssign:y,onAddPerson:m,trackers:h,onCreateIssue:g,creatingIssue:f,onEditComment:c,onDeleteComment:N,onDeleteThread:a,move:w,moderator:B=!0}){const k=s.anchor??{},b=s.context??{},R=typeof k.label=="string"?k.label:"",T=k.page,V=T?.route??s.route??"/",M=T?.origin??n.origin,v=M?`${M}${T?.pathname??V}?${is("t")}=${encodeURIComponent(s.key)}`:"",D=s.attachments?.find(u=>u.kind==="screenshot")??s.attachments?.[0],[Q,q]=x.useState(""),[U,C]=x.useState(""),[E,L]=x.useState(!1),[je,oe]=x.useState(!1),F=d.find(u=>u.isMe)?.id,ve=()=>{navigator.clipboard?.writeText(an(s,{name:n.name,...M?{origin:M}:{},dashboardOrigin:location.origin})),ls.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-1 flex-col","aria-label":`${s.key} — ${R||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(ln,{status:s.status,onStatus:r}),e.jsx(hn,{assignee:s.assignee??null,pool:d,onAssign:y,onAddPerson:m}),(h??[]).map(u=>{const O=s.refs?.find(z=>z.provider===u&&z.kind===qs[u]&&z.status!=="detached");if(O){const z=u==="github"?`Issue #${O.externalId}`:u==="jira"?O.externalId:u==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${Ze[u]} issue`;return e.jsxs($,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(as,{}),z]},u)}return g?e.jsx($,{variant:"ghost",size:"sm",disabled:!!f,onClick:()=>g(u),children:f===u?u==="slack"?"Posting…":"Creating…":u==="slack"?"Post to Slack":`Create ${Ze[u]} issue`},u):null}),e.jsx("div",{className:"flex-1"}),w&&e.jsx(ws,{rounds:w.rounds,onMove:w.onMove,busy:w.busy}),e.jsxs($,{variant:"ghost",size:"sm",onClick:ve,children:[e.jsx(wt,{}),"Copy as brief"]}),a&&e.jsx($,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${s.key}`,title:"Delete this thread",onClick:()=>L(!0),children:e.jsx(vs,{})}),e.jsx($,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:l,children:e.jsx(bt,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:R||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:V}),M&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${M}${T?.pathname??V}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[M.replace(/^https?:\/\//,""),e.jsx(as,{className:"size-3"})]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:v,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[!s.comments[0]?.body&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.filter(u=>u.body!==null).map(u=>e.jsx(on,{comment:u,reply:u!==s.comments[0],mine:Ye(u,F),...c?{onEdit:O=>c(u.id,O)}:{},...N&&(B||Ye(u,F))?{onDelete:()=>N(u.id)}:{}},u.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async u=>{u.preventDefault();const O=Q.trim();if(!(!O||p)){C("");try{await o(O),q("")}catch(z){C(z instanceof Error?z.message:"Could not send that reply.")}}},children:[e.jsx(fe,{className:"size-6 shrink-0",children:e.jsx(ge,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ns,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:Q,onChange:u=>q(u.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),U&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:U}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("review"),children:"Mark in review"}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("resolved"),children:"Mark resolved"})]}),e.jsx($,{type:"submit",size:"sm",disabled:!Q.trim()||p,children:p?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(He,{children:"Screenshot"}),D?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:D.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:D.url,alt:`The page when ${s.key} was left`,width:D.width,height:D.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[D.width??"?"," × ",D.height??"?",b.prefersColorScheme?` · ${b.prefersColorScheme}`:""," · taken at the click, ",Pe(s.createdAt)," ·"," ",e.jsx("a",{href:D.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(Ct,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(cn,{ctx:b})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(He,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[R&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:R})]}),typeof k.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:k.css})]}),typeof k.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",k.domid]})]}),typeof k.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[k.role,typeof k.accessibleName=="string"?` “${k.accessibleName}”`:""]})]}),k.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(k.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(dn,{state:s.anchorState})})]})]}),e.jsx(un,{ctx:b}),e.jsx(mn,{ctx:b})]}),a&&e.jsx(bs,{open:E,onOpenChange:L,title:`Delete ${s.key}?`,description:"Removes this comment thread and its screenshot for everyone. Linked issues in your tracker are not deleted.",confirmLabel:"Delete thread",busy:je,onConfirm:async()=>{oe(!0);try{await a(),L(!1)}catch{}finally{oe(!1)}}})]})}function on({comment:s,reply:n,mine:r,onEdit:o,onDelete:p}){const[l,d]=x.useState(!1),[y,m]=x.useState(""),[h,g]=x.useState(!1),[f,c]=x.useState(!1),[N,a]=x.useState(!1),w=r&&!!o,B=!!p,k=async()=>{const b=y.trim();if(!(!b||h||!o)){if(b===s.body){d(!1);return}g(!0);try{await o(b),d(!1)}catch{}finally{g(!1)}}};return e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(fe,{className:"size-6 shrink-0",children:e.jsx(ge,{className:A("text-[10px] font-semibold",s.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:Me(s.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:s.author.name||"Anonymous"}),s.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:Pe(s.createdAt)}),(w||B)&&!l&&e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx($,{variant:"ghost",size:"icon-xs",className:"ml-auto self-center text-muted-foreground","aria-label":`Actions for ${s.author.name||"Anonymous"}’s comment`}),children:e.jsx(Tt,{})}),e.jsxs(ae,{align:"end",className:"min-w-36",children:[w&&e.jsxs(H,{onClick:()=>{m(s.body??""),d(!0)},children:[e.jsx(Ft,{}),"Edit"]}),B&&e.jsxs(H,{variant:"destructive",onClick:()=>c(!0),children:[e.jsx(vs,{}),"Delete"]})]})]})]}),l?e.jsxs("form",{className:"mt-1 flex flex-col gap-2",onSubmit:b=>{b.preventDefault(),k()},children:[e.jsx(Ns,{"aria-label":"Edit your comment",value:y,autoFocus:!0,rows:3,disabled:h,onChange:b=>m(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),k()),b.key==="Escape"&&!h&&(b.preventDefault(),d(!1))}}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>d(!1),children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",loading:h,disabled:!y.trim(),children:h?"Saving…":"Save"})]})]}):e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:s.body})]}),B&&e.jsx(bs,{open:f,onOpenChange:c,title:"Delete this comment?",description:n?"The reply is removed for everyone.":"The comment is removed for everyone. The pin and its replies stay.",confirmLabel:"Delete comment",busy:N,onConfirm:async()=>{a(!0);try{await p(),c(!1)}catch{}finally{a(!1)}}})]})}function ln({status:s,onStatus:n}){return e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(js,{status:s})}),e.jsx(ae,{align:"start",className:"w-[180px]",children:e.jsx(Ee,{value:s,onValueChange:r=>n(r),children:Ie.map(r=>e.jsx(J,{value:r,children:be[r]},r))})})]})}function dn({state:s}){const n=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",r=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:A("rounded-full px-2 py-0.5 text-[11.5px] font-medium",n),children:r})}function cn({ctx:s}){const n=s.capture;if(!n)return null;const r=[];return n.screenshot&&n.screenshot!=="ok"&&r.push(`Screenshot ${n.screenshot}${n.reasons?.length?` — ${n.reasons.join("; ")}`:""}`),n.breadcrumbs&&n.breadcrumbs!=="ok"&&r.push(`Breadcrumbs ${n.breadcrumbs}`),n.blindSpots?.length&&r.push(`${n.blindSpots.length} blind spot${n.blindSpots.length===1?"":"s"}: ${n.blindSpots.join("; ")}`),n.droppedCategories?.length&&r.push(`Dropped: ${n.droppedCategories.join(", ")}`),r.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:r.map(o=>e.jsx("li",{children:o},o))}):null}function un({ctx:s}){const n=s.derived,r=s.viewport,o=s.build,p=[];return n?.browser||n?.os?p.push(["Browser",[n.browser,n.os,n.device].filter(Boolean).join(" · ")]):s.ua&&p.push(["User agent",String(s.ua)]),r?.w&&p.push(["Viewport",`${r.w} × ${r.h}${r.dpr?` @${Math.round(r.dpr*10)/10}x`:""}`]),s.language&&p.push(["Language",String(s.language)]),o&&Object.keys(o).length&&p.push(["Build",Object.entries(o).map(([l,d])=>`${l} ${String(d)}`).join(" · ")]),p.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ls.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:p.map(([l,d])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:l}),e.jsx("dd",{className:A("m-0",l==="Build"&&"font-mono text-[12px] text-ink-soft"),children:d})]},l))})]}):null}function mn({ctx:s}){const n=s.breadcrumbs,[r,o]=x.useState(!1);if(!n?.length)return null;const p=n.filter(l=>l.level==="error"||l.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":r,onClick:()=>o(!r),children:[e.jsx(St,{className:A("size-3.5 text-muted-foreground transition-transform",r&&"rotate-90")}),n.length," breadcrumb",n.length===1?"":"s",p>0?` · ${p} error${p===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:r?"hide":"show"})]}),r&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:n.map((l,d)=>e.jsxs("li",{className:A("flex gap-2",(l.level==="error"||l.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:l.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[l.type,l.level?`/${l.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:l.message})]},d))})]})}function hn({assignee:s,pool:n,onAssign:r,onAddPerson:o}){const[p,l]=x.useState(!1),d=n.find(c=>c.isMe),y=n.filter(c=>c.isTeam),m=n.filter(c=>!c.isTeam&&!c.isAgent),h=n.filter(c=>!c.isTeam&&c.isAgent),g=c=>r({id:c.id,name:c.name,kind:c.kind,isTeam:c.isTeam}),f=c=>e.jsxs(H,{onClick:()=>g(c),children:[e.jsx(fe,{className:"size-4",children:e.jsx(ge,{className:A("text-[8px] font-semibold",c.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(c.name,c.email)})}),e.jsx("span",{className:"truncate",children:c.isMe?`${c.name} (you)`:c.name}),s?.id===c.id&&e.jsx(cs,{className:"ml-auto size-3.5"})]},c.id);return e.jsxs(e.Fragment,{children:[e.jsxs(te,{children:[e.jsx(ne,{render:e.jsx($,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"size-4",children:e.jsx(ge,{className:A("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{}),"Assign"]})}),e.jsxs(ae,{align:"start",className:"min-w-56",children:[d&&s?.id!==d.id||s?e.jsxs(he,{children:[d&&s?.id!==d.id&&e.jsx(H,{onClick:()=>g(d),children:"Assign to me"}),s&&e.jsx(H,{onClick:()=>r(null),children:"Unassign"})]}):null,y.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"The studio"}),y.map(f)]}),m.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"People who commented"}),m.map(f)]}),h.length>0&&e.jsxs(he,{children:[e.jsx($e,{children:"Agents"}),h.map(f)]}),e.jsx(gs,{}),e.jsx(he,{children:e.jsxs(H,{onClick:()=>l(!0),children:[e.jsx(Ut,{}),"Add a person…"]})})]})]}),e.jsx(xn,{open:p,onOpenChange:l,onAdd:async c=>{const N=await o(c);g(N)}})]})}function xn({open:s,onOpenChange:n,onAdd:r}){const[o,p]=x.useState(""),[l,d]=x.useState(""),[y,m]=x.useState(!1),[h,g]=x.useState(""),f=async c=>{if(c.preventDefault(),!(!o.trim()||y)){m(!0),g("");try{await r({name:o.trim(),...l.trim()?{email:l.trim()}:{}}),p(""),d(""),n(!1)}catch(N){g(N instanceof Us?N.message:"Could not add the person.")}finally{m(!1)}}};return e.jsx(us,{open:s,onOpenChange:n,children:e.jsx(ms,{children:e.jsxs("form",{onSubmit:c=>void f(c),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(hs,{children:[e.jsx(xs,{children:"Add a person"}),e.jsx(ps,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ke,{htmlFor:"person-name",children:"Name"}),e.jsx(Be,{id:"person-name",placeholder:"Sofia",value:o,onChange:c=>p(c.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ke,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(Be,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:l,onChange:c=>d(c.target.value)})]}),e.jsxs(fs,{children:[e.jsx($,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),e.jsx($,{type:"submit",loading:y,disabled:!o.trim(),children:y?"Adding…":"Add and assign"})]})]})})})}nt({thread:pe().optional(),status:pe().optional(),page:pe().optional(),q:pe().optional(),sort:ts(["newest","oldest"]).optional(),round:at().int().positive().optional(),assignee:pe().optional(),by:pe().optional(),view:ts(["board"]).optional()});const Cs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function Un(){const{site:s}=es.useParams(),n=es.useSearch(),r=Ks(),o=Mt(),p=o.projects.find(t=>t.uid===s),l=we(Te.origins(s)),d=we(Te.rounds(s)),y=we(Te.assignees(s)),m=we(Te.siteIntegrations(s)),h=y.data?.data??[],g=h.find(t=>t.isMe)?.id,f=n.round??(d.data?Hs(d.data.data):void 0),c=(d.data?.data??[]).filter(t=>!t.archived||t.number===f),N=x.useMemo(()=>({...f!==void 0?{round:f}:{},...n.page?{route:n.page}:{},...n.q?{q:n.q}:{}}),[f,n.page,n.q]),a=we({...ss(s,N),enabled:d.isSuccess}),w=ss(s,N).queryKey,B=Ws(s,w),k=Gs(w),b=Js(s,w),R=Qs(s),T=Xs(s,w),V=Zs(s),M=Ys(s),v=et(w),D=st(w),Q=tt(s,w),[q,U]=x.useState(new Set),C=t=>void r({to:"/s/$site/comments",params:{site:s},search:i=>({...i,...t}),replace:!0}),E=a.data?.data??[],L=x.useMemo(()=>new Set((n.status??"").split(",").filter(Boolean)),[n.status]),je=x.useMemo(()=>{const t=new Map;for(const i of E)t.set(i.status,(t.get(i.status)??0)+1);return t},[E]),oe=x.useMemo(()=>[...new Set(E.map(t=>We(t)))].sort(),[E]),F=x.useMemo(()=>{let t=L.size?E.filter(i=>L.has(i.status)):E;return n.assignee==="unassigned"?t=t.filter(i=>!i.assignee):n.assignee==="me"?t=t.filter(i=>!!g&&i.assignee?.id===g):n.assignee&&(t=t.filter(i=>i.assignee?.id===n.assignee)),n.by==="me"?t=t.filter(i=>!!g&&i.createdBy.id===g):n.by&&(t=t.filter(i=>rs(i.createdBy.name)===n.by)),n.sort==="oldest"&&(t=[...t].reverse()),t},[E,L,n.sort,n.assignee,n.by,g]),ve=x.useMemo(()=>{const t=new Map;for(const i of F){const S=We(i);t.has(S)||t.set(S,[]),t.get(S).push(i)}return[...t.entries()]},[F]),u=n.thread?E.find(t=>t.key===n.thread)??null:null,O=L.size>0||!!n.page||!!n.q||!!n.assignee||!!n.by,z=x.useMemo(()=>{const t=new Map;for(const i of E){if(i.createdBy.id&&i.createdBy.id===g)continue;const S=rs(i.createdBy.name);S&&!t.has(S)&&t.set(S,i.createdBy.name.trim())}return[...t].sort((i,S)=>i[1].localeCompare(S[1]))},[E,g]),Ae=c.filter(t=>t.number!==f&&t.unresolved>0),I=Re(o.user.role,"review"),W=Re(o.user.role,"moderate"),ie=t=>!!g&&t.comments.every(i=>i.body===null||i.author.id===g),P=I?c.filter(t=>!t.archived&&t.number!==f):[],X=(t,i)=>M.mutate({ids:t,round:i},{onSuccess:()=>{U(new Set),n.thread&&t.includes(u?.id??"")&&C({thread:void 0})}}),_=t=>{const i=new Set(L);i.has(t)?i.delete(t):i.add(t),C({status:[...i].join(",")||void 0})},De=async t=>{const i=[...q];U(new Set);for(const S of i)await B.mutateAsync({id:S,status:t}).catch(()=>{})};x.useEffect(()=>{const t=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;const S=i.target;if(S&&(S.closest("input,textarea,select,[contenteditable]")||S.isContentEditable))return;const Y=i.key.toLowerCase();if(Y!=="j"&&Y!=="k"&&Y!=="e"||F.length===0)return;if(i.preventDefault(),Y==="e"){if(!u)return;B.mutate({id:u.id,status:u.status==="resolved"?"open":"resolved"});return}const le=u?F.findIndex(xe=>xe.id===u.id):-1,ee=Y==="j"?Math.min(le+1,F.length-1):Math.max(le-1,0),de=F[le===-1?0:ee];de&&C({thread:de.key})};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)});const Z=n.view==="board",G=x.useMemo(()=>Ie.map(t=>({status:t,items:F.filter(i=>i.status===t)})),[F]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:q.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[q.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),Ie.map(t=>e.jsx($,{variant:"outline",size:"sm",onClick:()=>void De(t),children:be[t]},t)),e.jsx(ws,{rounds:P,busy:M.isPending,onMove:t=>X([...q],t)}),e.jsx($,{variant:"ghost",size:"sm",onClick:()=>U(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[c.length>0&&f!==void 0&&e.jsx(sn,{rounds:c,active:f,onPick:t=>C({round:t,thread:void 0}),onStart:t=>V.mutate(t,{onSuccess:i=>C({round:i.number,thread:void 0,status:void 0})}),starting:V.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Ue,{on:L.size===0,onClick:()=>C({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:E.length})]}),Ie.map(t=>e.jsxs(Ue,{on:L.has(t),onClick:()=>_(t),children:[e.jsx("span",{className:A("size-[7px] rounded-full",Cs[t])}),be[t]," ",e.jsx("span",{className:"text-muted-foreground",children:je.get(t)??0})]},t)),e.jsx("div",{className:"flex-1"}),e.jsxs(Ue,{on:Z,onClick:()=>C({view:Z?void 0:"board"}),children:[Z?e.jsx(Pt,{className:"size-3.5"}):e.jsx(zt,{className:"size-3.5"}),Z?"List":"Board"]}),e.jsx(fn,{value:n.q??"",onChange:t=>C({q:t||void 0})}),oe.length>1&&e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.page)}),children:[n.page??"All pages",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsxs(ae,{align:"end",children:[e.jsx(H,{onClick:()=>C({page:void 0}),children:"All pages"}),oe.map(t=>e.jsx(H,{onClick:()=>C({page:t}),children:e.jsx("span",{className:"font-mono text-[12px]",children:t})},t))]})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.by),"aria-label":"Filter by who commented"}),children:[n.by==="me"?"By me":n.by?`By ${z.find(([t])=>t===n.by)?.[1]??"someone"}`:"Comments by",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.by??"any",onValueChange:t=>C({by:t==="any"?void 0:t}),children:[e.jsx(J,{value:"any",children:"Anyone"}),g&&e.jsx(J,{value:"me",children:"Me"}),z.map(([t,i])=>e.jsx(J,{value:t,children:i},t))]})})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!!n.assignee),"aria-label":"Filter by assignee"}),children:[pn(n.assignee,h),e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.assignee??"any",onValueChange:t=>C({assignee:t==="any"?void 0:t}),children:[e.jsx(J,{value:"any",children:"Anyone"}),e.jsx(J,{value:"unassigned",children:"Unassigned"}),g&&e.jsx(J,{value:"me",children:"Me"}),h.filter(t=>!t.isMe).map(t=>e.jsx(J,{value:t.id,children:t.name},t.id))]})})]}),e.jsxs(te,{children:[e.jsxs(ne,{render:e.jsx("button",{type:"button",className:Se(!1)}),children:[n.sort==="oldest"?"Oldest":"Newest",e.jsx(Ce,{className:"size-3 text-muted-foreground"})]}),e.jsx(ae,{align:"end",children:e.jsxs(Ee,{value:n.sort??"newest",onValueChange:t=>C({sort:t==="oldest"?"oldest":void 0}),children:[e.jsx(J,{value:"newest",children:"Newest first"}),e.jsx(J,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ae.map(t=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>C({round:t.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[t.unresolved," unresolved"]})," in ",t.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},t.id)),e.jsxs("div",{className:A("grid min-h-0 flex-1",u?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:A("min-h-0 overflow-auto lg:border-r lg:border-border",u&&"hidden lg:block"),children:[a.isPending&&e.jsx(bn,{}),a.isError&&e.jsx(qe,{title:"Could not load the comments",children:a.error.message}),a.isSuccess&&E.length===0&&!O&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(qe,{icon:e.jsx(It,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",p.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx($t,{uid:s})})]})}),a.isSuccess&&E.length>0&&F.length===0&&e.jsx(qe,{title:"Nothing matches",action:e.jsx($,{variant:"outline",size:"sm",onClick:()=>C({status:void 0,page:void 0,q:void 0,assignee:void 0,by:void 0}),children:"Show all"}),children:"No comment matches that filter."}),Z&&a.isSuccess&&F.length>0&&e.jsx(jn,{columns:G,uid:s,selectedId:u?.id??null,onMove:(t,i)=>B.mutate({id:t,status:i})}),!Z&&ve.map(([t,i])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[t," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",i.length]})]}),i.map(S=>e.jsx(gn,{t:S,uid:s,on:u?.id===S.id,picked:q.has(S.id),picking:q.size>0,onPick:Y=>U(le=>{const ee=new Set(le);return Y?ee.add(S.id):ee.delete(S.id),ee})},S.id))]},t))]}),u&&e.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs($,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>C({thread:void 0}),children:[e.jsx(At,{}),"Back to the list"]})}),e.jsx(rn,{thread:u,site:{name:p.name,...l.data?.origins[0]?{origin:l.data.origins[0]}:{}},onStatus:t=>B.mutate({id:u.id,status:t}),onReply:t=>k.mutateAsync({id:u.id,body:t}),replying:k.isPending,pool:h,onAssign:t=>b.mutate({id:u.id,assignee:t}),onAddPerson:t=>R.mutateAsync(t),trackers:(m.data?.data??[]).map(t=>t.provider),...Re(o.user.role,"settings")?{onCreateIssue:t=>T.mutate({id:u.id,provider:t})}:{},creatingIssue:T.isPending?T.variables?.provider:void 0,onEditComment:(t,i)=>v.mutateAsync({threadId:u.id,commentId:t,body:i}),onDeleteComment:t=>D.mutateAsync({threadId:u.id,commentId:t}),moderator:W,...W||Re(o.user.role,"review")&&ie(u)?{onDeleteThread:async()=>{await Q.mutateAsync(u.id),C({thread:void 0})}}:{},...P.length?{move:{rounds:P,busy:M.isPending,onMove:t=>X([u.id],t)}}:{},onClose:()=>C({thread:void 0})})]})]})]})}function pn(s,n){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":n.find(r=>r.id===s)?.name??"Assignee":"Assignee"}function rs(s){return s.trim().toLowerCase()}function We(s){return s.anchor?.page?.route??s.route??"/"}function Se(s){return A("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Ue({on:s,onClick:n,children:r}){return e.jsx("button",{type:"button",className:Se(s),"aria-pressed":s,onClick:n,children:r})}function fn({value:s,onChange:n}){const[r,o]=x.useState(s);return e.jsxs("form",{className:"relative",onSubmit:p=>{p.preventDefault(),n(r.trim())},children:[e.jsx(kt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(Be,{type:"search","aria-label":"Search comments",placeholder:"Search",value:r,onChange:p=>o(p.target.value),onBlur:()=>r.trim()!==s&&n(r.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function gn({t:s,uid:n,on:r,picked:o,picking:p,onPick:l}){const d=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),y=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:A("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",r&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:A("flex items-center",!p&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(en,{checked:o,onCheckedChange:m=>l(!!m),"aria-label":`Select ${s.key}`})}),e.jsxs(ds,{to:"/s/$site/comments",params:{site:n},search:m=>({...m,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[d,y&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:y})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(fe,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ge,{className:A("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(s.assignee.name)})}),e.jsx(js,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:Pe(s.updatedAt)})]})]})]})}function bn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(Ne,{className:"h-3 w-16"})}),[70,55,80,62].map((s,n)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(Ne,{className:"h-3 w-10"}),e.jsx(Ne,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ne,{className:"h-3 w-11"}),e.jsx(Ne,{className:"h-[18px] w-16 rounded-full"})]})]},n))]})}function jn({columns:s,uid:n,selectedId:r,onMove:o}){const[p,l]=x.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:d,items:y})=>e.jsxs("section",{"aria-label":be[d],onDragOver:m=>{m.preventDefault(),l(d)},onDragLeave:()=>l(m=>m===d?null:m),onDrop:m=>{m.preventDefault(),l(null);const h=m.dataTransfer.getData("text/plain");h&&o(h,d)},className:A("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",p===d&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:A("size-[7px] rounded-full",Cs[d])}),be[d],e.jsx("span",{className:"text-muted-foreground",children:y.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[y.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),y.map(m=>e.jsxs(ds,{to:"/s/$site/comments",params:{site:n},search:h=>({...h,thread:m.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",m.id),h.dataTransfer.effectAllowed="move"},className:A("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",r===m.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:m.comments[0]?.body??(typeof m.anchor?.label=="string"?m.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:m.key}),e.jsx("span",{className:"truncate",children:We(m)}),e.jsx("span",{className:"flex-1"}),m.assignee&&e.jsx(fe,{className:"size-4",title:`Assigned to ${m.assignee.name}`,children:e.jsx(ge,{className:A("text-[8px] font-semibold",m.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:Me(m.assignee.name)})}),e.jsx("span",{children:Pe(m.updatedAt)})]})]},m.id))]})]},d))})}export{Un as component,Nt as isStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aU as A,r as f,j as e,B as g,aV as S,q as E,h as I,aW as F,A as N,a2 as L,D as M,F as y}from"./index-CHi2CcHb.js";import{u as C}from"./useQuery-U2FOgJPB.js";import{u as P,a as U}from"./zod-dogyqr67.js";import{C as R}from"./card-B5svGaqA.js";import{X as $,E as B,G as H,I as z,H as V,J as q,K}from"./dialog-qbXy4GE2.js";import{L as k,I as Y}from"./label-Dff2Zjcb.js";import{T as G,a as J,b as T,c as p,d as O,e as j}from"./table-HuNaCQBJ.js";import{C as Q}from"./ConfirmDialog-CLal40kk.js";import{C as W}from"./CopyButton-D_EAOrl1.js";import{P as X,E as Z}from"./parts-CK9SS76R.js";import{b as D}from"./labels--UUyt9uB.js";import{u as _}from"./me-XTwFHhR6.js";import{C as ee}from"./check-C21x2mpF.js";import{U as se}from"./users--4QPa7AS.js";import{P as te}from"./plus-4APMJ4TC.js";import"./useBaseQuery-DI4GfUK8.js";import"./copy-Bik19B-3.js";function ke(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),i=C(N.links(s)),c=C(N.origins(s)),[m,o]=f.useState(!1),[n,t]=f.useState(null);f.useEffect(()=>t(null),[s]);const a=i.data?.data??[],x=c.data?.origins[0]?.replace(/\/+$/,"")??"",r=n?`${x}/${n.fragment}`:"",v=e.jsxs(g,{onClick:()=>o(!0),children:[e.jsx(te,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),n&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(ee,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[n.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:r}),e.jsx(W,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>t(null),children:e.jsx($,{})})]}),i.isSuccess&&a.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(Z,{icon:e.jsx(se,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(G,{children:[e.jsx(J,{children:e.jsxs(T,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(O,{children:a.map(u=>e.jsx(ne,{link:u,uid:s,onRevoked:()=>t(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(re,{uid:s,open:m,onOpenChange:o,onMinted:t})]})}function ne({link:s,uid:l,onRevoked:i}){const c=S(l),m=E(_().user.role,"settings"),[o,n]=f.useState(!1),t=!!s.revokedAt,a=!t&&new Date(s.expiresAt).getTime()<=Date.now(),x=t||a,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(T,{className:I(x&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",D(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",r," day",r===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?D(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&m&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(Q,{open:o,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:c.isPending,onConfirm:()=>{n(!1),i(),c.mutate(s.id)}})]})]})}const ae=M({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function re({uid:s,open:l,onOpenChange:i,onMinted:c}){const m=F(s),o=C({...N.rounds(s),enabled:l}),[n,t]=f.useState(""),{register:a,handleSubmit:x,formState:r,reset:v}=P({resolver:U(ae),defaultValues:{days:"14",roundId:""}}),u=x(async d=>{t("");const b=Number(d.days);try{const w=await m.mutateAsync({name:d.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...d.roundId?{roundId:d.roundId}:{}});c(w),v(),i(!1)}catch(w){t(L(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx(B,{open:l,onOpenChange:i,children:e.jsx(H,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(z,{children:[e.jsx(V,{children:"New reviewer"}),e.jsx(q,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Y,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!r.errors.name,...a("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...a("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),o.data&&o.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...a("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),o.data.data.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id))]})]}),e.jsxs(K,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:r.isSubmitting,children:r.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{ke as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,i as Fe,ak as de,ab as Me,e as ue,ac as Ye,E as me,k as he,j as e,al as Ue,f as Q,aa as je,aY as Qe,h as pe,q as ge,aZ as Je,a_ as Xe,B as T,A as Te,a$ as Ze,b0 as et,b1 as tt,p as st,b2 as nt}from"./index-CHi2CcHb.js";import{u as Le}from"./useQuery-U2FOgJPB.js";import{q as Ve,h as Ke,p as He,u as $e,j as at,c as it,n as ot,g as Re,f as rt,k as dt,l as lt,a as ct,I as ae,L as q}from"./label-Dff2Zjcb.js";import{a2 as ut,Q as mt,S as ft,N as ht,A as pt,aN as Ce,aI as we,aC as le,ay as ce,aO as ke,aP as Ie,a3 as gt,aQ as Ne,az as xt,aA as bt,aR as Se,aS as Ee,aT as Pe,aU as Ae,aV as vt,aW as yt,X as jt}from"./dialog-qbXy4GE2.js";import{u as Rt,C as Ct}from"./CompositeList-DrnyFTB0.js";import{s as wt,i as kt}from"./serializeValue-DRMAHja_.js";import{u as It}from"./useValueChanged-RTamjQR3.js";import{C as Nt}from"./CompositeItem-DqkA27tC.js";import{u as St}from"./FieldItemContext-Dvh77l6C.js";import{u as Et}from"./useAriaLabelledBy-B3107P7l.js";import{C as Be}from"./ConfirmDialog-CLal40kk.js";import{C as Pt}from"./CopyButton-D_EAOrl1.js";import{I as At}from"./InstallTag-Cld-E0Bc.js";import{B as Dt}from"./badge-DBzqpvfR.js";import{a as ee,A as Ot,P as Ft}from"./parts-CK9SS76R.js";import{u as xe}from"./me-XTwFHhR6.js";import{S as De}from"./switch-b0ERMUSk.js";import{S as Mt}from"./SaveState-BiYh2KgZ.js";import{P as Tt}from"./plus-4APMJ4TC.js";import"./useBaseQuery-DI4GfUK8.js";import"./check-C21x2mpF.js";import"./copy-Bik19B-3.js";import"./useRender-B8Yivtih.js";import"./card-B5svGaqA.js";import"./labels--UUyt9uB.js";const Lt=l.createContext(void 0);function Vt(s=!1){const t=l.useContext(Lt);if(!t&&!s)throw new Error(Fe(86));return t}function Kt(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}const fe={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...ut,...Ve},ze="data-composite-item-active",Ge=l.createContext(void 0);function Ht(){return l.useContext(Ge)}const We=l.createContext(void 0);function $t(){const s=l.useContext(We);if(s===void 0)throw new Error(Fe(52));return s}const Bt=l.forwardRef(function(t,n){const{render:d,className:a,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:o,inputRef:L,nativeButton:h=!1,id:O,style:y,...j}=t,w=Ht(),{disabled:E,readOnly:_,required:b,form:$,checkedValue:R,touched:F=!1,validation:B,name:k,setCheckedValue:W=de,setTouched:Y=de,registerInputRef:i=de}=w??{},{setTouched:g,setFilled:v,state:I,disabled:P}=Ke(),A=St(),{labelId:K,getDescriptionProps:J}=He(),m=P||A.disabled||E||c,f=_||r,V=b||p,H=$,N=w?R===o:o==="",M=l.useRef(null),S=l.useRef(null),z=B?.registerInput,G=l.useCallback(C=>z?.(C,{controlRef:M,value:void 0}),[z]),X=Me(L,S,i,G);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){i(null);return}i(S.current)}},[N,m,i]);const te=$e(),se=at({id:O,implicit:!1,controlRef:M}),ne=h?void 0:se,ie=Et(x,K,S,!h,ne),oe={role:"radio","aria-checked":N,"aria-labelledby":ie,[ze]:N?"":void 0,id:h?se:te,onKeyDown(C){C.key==="Enter"&&C.preventDefault()},onClick(C){if(C.defaultPrevented||m||f)return;C.preventDefault();const Z=S.current;Z&&Ue(Z,C)},onFocus(C){C.defaultPrevented||m||f||!F||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=Ye({disabled:m,native:h,composite:!1}),D={type:"radio",ref:X,form:H,id:ne,name:k,tabIndex:-1,style:k?mt:ft,"aria-hidden":!0,...o!==void 0?{value:wt(o)}:me,disabled:m,checked:N,required:V,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||o===void 0)return;const Z=it(ot,C.nativeEvent);W(o,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){M.current?.focus()}},U=l.useMemo(()=>({...I,required:V,disabled:m,readOnly:f,checked:N}),[I,m,f,N,V]),qe=U,be=w!==void 0,ve=[n,M,u],ye=[oe,j,re,J,B?C=>B.getValidationProps(m,C):me],_e=he("span",t,{enabled:!be,state:U,ref:ve,props:ye,stateAttributesMapping:fe});return e.jsxs(We.Provider,{value:qe,children:[be?e.jsx(Nt,{tag:"span",render:d,className:a,style:y,state:U,refs:ve,props:ye,stateAttributesMapping:fe}):_e,e.jsx("input",{...D,suppressHydrationWarning:!0})]})}),zt=l.forwardRef(function(t,n){const{render:d,className:a,style:c,keepMounted:r=!1,...p}=t,x=$t(),o=x.checked,{mounted:L,transitionStatus:h,setMounted:O}=ht(o),y={...x,transitionStatus:h},j=l.useRef(null),w=r||L,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return pt({open:o,ref:j,onComplete(){o||O(!1)}}),w?E:null}),Gt=[];function Wt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:a,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:o=!1,stopEventPropagation:L,disabledIndices:h,modifierKeys:O=Gt}=s,[y,j]=l.useState(0),w=d!=null,E=l.useRef(null),_=Me(E,x),b=l.useRef([]),$=l.useRef(!1),R=r??y,F=Q((i,g=!1)=>{if((p??j)(i),g){const v=b.current[i];Ce(E.current,v,c,n)}}),B=Q(i=>{if(i.size===0||$.current)return;$.current=!0;const g=Array.from(i.keys()),v=g.find(P=>P?.hasAttribute(ze))??null,I=v?i.get(v)?.index??-1:-1;if(I!==-1)F(I);else if(we(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||F(P)}Ce(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!$.current)return;const i=b.current;if(we(i,R,h)){const g=le(i,{disabledIndices:h});ce(i,g)||F(g)}},[h,r,R,b,F]);const k=Q((i,g,v)=>a?a(i,g,v,b):v),W=Q(i=>{const g=i.key===ke||i.key===Ie;if(!gt.has(i.key)||!o&&g||qt(i,O)||!E.current)return;const I=c==="rtl",P=I?Pe:Ae,A=I?Ae:Pe,K=n==="vertical"?Se:P,J=n==="vertical"?Ee:A,m=Re(i.nativeEvent);if(m!=null&&Ne(m)&&!kt(m)){const S=m.selectionStart,z=m.selectionEnd,G=m.value;if(S==null||i.shiftKey||S!==z||i.key!==J&&S<G.length||i.key!==K&&S>0)return}let f=R;const V=xt(b,h),H=bt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:i,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:V,onLoop:k,orientation:n,rtl:I}));const N=n!=="vertical"&&i.key===P||n!=="horizontal"&&i.key===Se,M=n!=="vertical"&&i.key===A||n!=="horizontal"&&i.key===Ee;o&&(i.key===ke?f=V:i.key===Ie&&(f=H)),f===R&&(N||M)&&(t&&f===H&&N?(f=V,a&&(f=a(i,R,f,b))):t&&f===V&&M?(f=H,a&&(f=a(i,R,f,b))):f=le(b.current,{startingIndex:f,decrement:M,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(L&&i.stopPropagation(),(w||g||N||M)&&i.preventDefault(),F(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(i){const g=E.current,v=Re(i.nativeEvent);!g||v==null||!Ne(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:W},highlightedIndex:R,onHighlightedIndexChange:F,elementsRef:b,onMapChange:B,relayKeyboardEvent:W}}function qt(s,t){for(const n of vt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function _t(s){const{render:t,className:n,style:d,refs:a=je,props:c=je,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:o,orientation:L,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:w,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:$,highlightItemOnHover:R=!1,tag:F="div",...B}=s,k=Rt(),{props:W,highlightedIndex:Y,onHighlightedIndexChange:i,elementsRef:g,onMapChange:v,relayKeyboardEvent:I}=Wt({grid:h,loopFocus:O,onLoop:y,orientation:L,highlightedIndex:x,onHighlightedIndexChange:o,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:k,disabledIndices:b,modifierKeys:$}),P=he(F,s,{state:r,ref:a,props:[W,...c,B],stateAttributesMapping:p}),A=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:i,highlightItemOnHover:R,relayKeyboardEvent:I}),[Y,i,R,I]);return e.jsx(Qe.Provider,{value:A,children:e.jsx(Ct,{elementsRef:g,onMapChange:K=>{w?.(K),v(K)},children:P})})}const Yt=[yt],Ut=l.forwardRef(function(t,n){const{render:d,className:a,disabled:c,readOnly:r,required:p,onValueChange:x,value:o,defaultValue:L,form:h,name:O,inputRef:y,id:j,style:w,...E}=t,{setTouched:_,setFocused:b,validationMode:$,name:R,disabled:F,state:B,validation:k,setDirty:W,setFilled:Y,validityData:i}=Ke(),{labelId:g}=He(),{clearErrors:v,elementRef:I}=rt(),P=Vt(!0),A=F||c,K=R??O,J=$e(j),[m,f]=dt({controlled:o,default:L,name:"RadioGroup",state:"value"}),[V,H]=l.useState(!1),N=Q((u,D)=>{x?.(u,D),!D.isCanceled&&f(u)}),M=k.getInputControl,S=l.useMemo(()=>({get current(){return M()}}),[M]),z=l.useRef(null),G=l.useRef(null);function X(u){let D;return y&&(typeof y=="function"?D=y(u):y.current=u),z.current=u,D}const te=Q(u=>{if(!u||u.disabled)return;G.current||(G.current=u);const D=z.current,U=u.checked||D==null||D.disabled?X(u):void 0;return()=>{G.current===u&&(G.current=null),z.current===u?U?(U(),z.current=null):X(null):U?.()}}),se=Q(()=>{const u=I.current;if(!u)return m??null;for(const D of k.registeredInputs.keys())if(D.checked&&Kt(D,u))return m??null;return null});lt(S,J,m??null,se,!A,O),It(m,()=>{v(K),W(m!==i.initialValue),Y(m!=null),k.change(m);const u=G.current;m==null&&u&&!u.disabled&&X(u)});const ne=g??P?.legendId,ie={...B,disabled:A??!1,required:p??!1,readOnly:r??!1},oe=l.useMemo(()=>({checkedValue:m,disabled:A,form:h,validation:k,name:K,readOnly:r,registerInputRef:te,required:p,setCheckedValue:N,setTouched:H,touched:V}),[m,A,h,k,K,r,te,p,N,H,V]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":A||void 0,"aria-readonly":r||void 0,"aria-labelledby":ne,onFocus(){b(!0)},onBlur(u){ct(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),$==="onBlur"&&k.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(Ge.Provider,{value:oe,children:e.jsx(_t,{render:d,className:a,style:w,state:ie,props:[re,E,u=>k.getValidationProps(A??!1,u)],refs:[n],stateAttributesMapping:Ve,enableHomeAndEndKeys:!1,modifierKeys:Yt})})});function Qt({className:s,...t}){return e.jsx(Ut,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Jt({className:s,...t}){return e.jsx(Bt,{"data-slot":"radio-group-item",className:pe("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...t,children:e.jsx(zt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}function Xt({uid:s}){const t=xe(),n=Le(Te.rounds(s)),d=ge(t.user.role,"settings"),a=n.data?.data??[],c=a.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ee,{title:"Rounds",description:e.jsx(e.Fragment,{children:"One pass of feedback each, and several can run at once — your own QA beside the client's. A new comment goes to the round its reviewer is looking at. Archive a finished round to put it away; delete removes its comments too."}),children:[!d&&e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:"Only an owner or an admin can change rounds."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col divide-y divide-border p-0","aria-label":"Rounds",children:[a.map(r=>e.jsx(Zt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&a.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const Oe="Open another round first — new comments need somewhere to go.";function Zt({uid:s,round:t,manager:n,last:d}){const a=Je(s),c=Xe(s),[r,p]=l.useState(!1),[x,o]=l.useState(t.name),[L,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=a.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const w=x.trim();if(!w||w===t.name)return p(!1);a.mutate({id:t.id,name:w},{onSuccess:()=>p(!1)})},children:[e.jsx(ae,{"aria-label":`New name for ${t.name}`,value:x,maxLength:80,autoFocus:!0,onChange:j=>o(j.target.value),onKeyDown:j=>j.key==="Escape"&&p(!1)}),e.jsx(T,{type:"submit",size:"sm",disabled:!x.trim()||a.isPending,children:"Save"}),e.jsx(T,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(!1),children:"Cancel"})]}):e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13.5px] font-medium",children:t.name}),e.jsx(Dt,{variant:"outline",className:"text-[11px]",children:O})]}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] text-muted-foreground",children:["Round ",t.number," · ",t.threads," ",t.threads===1?"comment":"comments",t.unresolved>0?` · ${t.unresolved} unresolved`:""]})]}),n&&!r&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",title:d?Oe:void 0,children:[e.jsx(T,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{o(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(T,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>a.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(T,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>a.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(T,{size:"sm",variant:"ghost",className:"text-destructive","aria-label":`Delete ${t.name}`,disabled:y||d,onClick:()=>h(!0),children:"Delete…"})]}),n&&d&&!r&&e.jsx("p",{className:"m-0 w-full text-[12px] text-muted-foreground",children:Oe}),e.jsx(Be,{open:L,onOpenChange:h,title:`Delete ${t.name}?`,description:t.threads>0?e.jsxs(e.Fragment,{children:["This deletes the round and"," ",e.jsxs("b",{className:"font-semibold text-foreground",children:[t.threads," ",t.threads===1?"comment":"comments"," and their screenshots"]}),". Reviewers stop seeing them straight away. To keep them out of sight instead, archive the round."]}):e.jsxs(e.Fragment,{children:["This round has no comments. Its number, Round ",t.number,", is not used again."]}),confirmLabel:"Delete round",confirmWord:t.name,busy:c.isPending,onConfirm:()=>c.mutate({id:t.id,confirm:t.name},{onSuccess:()=>h(!1)})})]})}const es=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function ts(){const{site:s}=Ze.useParams(),t=xe(),n=t.projects.find(o=>o.uid===s),d=ge(t.user.role,"settings"),a=Le(Te.origins(s)),c=et(s),[r,p]=l.useState(null),x=o=>c.mutate(o,{onSuccess:()=>p(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Ft,{title:"Settings",sub:n.name,actions:e.jsx(Mt,{saving:c.isPending,savedAt:r})}),e.jsxs(ee,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:n.uid}),e.jsx(Pt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(ss,{name:n.name,onSave:o=>x({name:o})}),e.jsx(ns,{domain:a.data?.domain??null,loaded:a.isSuccess,onSave:o=>x({domain:o})}),e.jsx(as,{list:a.data?.origins??[],loaded:a.isSuccess,hasDomain:!!a.data?.domain,onChange:o=>x({origins:o})})]}),e.jsxs(ee,{title:"Widget",description:"Whether it runs, who the toolbar appears for, what guests may do, and the tag itself.",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx(De,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:o=>x({status:o?"active":"paused"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"guests-status",className:"text-[13px] font-medium",children:"Guests can change status"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:["People who comment without an account or a review link can move a comment between Open, In progress, In review and Resolved.",!d&&" Only an owner or an admin can change this."]})]}),e.jsx(De,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!d,onCheckedChange:o=>x({guestsCanChangeStatus:o})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{children:"Who can comment"}),e.jsx(Qt,{value:n.writeMode,onValueChange:o=>x({writeMode:String(o)}),className:"gap-2",children:es.map(o=>e.jsxs("label",{className:pe("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===o.id&&"border-brand bg-brand-soft"),children:[e.jsx(Jt,{value:o.id,className:"mt-0.5","aria-label":o.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:o.note})]})]},o.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"The tag"}),e.jsx(At,{uid:n.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx(Xt,{uid:s}),e.jsx(is,{uid:s,name:n.name,archived:!!n.archived,locked:!!n.locked}),e.jsx(os,{uid:s,name:n.name})]})}function ss({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const a=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),a&&t(n.trim())},children:[e.jsx(q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-name",value:n,onChange:c=>d(c.target.value)}),a&&e.jsx(T,{type:"submit",variant:"outline",children:"Save"})]})]})}function ns({domain:s,loaded:t,onSave:n}){const[d,a]=l.useState(s??"");l.useEffect(()=>a(s??""),[s]);const c=d.trim()!==(s??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:r=>{r.preventDefault(),c&&n(d.trim()||null)},children:[e.jsx(q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-domain",placeholder:"kilnwork.studio",value:d,onChange:r=>a(r.target.value),disabled:!t}),c&&e.jsx(T,{type:"submit",variant:"outline",children:d.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function as({list:s,loaded:t,hasDomain:n,onChange:d}){const[a,c]=l.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[s.map(r=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:r}),e.jsx(T,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r}`,disabled:s.length<=1&&!n,onClick:()=>d(s.filter(p=>p!==r)),children:e.jsx(jt,{})})]},r)),t&&s.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:r=>{r.preventDefault();const p=a.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:a,onChange:r=>c(r.target.value)}),e.jsxs(T,{type:"submit",variant:"outline",disabled:!a.trim(),children:[e.jsx(Tt,{}),"Add"]})]})]})}function is({uid:s,name:t,archived:n,locked:d}){const a=tt(s);return e.jsx(ee,{title:n?"Restore this site":"Archive this site",description:n?"Its widget takes comments again and it counts toward the plan. Restoring needs room on the plan.":"For a site you have finished with. Every comment is kept and can be read, the widget stops taking new ones, and the site no longer counts toward the plan.",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:n?`${t} is archived.`:d?`${t} is read-only because the studio is over its plan. Archiving another site frees a place.`:"You can restore it at any time."}),e.jsx(T,{type:"button",variant:"outline",loading:a.isPending,onClick:()=>a.mutate(n?"restore":"archive"),children:n?`Restore ${t}`:`Archive ${t}`})]})})}function os({uid:s,name:t}){const[n,d]=l.useState(!1),a=st(),c=nt(s);return e.jsxs(ee,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(T,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(Be,{open:n,onOpenChange:d,title:`Delete ${t}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:t,busy:c.isPending,onConfirm:()=>c.mutate(void 0,{onSuccess:()=>{d(!1),a({to:"/sites"})}})})]})}const Ds=()=>ge(xe().user.role,"settings")?e.jsx(ts,{}):e.jsx(Ot,{title:"Settings",children:e.jsx("p",{className:"m-0",children:"A site's addresses, who may comment, the widget and its rounds are set by an owner or an admin of the studio."})});export{Ds as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as x,p as h,r as g,s as f,z as j,J as N,C as w,j as e,G as b,B as y,D as S,F as r}from"./index-
|
|
1
|
+
import{T as x,p as h,r as g,s as f,z as j,J as N,C as w,j as e,G as b,B as y,D as S,F as r}from"./index-CHi2CcHb.js";import{u as v,a as F}from"./zod-dogyqr67.js";import{L as i,I as o}from"./label-Dff2Zjcb.js";const A=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:F(A)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as N,p as y,r as l,A as m,s as S,z as C,C as F,j as e,G as k,B as E,L as c,h as L,D as R,F as u}from"./index-
|
|
1
|
+
import{U as N,p as y,r as l,A as m,s as S,z as C,C as F,j as e,G as k,B as E,L as c,h as L,D as R,F as u}from"./index-CHi2CcHb.js";import{u as x}from"./useQuery-U2FOgJPB.js";import{u as z,a as A}from"./zod-dogyqr67.js";import{L as p,I as h}from"./label-Dff2Zjcb.js";import{C as I}from"./chevron-right-ZLZCd12m.js";import"./useBaseQuery-DI4GfUK8.js";const U=R({email:u().trim().min(1,"Your email"),password:u().min(1,"Your password")});function P(){const{redirect:f}=N.useSearch(),a=y(),[o,i]=l.useState(""),[s,g]=l.useState(!1),{register:n,handleSubmit:j,formState:r}=z({resolver:A(U)});x({...m.claimed(),enabled:!0}).data===!1&&a({to:"/setup",replace:!0});const t=x(m.setupState()),b=j(async({email:v,password:w})=>{i("");try{await S.login(v,w),C("in"),a({to:f??"/sites",replace:!0})}catch(d){i(d instanceof F?d.message:"Could not reach the server.")}});return e.jsx(k,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...n("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...n("password")})]}),e.jsx(E,{type:"submit",size:"lg",loading:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),t.data?.mail?e.jsx("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:e.jsx(c,{to:"/forgot",className:"text-foreground underline underline-offset-4",children:"Forgot your password?"})}):e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>g(!s),children:[e.jsx(I,{className:L("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),t.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",t.data.signupUrl?e.jsx("a",{href:t.data.signupUrl,className:"text-foreground underline underline-offset-4",children:"Create a studio"}):e.jsx(c,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&!t.data?.mail&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"This instance has no mail set up, so there's no reset email — and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{P as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p,r as u,s as h,z as g,J as f,C as j,j as e,G as N,B as w,L as v,D as y,F as t}from"./index-
|
|
1
|
+
import{p,r as u,s as h,z as g,J as f,C as j,j as e,G as N,B as w,L as v,D as y,F as t}from"./index-CHi2CcHb.js";import{u as b,a as S}from"./zod-dogyqr67.js";import{L as i,I as o}from"./label-Dff2Zjcb.js";const C=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(C)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as w,a1 as y,r as p,j as e,B as m,L as N,p as A,d as S,s as $,C as k,D as C,F as g}from"./index-CHi2CcHb.js";import{u as E,a as _}from"./zod-dogyqr67.js";import{C as D}from"./card-B5svGaqA.js";import{E as F,G as I,I as L,H as P,J as T,K as z}from"./dialog-qbXy4GE2.js";import{L as f,I as j}from"./label-Dff2Zjcb.js";import{P as q,E as H}from"./parts-CK9SS76R.js";import{b as K}from"./labels--UUyt9uB.js";import{u as R}from"./me-XTwFHhR6.js";import{P as b}from"./plus-4APMJ4TC.js";import{L as B}from"./layout-grid-C3Koxvvp.js";import{I as G}from"./image-off-DkzQHm8a.js";import"./useBaseQuery-DI4GfUK8.js";function ae(){const s=R(),i=w(s.user.role,"settings"),{add:d}=y.useSearch(),[x,n]=p.useState(!!d&&i);p.useEffect(()=>{d&&i&&n(!0)},[d,i]);const a=s.projects.filter(r=>!r.archived),l=s.projects.filter(r=>r.archived),h=a.reduce((r,o)=>r+o.unresolved,0),t=s.limits.projects.limit,c=t!==null&&a.length>=t,u=t!==null&&a.length>t;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:a.length?`${a.length}${t!==null?` of ${t}`:""} site${a.length===1&&t===null?"":"s"} · ${h} open`:t!==null?`0 of ${t} sites`:void 0,actions:i?e.jsxs(m,{onClick:()=>n(!0),disabled:c,title:c?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(b,{}),"Add a site"]}):void 0}),u&&e.jsxs("div",{role:"status",className:"mb-5 max-w-[1100px] rounded-md border border-border bg-warn-soft px-4 py-3 text-[13px]",children:["This studio has ",a.length," sites and its plan includes ",t,". The newest ",a.length-t," ",a.length-t===1?"is":"are"," ","read-only: comments can be read, nothing new comes in."," ",i?"Archive a site you have finished with, or move to a plan with more.":"An owner or an admin can archive a site or change the plan."]}),a.length===0?e.jsx(D,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(B,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(b,{}),"Add a site"]}):void 0,children:i?"A site is one client website. Add it, paste the tag, and comments start arriving here.":"A site is one client website. An owner or an admin adds it, and its comments appear here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:a.map(r=>e.jsx(v,{p:r},r.uid))}),l.length>0&&e.jsxs("section",{className:"mt-10 max-w-[1100px]","aria-labelledby":"archived-sites",children:[e.jsx("h2",{id:"archived-sites",className:"m-0 mb-1 text-[14px] font-semibold",children:"Archived"}),e.jsx("p",{className:"m-0 mb-4 text-[12.5px] text-muted-foreground",children:"Finished or put away. Every comment is kept and can be read; nothing new comes in, and they do not count toward the plan."}),e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:l.map(r=>e.jsx(v,{p:r},r.uid))})]}),e.jsx(U,{open:x,onOpenChange:n})]})}function v({p:s}){const i=s.archived?"Archived":s.locked?"Read-only":s.status==="paused"?"Paused":null;return e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:`flex h-[150px] items-center justify-center border-b border-border bg-background${s.archived?" opacity-70 grayscale":""}`,children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(G,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),i&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:i})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${K(s.lastActivityAt)}`:""}`})]})]})}const Q=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function U({open:s,onOpenChange:i}){const d=A(),x=S(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=E({resolver:_(Q)}),u=h(async r=>{a("");try{const o=await $.createProject(r.name,"",r.domain);await x.invalidateQueries({queryKey:["me"]}),c(),i(!1),d({to:"/s/$site/comments",params:{site:o.uid}})}catch(o){a(o instanceof k?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(I,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(L,{children:[e.jsx(P,{children:"Add a site"}),e.jsx(T,{children:"One client website. The tag it needs is shown right after."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!t.errors.name,...l("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!t.errors.domain,...l("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(m,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(m,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add site"})]})]})})})}export{ae as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as o,A as s,
|
|
1
|
+
import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-CHi2CcHb.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-CHi2CcHb.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as N,j as e,w as k,a4 as w,r as d,B as p,S as A,d as C,a5 as F,a2 as E,A as m,a6 as R,s as D}from"./index-CHi2CcHb.js";import{u as h}from"./useQuery-U2FOgJPB.js";import{L as O,I as v}from"./label-Dff2Zjcb.js";import{I as P,S as q}from"./InstanceRows-DexbQngM.js";import{A as z,P as G,a as g}from"./parts-CK9SS76R.js";import{u as S}from"./me-XTwFHhR6.js";import{S as I}from"./SaveState-BiYh2KgZ.js";import{b as L}from"./studio-BtXg0XzE.js";import{c as T}from"./update-duXzIzFS.js";import"./useBaseQuery-DI4GfUK8.js";import"./dialog-qbXy4GE2.js";import"./ConfirmDialog-CLal40kk.js";import"./labels--UUyt9uB.js";import"./card-B5svGaqA.js";function U(){const s=S(),t=h(m.meta()),i=h(m.members()),r=L(),n=N(s.user.role,"studio"),u=k(s),c=w(s),o=!h(m.setupState()).data?.billingUrl,[l,a]=d.useState(s.org.name),[b,y]=d.useState(null);d.useEffect(()=>a(s.org.name),[s.org.name]);const j=n&&l.trim().length>0&&l.trim()!==s.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:s.org.name,actions:e.jsx(I,{saving:r.isPending,savedAt:b})}),e.jsx(g,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:f=>{f.preventDefault(),j&&r.mutate(l.trim(),{onSuccess:()=>y(Date.now())})},children:[e.jsx(O,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{id:"studio-name",value:l,readOnly:!n,onChange:f=>a(f.target.value)}),j&&e.jsx(p,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:n?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(g,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[t.data?.version??"—"," ",e.jsx(_,{version:t.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(B,{owner:n})}),t.data?.commit&&t.data.commit!=="unknown"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[t.data.commit.slice(0,12),t.data.modified?" · modified":""]})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[s.projects.length," · ",i.data?.data.length??"—"]})]})]})}):o?e.jsx(g,{title:"This studio",description:"What is in it.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites"}),e.jsx("dd",{className:"m-0",children:s.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:i.data?.data.length??"—"})]})}):null,c==="instance"?e.jsx(P,{owner:n}):c==="usage"?e.jsx(q,{}):null]})}function _({version:s}){const[t,i]=d.useState({s:"idle"});return t.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),T(s).then(r=>i({s:"done",r})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):t.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," checking…"]}):t.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:t.r?.newer?`· ${t.r.latest} is out`:"· up to date"})}function B({owner:s}){const t=C(),i=h(m.instance()),[r,n]=d.useState(null),[u,c]=d.useState(""),x=F({mutationFn:a=>D.setAddress(a),onSuccess:a=>{t.setQueryData(m.instance().queryKey,a),n(null),c(""),R.success("Address saved — every new link is built from it")},onError:a=>c(E(a))}),o=i.data?.address;if(!o)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const l=o.source==="env";return r===null||!s||l?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:o.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:l?"· set by the environment (SNAGSET_BASE_URL)":o.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),s&&!l&&e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>n(o.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(r.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(v,{"aria-label":"Address",value:r,onChange:a=>n(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(p,{type:"submit",size:"sm",loading:x.isPending,disabled:!r.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:"Cancel"})]}),u&&e.jsx("span",{className:"text-[12px] text-destructive",children:u}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const ae=()=>N(S().user.role,"settings")?e.jsx(U,{}):e.jsx(z,{title:"General"});export{ae as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as U,j as e,L as ee,w as te,d as se,r as a,a5 as F,a6 as I,a2 as M,s as T,a7 as D,$ as ne,B as y,C as K,A as oe}from"./index-CHi2CcHb.js";import{u as q}from"./useQuery-U2FOgJPB.js";import{B as _}from"./badge-DBzqpvfR.js";import{E,G as O,I as W,H as R,J,K as H}from"./dialog-qbXy4GE2.js";import{L as C,I as A}from"./label-Dff2Zjcb.js";import{C as ae}from"./ConfirmDialog-CLal40kk.js";import{A as re,P as ie,a as ce}from"./parts-CK9SS76R.js";import{u as z}from"./me-XTwFHhR6.js";import{C as B}from"./CopyButton-D_EAOrl1.js";import{b as le}from"./labels--UUyt9uB.js";import{M as de}from"./McpTokens-CIjBwfT0.js";import"./useBaseQuery-DI4GfUK8.js";import"./useRender-B8Yivtih.js";import"./card-B5svGaqA.js";import"./check-C21x2mpF.js";import"./copy-Bik19B-3.js";import"./switch-b0ERMUSk.js";import"./useAriaLabelledBy-B3107P7l.js";import"./useValueChanged-RTamjQR3.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=z(),i=U(o.user.role,"settings"),x=U(o.user.role,"studio")&&te(o),f=q(oe.integrations()),S=se(),w=()=>S.invalidateQueries({queryKey:["integrations"]}),[l,u]=a.useState(null),[r,g]=a.useState(null),[j,m]=a.useState(null),b=F({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>m({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>I.error(M(t))}),N=F({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(c=>({...c,provider:s})),onSuccess:t=>{I[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),w()},onError:t=>I.error(M(t))}),k=F({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{g(null),w()},onError:t=>I.error(M(t))}),v=f.data?.data??[],h=t=>v.filter(s=>s.provider===t),d=t=>o.projects.filter(s=>!h(t).some(c=>c.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=h(t),c=d(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[f.isPending&&e.jsx(ne,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const P=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(_,{variant:"outline",className:P.tone==="ok"?"border-ok text-ok":P.tone==="bad"?"border-destructive text-destructive":"",children:P.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),i&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",loading:b.isPending,onClick:()=>b.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>m({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",loading:N.isPending,onClick:()=>N.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>g(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),i&&c.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>u(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:i,instanceOwner:x,sites:o.projects}),e.jsx(ue,{open:l==="github",onOpenChange:t=>!t&&u(null),sites:d("github"),onDone:(t,s)=>{w(),s&&m({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(xe,{open:l==="linear",onOpenChange:t=>!t&&u(null),sites:d("linear"),onDone:(t,s)=>{w(),m({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(fe,{open:l==="jira",onOpenChange:t=>!t&&u(null),sites:d("jira"),onDone:(t,s)=>{w(),m({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ge,{open:l==="slack",onOpenChange:t=>!t&&u(null),sites:d("slack"),onDone:()=>void w()}),e.jsx(pe,{state:j,onClose:()=>m(null),siteName:t=>v.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(ae,{open:r!==null,onOpenChange:t=>!t&&g(null),title:`Disconnect ${r?.siteName??"this site"} from ${r?D[r.provider]:"the tracker"}?`,description:r?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:k.isPending,onConfirm:async()=>{r&&await k.mutateAsync({uid:r.site,provider:r.provider})}})]})}function ue({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"github",{repository:l.trim(),token:r.trim(),labels:j,createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook&&"secret"in c.webhook?c.webhook:void 0),I.success("GitHub connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:s=>u(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:j,onChange:s=>m(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:i,siteName:x}){const f=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:S=>!S&&i(),children:e.jsxs(O,{children:[e.jsxs(W,{children:[e.jsx(R,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?x(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(B,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(B,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(y,{type:"button",onClick:i,children:"Done"})})]})})}function xe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"linear",{team:l.trim(),apiKey:r.trim(),...j.trim()?{webhookSecret:j.trim()}:{},createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),I.success("Linear connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:j,onChange:s=>m(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(""),[k,v]=a.useState(""),[h,d]=a.useState(!1),[t,s]=a.useState(""),c=F({mutationFn:p=>T.connectTracker(p,"jira",{siteUrl:l.trim(),project:r.trim(),email:j.trim(),apiToken:b.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:h?"thread.created":"manual"})}),n=S||x[0]?.uid||"",P=async p=>{p.preventDefault(),s("");try{const L=await c.mutateAsync(n);g(""),N(""),v(""),d(!1),i(!1),f(n,L.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),I.success("Jira connected")}catch(L){s(L instanceof K?L.message:"Could not reach the server.")}},$=(p,L,V,Q,Y,X="text",G)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${p}`,children:L}),e.jsx(A,{id:`jr-${p}`,type:X,placeholder:Y,value:V,onChange:Z=>Q(Z.target.value),autoComplete:"off"}),G&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:G})]});return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:p=>void P(p),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:n,onChange:p=>w(p.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(p=>e.jsx("option",{value:p.uid,children:p.name},p.uid))})]}),$("url","Jira site",l,u,"https://kilnwork.atlassian.net"),$("project","Project key",r,g,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",j,m,"you@kilnwork.studio","email"),$("token","API token",b,N,"","password"),$("secret","Webhook secret",k,v,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:p=>d(p.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:c.isPending,disabled:!l.trim()||!r.trim()||!j.trim()||!b.trim()||!n,children:c.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(!0),[b,N]=a.useState(""),k=q({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:o,staleTime:1/0}),v=F({mutationFn:t=>T.connectTracker(t,"slack",{channel:l.trim(),token:r.trim(),createOn:j?"thread.created":"manual"})}),h=S||x[0]?.uid||"",d=async t=>{t.preventDefault(),N("");try{await v.mutateAsync(h),u(""),g(""),m(!0),i(!1),f(h),I.success("Slack connected")}catch(s){N(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void d(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),b&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:b}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:h,onChange:t=>w(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!k.data,render:e.jsx("a",{href:k.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:r,onChange:t=>g(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:t=>u(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:j,onChange:t=>m(t.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:v.isPending,disabled:!l.trim()||!r.trim()||!h,children:v.isPending?"Checking…":"Connect"})]})]})})})}const We=()=>U(z().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(ee,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{We as component};
|