@snagset/server 0.1.35 → 0.1.37
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 +5 -0
- package/dist/app.js.map +1 -1
- package/dist/routes/account.js +2 -1
- package/dist/routes/account.js.map +1 -1
- package/dist/routes/assignees.js +10 -0
- package/dist/routes/assignees.js.map +1 -1
- package/dist/routes/commentEdit.js +15 -3
- package/dist/routes/commentEdit.js.map +1 -1
- package/dist/routes/comments.js +6 -0
- package/dist/routes/comments.js.map +1 -1
- package/dist/routes/instance.js +8 -1
- package/dist/routes/instance.js.map +1 -1
- package/dist/routes/integrations.js +19 -12
- package/dist/routes/integrations.js.map +1 -1
- package/dist/routes/invites.js +36 -20
- package/dist/routes/invites.js.map +1 -1
- package/dist/routes/mcpTokens.js +17 -11
- package/dist/routes/mcpTokens.js.map +1 -1
- package/dist/routes/members.js +9 -7
- package/dist/routes/members.js.map +1 -1
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/reviewLinks.js +13 -0
- package/dist/routes/reviewLinks.js.map +1 -1
- package/dist/routes/rounds.js +7 -3
- package/dist/routes/rounds.js.map +1 -1
- package/dist/routes/sessions.js +7 -4
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/sites.js +22 -13
- package/dist/routes/sites.js.map +1 -1
- package/dist/routes/threads.js +43 -10
- package/dist/routes/threads.js.map +1 -1
- package/dist/studioReviewers.js +3 -1
- package/dist/studioReviewers.js.map +1 -1
- package/dist/vendor/types/names.js +2 -0
- package/dist/vendor/types/roles.js +65 -0
- package/package.json +1 -1
- package/static/dashboard/assets/CompositeItem-CJog0hVD.js +1 -0
- package/static/dashboard/assets/{ConfirmDialog-s6KLZt6w.js → ConfirmDialog-D2seMnrm.js} +1 -1
- package/static/dashboard/assets/{CopyButton-Cqz1MLVB.js → CopyButton-Bc4lyikk.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-4dJ9QpEG.js → FieldItemContext-CzXi3fsx.js} +1 -1
- package/static/dashboard/assets/{InstallTag-B4frNgVO.js → InstallTag-SMFR2B0h.js} +1 -1
- package/static/dashboard/assets/McpTokens-BXqxvFAS.js +1 -0
- package/static/dashboard/assets/{SaveState-DfBHRtEq.js → SaveState-Cmf4iv03.js} +1 -1
- package/static/dashboard/assets/_app-DwywpWfz.js +56 -0
- package/static/dashboard/assets/{_app-5y2NMiTw.js → _app-bdnugJ8u.js} +1 -1
- package/static/dashboard/assets/activity-qDQs5Zz8.js +1 -0
- package/static/dashboard/assets/{arrow-left-iXAzDNV6.js → arrow-left-CDK8KGdH.js} +1 -1
- package/static/dashboard/assets/{avatar-DkFTIwsR.js → avatar-BIbCnV-M.js} +1 -1
- package/static/dashboard/assets/badge-BD0L3Rdr.js +1 -0
- package/static/dashboard/assets/{card-C4v3pSqd.js → card-CCRzd-vJ.js} +1 -1
- package/static/dashboard/assets/{check-BKP4SJjJ.js → check-CvTMcsU6.js} +1 -1
- package/static/dashboard/assets/{chevron-right-BVbfidnK.js → chevron-right-NPSJD-jD.js} +1 -1
- package/static/dashboard/assets/{copy-nRZWPHR1.js → copy-CwAe5Q6l.js} +1 -1
- package/static/dashboard/assets/{dialog-lgIL_ZCX.js → dialog-CvU77XfW.js} +2 -2
- package/static/dashboard/assets/{dropdown-menu-DyLLQk8L.js → dropdown-menu-VHkK2Dt7.js} +1 -1
- package/static/dashboard/assets/{image-off-B6flKQEZ.js → image-off-wPLko91u.js} +1 -1
- package/static/dashboard/assets/index-B1JGVSdd.js +169 -0
- package/static/dashboard/assets/index-CpG77B7f.css +1 -0
- package/static/dashboard/assets/invite-DWNnOuAZ.js +1 -0
- package/static/dashboard/assets/{label-CL3Ivlhy.js → label-C6rZlF0y.js} +1 -1
- package/static/dashboard/assets/labels-DhKmOzOU.js +1 -0
- package/static/dashboard/assets/{layout-grid-B-9bb2Av.js → layout-grid-CPYmheoR.js} +1 -1
- package/static/dashboard/assets/parts-sBoh2K5o.js +6 -0
- package/static/dashboard/assets/{plus-BOeukd4A.js → plus-B7K-9XU0.js} +1 -1
- package/static/dashboard/assets/s._site-DKfVuunu.js +1 -0
- package/static/dashboard/assets/s._site.comments-DqDBqjhy.js +54 -0
- package/static/dashboard/assets/s._site.reviewers-yBn4jjwr.js +1 -0
- package/static/dashboard/assets/s._site.settings-CsiWJZ8D.js +1 -0
- package/static/dashboard/assets/{setup-DjA-0YhC.js → setup-DrjzRZp8.js} +1 -1
- package/static/dashboard/assets/{sign-in-vMnULz18.js → sign-in-BsM2n_hk.js} +1 -1
- package/static/dashboard/assets/sign-up-BXcvVUC-.js +1 -0
- package/static/dashboard/assets/sites-DRTZAXN_.js +1 -0
- package/static/dashboard/assets/studio-CEwWJLvF.js +1 -0
- package/static/dashboard/assets/{studio-CBGrW0G1.js → studio-DdM6OVdO.js} +1 -1
- package/static/dashboard/assets/studio.index-BOXLD6ah.js +1 -0
- package/static/dashboard/assets/studio.integrations-B7XK6X3K.js +1 -0
- package/static/dashboard/assets/studio.members-DSJEjb1M.js +6 -0
- package/static/dashboard/assets/{sun-ygOg7Lon.js → sun-DojiLt7X.js} +1 -1
- package/static/dashboard/assets/{switch-CYLwE1-9.js → switch-SJYZN0-3.js} +1 -1
- package/static/dashboard/assets/{table-BgojscGP.js → table-BDQkr8bT.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-Ce10PDSC.js → useAriaLabelledBy-BDqDB_Wq.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-BI_bJwNl.js → useBaseQuery-DXKWEN1Y.js} +1 -1
- package/static/dashboard/assets/useQuery-BCK_zdLj.js +1 -0
- package/static/dashboard/assets/useRender-hAtJO9As.js +1 -0
- package/static/dashboard/assets/{useValueChanged-Dh5Yg1r8.js → useValueChanged-B9j_H2Sq.js} +1 -1
- package/static/dashboard/assets/{users-BXCV1C3P.js → users-jrxD0Qlm.js} +1 -1
- package/static/dashboard/assets/{welcome-C9fdUqeW.js → welcome-BGT16RMO.js} +3 -3
- package/static/dashboard/assets/{widget-signin-DiXxk1Ln.js → widget-signin-A_kxUEvx.js} +1 -1
- package/static/dashboard/assets/you-CdfLrYaC.js +1 -0
- package/static/dashboard/assets/{zod-khKoKeAB.js → zod-C7-R6TNW.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.capture.js +1 -1
- package/static/widget/snag.dock.js +5 -5
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/dashboard/assets/CompositeItem-DpSaUtYZ.js +0 -1
- package/static/dashboard/assets/_app-CnifsCfr.js +0 -56
- package/static/dashboard/assets/activity-DX3WrmQt.js +0 -1
- package/static/dashboard/assets/badge-CrUHZwEL.js +0 -1
- package/static/dashboard/assets/index-D6Jv0m8R.css +0 -1
- package/static/dashboard/assets/index-DMCyFEmS.js +0 -169
- package/static/dashboard/assets/invite-CrR7zqFd.js +0 -1
- package/static/dashboard/assets/labels--UUyt9uB.js +0 -1
- package/static/dashboard/assets/me-6-FBHysO.js +0 -1
- package/static/dashboard/assets/parts-b71WkkoI.js +0 -1
- package/static/dashboard/assets/s._site-MtCDp62_.js +0 -1
- package/static/dashboard/assets/s._site.comments-vNVUqPN4.js +0 -54
- package/static/dashboard/assets/s._site.reviewers-BMYyb10D.js +0 -1
- package/static/dashboard/assets/s._site.settings-BaBm7RJi.js +0 -1
- package/static/dashboard/assets/sign-up-K_HV-_C8.js +0 -1
- package/static/dashboard/assets/sites-Dw-qQxr1.js +0 -1
- package/static/dashboard/assets/studio-DcijgVQL.js +0 -1
- package/static/dashboard/assets/studio.index-D-9QUrvv.js +0 -1
- package/static/dashboard/assets/studio.integrations-Djhl8gKq.js +0 -1
- package/static/dashboard/assets/studio.members-DaS0HWwE.js +0 -6
- package/static/dashboard/assets/useQuery-Cl9FITTP.js +0 -1
- package/static/dashboard/assets/useRender-Ck8DP-Z3.js +0 -1
- package/static/dashboard/assets/you-CZGeTvq7.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as N,j as e,o as y,r as h,p as v,x as S,z as A,A as f,G as g,C,B as k,D as F,L as E,F as I,H as x}from"./index-DMCyFEmS.js";import{u as L,a as B}from"./zod-khKoKeAB.js";import{L as u,I as p}from"./label-CL3Ivlhy.js";function G(){const s=N.useLoaderData();return s.ok?e.jsx(P,{token:s.token,invite:s.invite}):e.jsx(R,{code:s.code,message:s.message})}function R({code:s,message:a}){const{title:l,signIn:i}=F(s);return e.jsx(g,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:l}),e.jsx("p",{role:"alert",className:"m-0 text-muted-foreground",children:a}),i&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx(E,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})})]})})}const J=I({name:x().trim().max(120).optional(),email:x().trim().email("An email address"),password:x().min(1,"A password")});function P({token:s,invite:a}){const l=y(),[i,m]=h.useState(""),[r,j]=h.useState(!1),{register:d,handleSubmit:w,formState:t}=L({resolver:B(J),defaultValues:{email:a.email??"",name:""}}),c=a.org.name||"a studio",b=w(async o=>{if(m(""),!r&&o.password.length<12){m("The password must be at least 12 characters. A short phrase of real words is fine.");return}try{await v.acceptInvite({token:s,password:o.password,...o.name?{name:o.name}:{},...a.email?{}:{email:o.email}}),S("in"),A.clear(),l({to:"/sites",replace:!0})}catch(n){n instanceof f&&n.code==="account_exists"&&j(!0),m(n instanceof f?n.message:"Could not reach the server. Try again.")}});return e.jsx(g,{width:400,children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:["Join ",c]}),e.jsxs("p",{className:"m-0 mt-1.5 text-muted-foreground",children:[a.invitedBy?`${a.invitedBy} invited you`:"You were invited"," to join ",c," as ",C(a.role),".",r?" Sign in with the account you already have here.":" Choose your password and you're in."]})]}),i&&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:i}),e.jsxs("fieldset",{disabled:t.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(u,{htmlFor:"email",children:"Email"}),e.jsx(p,{id:"email",type:"email",autoComplete:"username",readOnly:!!a.email,"aria-invalid":!!t.errors.email,...d("email")}),t.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:t.errors.email.message})]}),!r&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(u,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(p,{id:"name",autoComplete:"name",...d("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"password",children:r?"Your password":"Choose a password"}),e.jsx(p,{id:"password",type:"password",autoComplete:r?"current-password":"new-password","aria-invalid":!!t.errors.password,...d("password")}),!r&&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.jsx(k,{type:"submit",size:"lg",loading:t.isSubmitting,children:t.isSubmitting?"Joining…":`Join ${c}`})]})]})})}export{G as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const s=["open","progress","review","resolved"],n={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},o={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function a(t){return s.includes(t)}function i(t,r=Date.now()){if(!t)return"";const e=Math.max(0,(r-new Date(t).getTime())/1e3);return e<60?"now":e<3600?`${Math.floor(e/60)} min`:e<86400?`${Math.floor(e/3600)} h`:e<86400*30?`${Math.floor(e/86400)} d`:new Date(t).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function u(t,r=""){const e=t.trim().split(/\s+/).filter(Boolean);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():e.length===1&&e[0].length>0?e[0].slice(0,2).toUpperCase():(r[0]??"?").toUpperCase()}export{n as S,u as a,i as b,s as c,o as d,a as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u,d as s}from"./useBaseQuery-BI_bJwNl.js";import{y as t}from"./index-DMCyFEmS.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,f as r}from"./index-DMCyFEmS.js";import{C as x}from"./card-C4v3pSqd.js";import{S as m,d as l,i as d}from"./labels--UUyt9uB.js";function p({title:t,sub:s,actions:a}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:t}),s&&e.jsx("p",{className:"m-0 text-muted-foreground",children:s}),e.jsx("div",{className:"flex-1"}),a]})}function u({title:t,description:s,children:a,danger:n,cardClassName:i}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:r("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",n&&"text-destructive"),children:t}),s&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:s})]}),e.jsx(x,{className:r("flex max-w-[640px] flex-col gap-4 p-5",n&&"border-destructive",i),children:a})]})}function g({icon:t,title:s,children:a,action:n,className:i}){return e.jsxs("div",{className:r("flex flex-col items-center gap-2 px-6 py-16 text-center",i),children:[t&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:t}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:s}),a&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:a}),n&&e.jsx("div",{className:"mt-2",children:n})]})}function j({status:t,className:s}){const a=d(t);return e.jsx("span",{className:r("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",a?l[t]:"bg-muted text-muted-foreground",s),children:a?m[t]:t})}function h({children:t}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:t})}export{g as E,p as P,j as S,u as a,h as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-DMCyFEmS.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import{c as Q,r as x,h as zs,a4 as Ts,a5 as Es,d as Je,a6 as Qe,a7 as Is,m as Ps,E as _s,i as ns,j as e,a8 as Bs,g as Fs,f as D,B as M,a9 as as,aa as Ls,$ as Xe,ab as Os,_ as rs,A as Vs,ac as Ze,o as qs,ad as Us,ae as Ye,af as Ks,ag as Hs,ah as Ws,ai as Gs,aj as Js,ak as Qs,al as Xs,am as Zs,an as Ys,ao as et,ap as be,L as os,F as st,a1 as es,H as je,aq as tt,y as $e}from"./index-DMCyFEmS.js";import{u as ve}from"./useQuery-Cl9FITTP.js";import{C as is}from"./check-BKP4SJjJ.js";import{f as nt,e as at,h as rt,j as ot,u as ss,k as it,l as lt,c as dt,n as ct,L as qe,I as Re}from"./label-CL3Ivlhy.js";import{L as ut,M as mt,N as ht,A as xt,O as pt,E as ls,G as ds,I as cs,H as us,J as ms,K as hs,X as ft}from"./dialog-lgIL_ZCX.js";import{u as gt}from"./FieldItemContext-4dJ9QpEG.js";import{u as bt}from"./useAriaLabelledBy-Ce10PDSC.js";import{u as jt}from"./useValueChanged-Dh5Yg1r8.js";import{D as se,i as te,j as ne,k as ce,l as ye,m as G,n as xs,E as ts,o as Ue,p as de,S as vt}from"./dropdown-menu-DyLLQk8L.js";import{A as he,a as xe}from"./avatar-DkFTIwsR.js";import{C as ps}from"./ConfirmDialog-s6KLZt6w.js";import{b as Ke,S as fs,E as Oe}from"./parts-b71WkkoI.js";import{S as pe,i as yt,b as ze,c as Me,a as ke}from"./labels--UUyt9uB.js";import{C as kt}from"./copy-nRZWPHR1.js";import{I as Nt}from"./image-off-B6flKQEZ.js";import{C as wt}from"./chevron-right-BVbfidnK.js";import{I as Ct}from"./InstallTag-B4frNgVO.js";import{u as St}from"./me-6-FBHysO.js";import{A as $t}from"./arrow-left-iXAzDNV6.js";import"./useBaseQuery-BI_bJwNl.js";import"./CompositeItem-DpSaUtYZ.js";import"./card-C4v3pSqd.js";/**
|
|
2
|
-
* @license lucide-react v1.39.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Mt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ae=Q("chevron-down",Mt);/**
|
|
7
|
-
* @license lucide-react v1.39.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const At=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Dt=Q("columns-2",At);/**
|
|
12
|
-
* @license lucide-react v1.39.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Rt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],zt=Q("ellipsis",Rt);/**
|
|
17
|
-
* @license lucide-react v1.39.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Tt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Et=Q("inbox",Tt);/**
|
|
22
|
-
* @license lucide-react v1.39.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const It=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Pt=Q("list",It);/**
|
|
27
|
-
* @license lucide-react v1.39.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const _t=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Bt=Q("pencil",_t);/**
|
|
32
|
-
* @license lucide-react v1.39.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const Ft=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Lt=Q("rotate-cw",Ft);/**
|
|
37
|
-
* @license lucide-react v1.39.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Ot=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],gs=Q("trash-2",Ot);/**
|
|
42
|
-
* @license lucide-react v1.39.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Vt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],qt=Q("user-plus",Vt);/**
|
|
47
|
-
* @license lucide-react v1.39.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const Ut=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Kt=Q("user-round",Ut);function Ht(s){if(!s)return null;for(const t of s.elements){const r=t.tagName;if(r==="BUTTON"||r==="INPUT"){const o=t;if(o.type==="submit")return o}}return null}function bs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...nt}}const Wt=x.createContext(void 0);function Gt(){return x.useContext(Wt)}const js=x.createContext(void 0);function Jt(){const s=x.useContext(js);if(s===void 0)throw new Error(zs(14));return s}const Qt="data-parent",Xt=x.forwardRef(function(t,r){const{checked:o,className:h,defaultChecked:i=!1,"aria-labelledby":l,disabled:y=!1,form:c,id:m,indeterminate:k=!1,inputRef:p,name:d,onCheckedChange:w,parent:a=!1,readOnly:C=!1,render:N,required:A=!1,uncheckedValue:v,value:z,nativeButton:E=!1,style:_,...I}=t,{clearErrors:f}=at(),{disabled:L,name:Z,setDirty:U,setFilled:K,setFocused:$,setTouched:T,state:V,validationMode:ue,validityData:me,validation:B}=rt(),g=gt(),{labelId:b,controlId:q,registerControlId:Y,getDescriptionProps:Te}=ot(),R=Gt(),J=R?.allValues===void 0?void 0:R.parent,ae=J!==void 0,F=L||g.disabled||R?.disabled||y,O=Z??d,P=z??O,n=ss(),u=ss();let S=m||q;ae&&(a?S=u:P!==void 0?S=`${J.id}-${P}`:S||=u);let H={};ae&&(a?H=J.getParentProps():P!==void 0&&(H=J.getChildProps(P)));const{checked:ee=o,indeterminate:re=k,onCheckedChange:Ne,...Ee}=H,Ie=R?.value,we=x.useRef(null),Ce=Ts(()=>Symbol()),Pe=x.useRef(!1),{getButtonProps:Ns,buttonRef:ws}=Es({disabled:F,native:E}),fe=R?.validation??B,[W,Cs]=it({controlled:P!==void 0&&Ie!==void 0&&!a?Ie.includes(P):ee,default:i,name:"Checkbox",state:"checked"}),_e=ae?!!ee:W,ge=ae&&re||k;Je(()=>{Y!==Qe&&(Pe.current=!0,Y(Ce.current,S))},[S,Y,Ce]),x.useEffect(()=>{const j=Ce.current;return()=>{!Pe.current||Y===Qe||(Pe.current=!1,Y(j,void 0))}},[Y,Ce]),lt(we,n,W,void 0,!R&&!F,d);const oe=x.useRef(null),We=fe.registerInput,Ge=R?P:void 0,Ss=x.useCallback(j=>We(j,{controlRef:we,value:Ge}),[We,Ge]),$s=Is(p,oe,a?void 0:Ss),Ms=bt(l,b,oe,!E,S??void 0);Je(()=>{oe.current&&(oe.current.indeterminate=ge,W&&K(!0))},[W,ge,K]),jt(W,()=>{R||(f(O),K(W),U(W!==me.initialValue),fe.change(W))});const As=Ps({checked:W,disabled:F,form:c,name:a?void 0:O,id:E?void 0:S??void 0,required:A,ref:$s,style:O?ut:mt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(j){if(j.nativeEvent.defaultPrevented)return;if(C){j.preventDefault();return}const X=j.currentTarget.checked,ie=dt(ct,j.nativeEvent);if(w?.(X,ie),!ie.isCanceled&&(Ne?.(X,ie),!ie.isCanceled&&(Cs(X),P!==void 0&&R!==void 0&&!a&&!ae))){const le=X?[...R.value,P]:R.value.filter(Se=>Se!==P);R.setValue(le,ie)}},onClick(j){j.stopPropagation()},onFocus(){we.current?.focus()}},z!==void 0?{value:(R?W&&z:z)||""}:_s,Te,j=>fe.getValidationProps(F,j));x.useEffect(()=>{if(!J||P===void 0)return;const j=J.disabledStatesRef.current;return j.set(P,F),()=>{j.delete(P)}},[J,F,P]);const Be=x.useMemo(()=>({...V,checked:_e,disabled:F,readOnly:C,required:A,indeterminate:ge}),[V,_e,F,C,A,ge]),Ds=bs(Be),Rs=ns("span",t,{state:Be,ref:[ws,we,r],props:[{id:E?S??void 0:n,role:"checkbox","aria-checked":ge?"mixed":_e,"aria-readonly":C||void 0,"aria-required":A||void 0,"aria-labelledby":Ms,[Qt]:a?"":void 0,onFocus(){F||$(!0)},onBlur(){const j=oe.current;j&&(T(!0),$(!1),ue==="onBlur"&&fe.commit(R?Ie:j.checked))},onKeyDown(j){if(j.key!=="Enter"||(j.preventBaseUIHandler(),j.defaultPrevented))return;const X=oe.current?.form??null,ie=j.currentTarget,le=j.nativeEvent,Se=j.preventDefault,Fe=le.preventDefault;let Le=!1;j.preventDefault=()=>{Le=!0,Se.call(j)},le.preventDefault=()=>{Le=!0,Fe.call(le)},Fe.call(le),Fs(ie).queueMicrotask(()=>{j.preventDefault=Se,le.preventDefault=Fe,Le||Ht(X)?.click()})},onClick(j){if(C||F)return;j.preventDefault();const X=oe.current;X&&Bs(X,j)}},I,Ee,Ns,Te,j=>fe.getValidationProps(F,j)],stateAttributesMapping:Ds});return e.jsxs(js.Provider,{value:Be,children:[Rs,!W&&!R&&O&&!a&&v!==void 0&&e.jsx("input",{type:"hidden",form:c,name:O,value:v,disabled:F}),e.jsx("input",{...As,suppressHydrationWarning:!0})]})}),Zt=x.forwardRef(function(t,r){const{render:o,className:h,style:i,keepMounted:l=!1,...y}=t,c=Jt(),m=c.checked||c.indeterminate,{mounted:k,transitionStatus:p,setMounted:d}=ht(m),w=x.useRef(null),a={...c,transitionStatus:p};xt({open:m,ref:w,onComplete(){m||d(!1)}});const N={...bs(c),...pt},A=l||k,v=ns("span",t,{ref:[r,w],state:a,stateAttributesMapping:N,props:y});return A?v:null});function Yt({className:s,...t}){return e.jsx(Xt,{"data-slot":"checkbox",className:D("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),...t,children:e.jsx(Zt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(is,{})})})}function vs({className:s,...t}){return e.jsx("textarea",{"data-slot":"textarea",className:D("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),...t})}function en({rounds:s,active:t,onPick:r,onStart:o,starting:h}){const i=s.find(p=>p.number===t),l=(s[0]?.number??0)+1,[y,c]=x.useState(!1),[m,k]=x.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsxs(te,{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(Lt,{className:"size-3.5"}),i?.name??`Round ${t}`,e.jsx(Ae,{className:"size-3 text-muted-foreground"})]}),e.jsxs(ne,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(ye,{children:"Rounds"}),s.map(p=>e.jsxs(G,{onClick:()=>r(p.number),children:[e.jsx("span",{className:"truncate",children:p.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[p.closed?"closed":"open",p.unresolved>0?` · ${p.unresolved} to go`:""]})]},p.id))]}),e.jsx(xs,{}),e.jsx(G,{onClick:()=>{k(`Round ${l}`),c(!0)},children:"Start a new round…"})]})]}),i&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:i.closed?"":" · all clear"]}),e.jsx(ls,{open:y,onOpenChange:c,children:e.jsx(ds,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:p=>{p.preventDefault(),!(!m.trim()||h)&&(o(m.trim()),c(!1))},children:[e.jsxs(cs,{children:[e.jsx(us,{children:"Start a new round"}),e.jsx(ms,{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(qe,{htmlFor:"round-name",children:"Name"}),e.jsx(Re,{id:"round-name",value:m,onChange:p=>k(p.target.value),autoFocus:!0})]}),e.jsxs(hs,{children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(M,{type:"submit",disabled:!m.trim()||h,children:h?"Starting…":"Start the round"})]})]})})})]})}function ys({rounds:s,onMove:t,busy:r}){return s.length===0?null:e.jsxs(se,{children:[e.jsx(te,{render:e.jsx(M,{variant:"outline",size:"sm",disabled:r}),children:"Move to round…"}),e.jsx(ne,{align:"start",className:"w-[240px]",children:e.jsxs(ce,{children:[e.jsx(ye,{children:"Move to round"}),s.map(o=>e.jsxs(G,{onClick:()=>t(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 sn={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function tn(s,t,r={}){const o=r.fence??((f,L)=>L),h=r.statusLabel??(f=>sn[f]??f),i=s.anchor??{},l=s.context??{},y=i.page,c=y?.route??s.route??"/",m=y?.origin??t.origin??"",k=y?.pathname??c,p=m?`${m}${k}`:k,d=typeof i.label=="string"?o("label",i.label):"",w=i.element??i,a=[];a.push(`# ${s.key}${d?` — ${d}`:""}`),a.push(""),a.push(`${t.name} · ${h(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: ${p}`),m&&a.push(`- Open on the page: ${m}${k}?${as("t")}=${encodeURIComponent(s.key)}`),d&&a.push(`- Element: ${d}`);const C=typeof i.css=="string"?i.css:typeof w.selector=="string"?w.selector:"";if(C&&a.push(`- Selector: \`${o("selector",C)}\``),typeof i.domid=="string"&&a.push(`- DOM id: \`#${o("selector",i.domid)}\``),typeof w.role=="string"){const f=typeof w.accessibleName=="string"?` “${o("label",w.accessibleName)}”`:"";a.push(`- Role: ${o("label",w.role)}${f}`)}typeof w.testId=="string"&&a.push(`- Test id: ${o("label",w.testId)}`);const N=i.text;N?.exact&&a.push(`- Text: “${o("label",N.exact)}”`),a.push(`- Anchor: ${s.anchorState??"unknown"}`),a.push(""),a.push("## What's wrong"),a.push("");const A=(s.comments??[]).filter(f=>f.body!==null);A.length===0&&a.push("> (no comment — a pin with no words)");for(const f of A){const L=f.author?.name?o("name",f.author.name):"Anonymous";a.push(`> **${L}${f.author?.kind==="agent"?" (agent)":""}** — ${f.createdAt.slice(0,16).replace("T"," ")}`);for(const Z of o("body",String(f.body)).split(`
|
|
52
|
-
`))a.push(`> ${Z}`);a.push(">")}a[a.length-1]===">"&&a.pop(),a.push(""),a.push("## Environment"),a.push("");const v=l.derived,z=l.viewport;(v?.browser||v?.os)&&a.push(`- Browser: ${[v.browser,v.os,v.device].filter(Boolean).join(" · ")}`),z?.w&&a.push(`- Viewport: ${z.w} × ${z.h}${z.dpr?` @${Math.round(z.dpr*10)/10}x`:""}`),l.prefersColorScheme&&a.push(`- Colour scheme: ${l.prefersColorScheme}`),l.language&&a.push(`- Language: ${l.language}`),l.ua&&a.push(`- User agent: ${o("label",String(l.ua))}`);const E=l.build;E&&Object.keys(E).length&&a.push(`- Build: ${Object.entries(E).map(([f,L])=>`${f}=${o("label",String(L))}`).join(", ")}`),a.push("");const _=l.breadcrumbs;if(_?.length){a.push(`## Breadcrumbs (${_.length}, oldest first)`),a.push("");for(const f of _)a.push(`- \`${String(f.t).slice(11,19)}\` ${f.type}${f.level?`/${f.level}`:""}: ${o("breadcrumb",String(f.message))}`);a.push("")}const I=s.attachments?.find(f=>f.kind==="screenshot")??s.attachments?.[0];if(I){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 f=I.url.startsWith("http")?I.url:`${t.dashboardOrigin??""}${I.url}`;a.push(``),a.push("")}return a.join(`
|
|
53
|
-
`).trimEnd()+`
|
|
54
|
-
`}function nn(s,t){return tn(s,t,{statusLabel:r=>yt(r)?pe[r]:r})}function an({thread:s,site:t,onStatus:r,onReply:o,replying:h,onClose:i,pool:l,onAssign:y,onAddPerson:c,trackers:m,onCreateIssue:k,creatingIssue:p,onEditComment:d,onDeleteComment:w,onDeleteThread:a,move:C}){const N=s.anchor??{},A=s.context??{},v=typeof N.label=="string"?N.label:"",z=N.page,E=z?.route??s.route??"/",_=z?.origin??t.origin,I=_?`${_}${z?.pathname??E}?${as("t")}=${encodeURIComponent(s.key)}`:"",f=s.attachments?.find(g=>g.kind==="screenshot")??s.attachments?.[0],[L,Z]=x.useState(""),[U,K]=x.useState(""),[$,T]=x.useState(!1),[V,ue]=x.useState(!1),me=l.find(g=>g.isMe)?.id,B=()=>{navigator.clipboard?.writeText(nn(s,{name:t.name,..._?{origin:_}:{},dashboardOrigin:location.origin})),rs.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-1 flex-col","aria-label":`${s.key} — ${v||"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(on,{status:s.status,onStatus:r}),e.jsx(mn,{assignee:s.assignee??null,pool:l,onAssign:y,onAddPerson:c}),(m??[]).map(g=>{const b=s.refs?.find(q=>q.provider===g&&q.kind===Ls[g]&&q.status!=="detached");if(b){const q=g==="github"?`Issue #${b.externalId}`:g==="jira"?b.externalId:g==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(b.url)?.[1]??`${Xe[g]} issue`;return e.jsxs(M,{variant:"ghost",size:"sm",render:e.jsx("a",{href:b.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(ts,{}),q]},g)}return k?e.jsx(M,{variant:"ghost",size:"sm",disabled:!!p,onClick:()=>k(g),children:p===g?g==="slack"?"Posting…":"Creating…":g==="slack"?"Post to Slack":`Create ${Xe[g]} issue`},g):null}),e.jsx("div",{className:"flex-1"}),C&&e.jsx(ys,{rounds:C.rounds,onMove:C.onMove,busy:C.busy}),e.jsxs(M,{variant:"ghost",size:"sm",onClick:B,children:[e.jsx(kt,{}),"Copy as brief"]}),a&&e.jsx(M,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${s.key}`,title:"Delete this thread",onClick:()=>T(!0),children:e.jsx(gs,{})}),e.jsx(M,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:i,children:e.jsx(ft,{})})]}),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:v||"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:E}),_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${_}${z?.pathname??E}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[_.replace(/^https?:\/\//,""),e.jsx(ts,{className:"size-3"})]})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:I,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(g=>g.body!==null).map(g=>e.jsx(rn,{comment:g,reply:g!==s.comments[0],mine:Os(g,me),...d?{onEdit:b=>d(g.id,b)}:{},...w?{onDelete:()=>w(g.id)}:{}},g.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async g=>{g.preventDefault();const b=L.trim();if(!(!b||h)){K("");try{await o(b),Z("")}catch(q){K(q instanceof Error?q.message:"Could not send that reply.")}}},children:[e.jsx(he,{className:"size-6 shrink-0",children:e.jsx(xe,{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(vs,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:L,onChange:g=>Z(g.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(M,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx(M,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("review"),children:"Mark in review"}),e.jsx(M,{type:"button",variant:"ghost",size:"sm",onClick:()=>r("resolved"),children:"Mark resolved"})]}),e.jsx(M,{type:"submit",size:"sm",disabled:!L.trim()||h,children:h?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Ke,{children:"Screenshot"}),f?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:f.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:f.url,alt:`The page when ${s.key} was left`,width:f.width,height:f.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[f.width??"?"," × ",f.height??"?",A.prefersColorScheme?` · ${A.prefersColorScheme}`:""," · taken at the click, ",ze(s.createdAt)," ·"," ",e.jsx("a",{href:f.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(Nt,{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(dn,{ctx:A})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Ke,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[v&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:v})]}),typeof N.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:N.css})]}),typeof N.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:["#",N.domid]})]}),typeof N.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[N.role,typeof N.accessibleName=="string"?` “${N.accessibleName}”`:""]})]}),N.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(N.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(ln,{state:s.anchorState})})]})]}),e.jsx(cn,{ctx:A}),e.jsx(un,{ctx:A})]}),a&&e.jsx(ps,{open:$,onOpenChange:T,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:V,onConfirm:async()=>{ue(!0);try{await a(),T(!1)}catch{}finally{ue(!1)}}})]})}function rn({comment:s,reply:t,mine:r,onEdit:o,onDelete:h}){const[i,l]=x.useState(!1),[y,c]=x.useState(""),[m,k]=x.useState(!1),[p,d]=x.useState(!1),[w,a]=x.useState(!1),C=r&&!!o,N=!!h,A=async()=>{const v=y.trim();if(!(!v||m||!o)){if(v===s.body){l(!1);return}k(!0);try{await o(v),l(!1)}catch{}finally{k(!1)}}};return e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(he,{className:"size-6 shrink-0",children:e.jsx(xe,{className:D("text-[10px] font-semibold",s.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:ke(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:ze(s.createdAt)}),(C||N)&&!i&&e.jsxs(se,{children:[e.jsx(te,{render:e.jsx(M,{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(zt,{})}),e.jsxs(ne,{align:"end",className:"min-w-36",children:[C&&e.jsxs(G,{onClick:()=>{c(s.body??""),l(!0)},children:[e.jsx(Bt,{}),"Edit"]}),N&&e.jsxs(G,{variant:"destructive",onClick:()=>d(!0),children:[e.jsx(gs,{}),"Delete"]})]})]})]}),i?e.jsxs("form",{className:"mt-1 flex flex-col gap-2",onSubmit:v=>{v.preventDefault(),A()},children:[e.jsx(vs,{"aria-label":"Edit your comment",value:y,autoFocus:!0,rows:3,disabled:m,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),A()),v.key==="Escape"&&!m&&(v.preventDefault(),l(!1))}}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(M,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>l(!1),children:"Cancel"}),e.jsx(M,{type:"submit",size:"sm",loading:m,disabled:!y.trim(),children:m?"Saving…":"Save"})]})]}):e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:s.body})]}),N&&e.jsx(ps,{open:p,onOpenChange:d,title:"Delete this comment?",description:t?"The reply is removed for everyone.":"The comment is removed for everyone. The pin and its replies stay.",confirmLabel:"Delete comment",busy:w,onConfirm:async()=>{a(!0);try{await h(),d(!1)}catch{}finally{a(!1)}}})]})}function on({status:s,onStatus:t}){return e.jsxs(se,{children:[e.jsx(te,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(fs,{status:s})}),e.jsx(ne,{align:"start",className:"w-[180px]",children:e.jsx(Ue,{value:s,onValueChange:r=>t(r),children:Me.map(r=>e.jsx(de,{value:r,children:pe[r]},r))})})]})}function ln({state:s}){const t=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:D("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:r})}function dn({ctx:s}){const t=s.capture;if(!t)return null;const r=[];return t.screenshot&&t.screenshot!=="ok"&&r.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&r.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&r.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&r.push(`Dropped: ${t.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 cn({ctx:s}){const t=s.derived,r=s.viewport,o=s.build,h=[];return t?.browser||t?.os?h.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&h.push(["User agent",String(s.ua)]),r?.w&&h.push(["Viewport",`${r.w} × ${r.h}${r.dpr?` @${Math.round(r.dpr*10)/10}x`:""}`]),s.language&&h.push(["Language",String(s.language)]),o&&Object.keys(o).length&&h.push(["Build",Object.entries(o).map(([i,l])=>`${i} ${String(l)}`).join(" · ")]),h.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ke,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),rs.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:h.map(([i,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:i}),e.jsx("dd",{className:D("m-0",i==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},i))})]}):null}function un({ctx:s}){const t=s.breadcrumbs,[r,o]=x.useState(!1);if(!t?.length)return null;const h=t.filter(i=>i.level==="error"||i.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(wt,{className:D("size-3.5 text-muted-foreground transition-transform",r&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",h>0?` · ${h} error${h===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:t.map((i,l)=>e.jsxs("li",{className:D("flex gap-2",(i.level==="error"||i.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:i.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[i.type,i.level?`/${i.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:i.message})]},l))})]})}function mn({assignee:s,pool:t,onAssign:r,onAddPerson:o}){const[h,i]=x.useState(!1),l=t.find(d=>d.isMe),y=t.filter(d=>d.isTeam),c=t.filter(d=>!d.isTeam&&!d.isAgent),m=t.filter(d=>!d.isTeam&&d.isAgent),k=d=>r({id:d.id,name:d.name,kind:d.kind,isTeam:d.isTeam}),p=d=>e.jsxs(G,{onClick:()=>k(d),children:[e.jsx(he,{className:"size-4",children:e.jsx(xe,{className:D("text-[8px] font-semibold",d.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ke(d.name,d.email)})}),e.jsx("span",{className:"truncate",children:d.isMe?`${d.name} (you)`:d.name}),s?.id===d.id&&e.jsx(is,{className:"ml-auto size-3.5"})]},d.id);return e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(te,{render:e.jsx(M,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"size-4",children:e.jsx(xe,{className:D("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ke(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{}),"Assign"]})}),e.jsxs(ne,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>k(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>r(null),children:"Unassign"})]}):null,y.length>0&&e.jsxs(ce,{children:[e.jsx(ye,{children:"The studio"}),y.map(p)]}),c.length>0&&e.jsxs(ce,{children:[e.jsx(ye,{children:"People who commented"}),c.map(p)]}),m.length>0&&e.jsxs(ce,{children:[e.jsx(ye,{children:"Agents"}),m.map(p)]}),e.jsx(xs,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>i(!0),children:[e.jsx(qt,{}),"Add a person…"]})})]})]}),e.jsx(hn,{open:h,onOpenChange:i,onAdd:async d=>{const w=await o(d);k(w)}})]})}function hn({open:s,onOpenChange:t,onAdd:r}){const[o,h]=x.useState(""),[i,l]=x.useState(""),[y,c]=x.useState(!1),[m,k]=x.useState(""),p=async d=>{if(d.preventDefault(),!(!o.trim()||y)){c(!0),k("");try{await r({name:o.trim(),...i.trim()?{email:i.trim()}:{}}),h(""),l(""),t(!1)}catch(w){k(w instanceof Vs?w.message:"Could not add the person.")}finally{c(!1)}}};return e.jsx(ls,{open:s,onOpenChange:t,children:e.jsx(ds,{children:e.jsxs("form",{onSubmit:d=>void p(d),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(cs,{children:[e.jsx(us,{children:"Add a person"}),e.jsx(ms,{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."})]}),m&&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:m}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"person-name",children:"Name"}),e.jsx(Re,{id:"person-name",placeholder:"Sofia",value:o,onChange:d=>h(d.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(Re,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:i,onChange:d=>l(d.target.value)})]}),e.jsxs(hs,{children:[e.jsx(M,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(M,{type:"submit",loading:y,disabled:!o.trim(),children:y?"Adding…":"Add and assign"})]})]})})})}st({thread:je().optional(),status:je().optional(),page:je().optional(),q:je().optional(),sort:es(["newest","oldest"]).optional(),round:tt().int().positive().optional(),assignee:je().optional(),view:es(["board"]).optional()});const ks={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function On(){const{site:s}=Ze.useParams(),t=Ze.useSearch(),r=qs(),o=St(),h=o.projects.find(n=>n.uid===s),i=ve($e.origins(s)),l=ve($e.rounds(s)),y=ve($e.assignees(s)),c=ve($e.siteIntegrations(s)),m=y.data?.data??[],k=m.find(n=>n.isMe)?.id,p=t.round??(l.data?Us(l.data.data):void 0),d=(l.data?.data??[]).filter(n=>!n.archived||n.number===p),w=x.useMemo(()=>({...p!==void 0?{round:p}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[p,t.page,t.q]),a=ve({...Ye(s,w),enabled:l.isSuccess}),C=Ye(s,w).queryKey,N=Ks(s,C),A=Hs(C),v=Ws(s,C),z=Gs(s),E=Js(s,C),_=Qs(s),I=Xs(s),f=Zs(C),L=Ys(C),Z=et(s,C),[U,K]=x.useState(new Set),$=n=>void r({to:"/s/$site/comments",params:{site:s},search:u=>({...u,...n}),replace:!0}),T=a.data?.data??[],V=x.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),ue=x.useMemo(()=>{const n=new Map;for(const u of T)n.set(u.status,(n.get(u.status)??0)+1);return n},[T]),me=x.useMemo(()=>[...new Set(T.map(n=>He(n)))].sort(),[T]),B=x.useMemo(()=>{let n=V.size?T.filter(u=>V.has(u.status)):T;return t.assignee==="unassigned"?n=n.filter(u=>!u.assignee):t.assignee==="me"?n=n.filter(u=>!!k&&u.assignee?.id===k):t.assignee&&(n=n.filter(u=>u.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[T,V,t.sort,t.assignee,k]),g=x.useMemo(()=>{const n=new Map;for(const u of B){const S=He(u);n.has(S)||n.set(S,[]),n.get(S).push(u)}return[...n.entries()]},[B]),b=t.thread?T.find(n=>n.key===t.thread)??null:null,q=V.size>0||!!t.page||!!t.q||!!t.assignee,Y=d.filter(n=>n.number!==p&&n.unresolved>0),R=o.user.role==="owner"||o.user.role==="admin"?d.filter(n=>!n.archived&&n.number!==p):[],J=(n,u)=>I.mutate({ids:n,round:u},{onSuccess:()=>{K(new Set),t.thread&&n.includes(b?.id??"")&&$({thread:void 0})}}),ae=n=>{const u=new Set(V);u.has(n)?u.delete(n):u.add(n),$({status:[...u].join(",")||void 0})},F=async n=>{const u=[...U];K(new Set);for(const S of u)await N.mutateAsync({id:S,status:n}).catch(()=>{})};x.useEffect(()=>{const n=u=>{if(u.metaKey||u.ctrlKey||u.altKey)return;const S=u.target;if(S&&(S.closest("input,textarea,select,[contenteditable]")||S.isContentEditable))return;const H=u.key.toLowerCase();if(H!=="j"&&H!=="k"&&H!=="e"||B.length===0)return;if(u.preventDefault(),H==="e"){if(!b)return;N.mutate({id:b.id,status:b.status==="resolved"?"open":"resolved"});return}const ee=b?B.findIndex(Ee=>Ee.id===b.id):-1,re=H==="j"?Math.min(ee+1,B.length-1):Math.max(ee-1,0),Ne=B[ee===-1?0:re];Ne&&$({thread:Ne.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const O=t.view==="board",P=x.useMemo(()=>Me.map(n=>({status:n,items:B.filter(u=>u.status===n)})),[B]);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:U.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[U.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),Me.map(n=>e.jsx(M,{variant:"outline",size:"sm",onClick:()=>void F(n),children:pe[n]},n)),e.jsx(ys,{rounds:R,busy:I.isPending,onMove:n=>J([...U],n)}),e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>K(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[d.length>0&&p!==void 0&&e.jsx(en,{rounds:d,active:p,onPick:n=>$({round:n,thread:void 0}),onStart:n=>_.mutate(n,{onSuccess:u=>$({round:u.number,thread:void 0,status:void 0})}),starting:_.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Ve,{on:V.size===0,onClick:()=>$({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:T.length})]}),Me.map(n=>e.jsxs(Ve,{on:V.has(n),onClick:()=>ae(n),children:[e.jsx("span",{className:D("size-[7px] rounded-full",ks[n])}),pe[n]," ",e.jsx("span",{className:"text-muted-foreground",children:ue.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Ve,{on:O,onClick:()=>$({view:O?void 0:"board"}),children:[O?e.jsx(Pt,{className:"size-3.5"}):e.jsx(Dt,{className:"size-3.5"}),O?"List":"Board"]}),e.jsx(pn,{value:t.q??"",onChange:n=>$({q:n||void 0})}),me.length>1&&e.jsxs(se,{children:[e.jsxs(te,{render:e.jsx("button",{type:"button",className:De(!!t.page)}),children:[t.page??"All pages",e.jsx(Ae,{className:"size-3 text-muted-foreground"})]}),e.jsxs(ne,{align:"end",children:[e.jsx(G,{onClick:()=>$({page:void 0}),children:"All pages"}),me.map(n=>e.jsx(G,{onClick:()=>$({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(se,{children:[e.jsxs(te,{render:e.jsx("button",{type:"button",className:De(!!t.assignee),"aria-label":"Filter by assignee"}),children:[xn(t.assignee,m),e.jsx(Ae,{className:"size-3 text-muted-foreground"})]}),e.jsx(ne,{align:"end",children:e.jsxs(Ue,{value:t.assignee??"any",onValueChange:n=>$({assignee:n==="any"?void 0:n}),children:[e.jsx(de,{value:"any",children:"Anyone"}),e.jsx(de,{value:"unassigned",children:"Unassigned"}),k&&e.jsx(de,{value:"me",children:"Me"}),m.filter(n=>!n.isMe).map(n=>e.jsx(de,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(se,{children:[e.jsxs(te,{render:e.jsx("button",{type:"button",className:De(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(Ae,{className:"size-3 text-muted-foreground"})]}),e.jsx(ne,{align:"end",children:e.jsxs(Ue,{value:t.sort??"newest",onValueChange:n=>$({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(de,{value:"newest",children:"Newest first"}),e.jsx(de,{value:"oldest",children:"Oldest first"})]})})]})]})}),Y.map(n=>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:()=>$({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:D("grid min-h-0 flex-1",b?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:D("min-h-0 overflow-auto lg:border-r lg:border-border",b&&"hidden lg:block"),children:[a.isPending&&e.jsx(gn,{}),a.isError&&e.jsx(Oe,{title:"Could not load the comments",children:a.error.message}),a.isSuccess&&T.length===0&&!q&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Oe,{icon:e.jsx(Et,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",h.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(Ct,{uid:s})})]})}),a.isSuccess&&T.length>0&&B.length===0&&e.jsx(Oe,{title:"Nothing matches",action:e.jsx(M,{variant:"outline",size:"sm",onClick:()=>$({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),O&&a.isSuccess&&B.length>0&&e.jsx(bn,{columns:P,uid:s,selectedId:b?.id??null,onMove:(n,u)=>N.mutate({id:n,status:u})}),!O&&g.map(([n,u])=>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:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",u.length]})]}),u.map(S=>e.jsx(fn,{t:S,uid:s,on:b?.id===S.id,picked:U.has(S.id),picking:U.size>0,onPick:H=>K(ee=>{const re=new Set(ee);return H?re.add(S.id):re.delete(S.id),re})},S.id))]},n))]}),b&&e.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(M,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>$({thread:void 0}),children:[e.jsx($t,{}),"Back to the list"]})}),e.jsx(an,{thread:b,site:{name:h.name,...i.data?.origins[0]?{origin:i.data.origins[0]}:{}},onStatus:n=>N.mutate({id:b.id,status:n}),onReply:n=>A.mutateAsync({id:b.id,body:n}),replying:A.isPending,pool:m,onAssign:n=>v.mutate({id:b.id,assignee:n}),onAddPerson:n=>z.mutateAsync(n),trackers:(c.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>E.mutate({id:b.id,provider:n}),creatingIssue:E.isPending?E.variables?.provider:void 0,onEditComment:(n,u)=>f.mutateAsync({threadId:b.id,commentId:n,body:u}),onDeleteComment:n=>L.mutateAsync({threadId:b.id,commentId:n}),...o.user.role!=="viewer"?{onDeleteThread:async()=>{await Z.mutateAsync(b.id),$({thread:void 0})}}:{},...R.length?{move:{rounds:R,busy:I.isPending,onMove:n=>J([b.id],n)}}:{},onClose:()=>$({thread:void 0})})]})]})]})}function xn(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(r=>r.id===s)?.name??"Assignee":"Assignee"}function He(s){return s.anchor?.page?.route??s.route??"/"}function De(s){return D("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 Ve({on:s,onClick:t,children:r}){return e.jsx("button",{type:"button",className:De(s),"aria-pressed":s,onClick:t,children:r})}function pn({value:s,onChange:t}){const[r,o]=x.useState(s);return e.jsxs("form",{className:"relative",onSubmit:h=>{h.preventDefault(),t(r.trim())},children:[e.jsx(vt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(Re,{type:"search","aria-label":"Search comments",placeholder:"Search",value:r,onChange:h=>o(h.target.value),onBlur:()=>r.trim()!==s&&t(r.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function fn({t:s,uid:t,on:r,picked:o,picking:h,onPick:i}){const l=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:D("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:D("flex items-center",!h&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(Yt,{checked:o,onCheckedChange:c=>i(!!c),"aria-label":`Select ${s.key}`})}),e.jsxs(os,{to:"/s/$site/comments",params:{site:t},search:c=>({...c,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:[l,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(he,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(xe,{className:D("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ke(s.assignee.name)})}),e.jsx(fs,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ze(s.updatedAt)})]})]})]})}function gn(){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(be,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>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(be,{className:"h-3 w-10"}),e.jsx(be,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(be,{className:"h-3 w-11"}),e.jsx(be,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function bn({columns:s,uid:t,selectedId:r,onMove:o}){const[h,i]=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:l,items:y})=>e.jsxs("section",{"aria-label":pe[l],onDragOver:c=>{c.preventDefault(),i(l)},onDragLeave:()=>i(c=>c===l?null:c),onDrop:c=>{c.preventDefault(),i(null);const m=c.dataTransfer.getData("text/plain");m&&o(m,l)},className:D("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",h===l&&"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:D("size-[7px] rounded-full",ks[l])}),pe[l],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(c=>e.jsxs(os,{to:"/s/$site/comments",params:{site:t},search:m=>({...m,thread:c.key}),draggable:!0,onDragStart:m=>{m.dataTransfer.setData("text/plain",c.id),m.dataTransfer.effectAllowed="move"},className:D("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===c.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:c.comments[0]?.body??(typeof c.anchor?.label=="string"?c.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:c.key}),e.jsx("span",{className:"truncate",children:He(c)}),e.jsx("span",{className:"flex-1"}),c.assignee&&e.jsx(he,{className:"size-4",title:`Assigned to ${c.assignee.name}`,children:e.jsx(xe,{className:D("text-[8px] font-semibold",c.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ke(c.assignee.name)})}),e.jsx("span",{children:ze(c.updatedAt)})]})]},c.id))]})]},l))})}export{On as component,yt as isStatus};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aI as A,r as f,j as e,B as g,aJ as S,f as I,aK as E,y as k,Y as F,F as L,H as y}from"./index-DMCyFEmS.js";import{u as C}from"./useQuery-Cl9FITTP.js";import{u as P,a as H}from"./zod-khKoKeAB.js";import{C as R}from"./card-C4v3pSqd.js";import{X as M,E as U,G as $,I as B,H as z,J as K,K as Y}from"./dialog-lgIL_ZCX.js";import{L as N,I as J}from"./label-CL3Ivlhy.js";import{T as V,a as q,b as D,c as p,d as G,e as j}from"./table-BgojscGP.js";import{C as O}from"./ConfirmDialog-s6KLZt6w.js";import{C as Q}from"./CopyButton-Cqz1MLVB.js";import{P as X,E as W}from"./parts-b71WkkoI.js";import{b as T}from"./labels--UUyt9uB.js";import{C as Z}from"./check-BKP4SJjJ.js";import{U as _}from"./users-BXCV1C3P.js";import{P as ee}from"./plus-BOeukd4A.js";import"./useBaseQuery-BI_bJwNl.js";import"./copy-nRZWPHR1.js";function be(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),r=C(k.links(s)),l=C(k.origins(s)),[x,t]=f.useState(!1),[n,a]=f.useState(null);f.useEffect(()=>a(null),[s]);const i=r.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=n?`${c}/${n.fragment}`:"",v=e.jsxs(g,{onClick:()=>t(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.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(Z,{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:m}),e.jsx(Q,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>a(null),children:e.jsx(M,{})})]}),r.isSuccess&&i.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{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(V,{children:[e.jsx(q,{children:e.jsxs(D,{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(G,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>a(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(te,{uid:s,open:x,onOpenChange:t,onMinted:a})]})}function se({link:s,uid:d,onRevoked:r}){const l=S(d),[x,t]=f.useState(!1),n=!!s.revokedAt,a=!n&&new Date(s.expiresAt).getTime()<=Date.now(),i=n||a,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:I(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:n?e.jsxs("span",{children:["Revoked ",T(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 ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!n&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>t(!0),children:"Revoke"}),e.jsx(O,{open:x,onOpenChange:t,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:l.isPending,onConfirm:()=>{t(!1),r(),l.mutate(s.id)}})]})]})}const ne=L({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function te({uid:s,open:d,onOpenChange:r,onMinted:l}){const x=E(s),t=C({...k.rounds(s),enabled:d}),[n,a]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=P({resolver:H(ne),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{a("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),r(!1)}catch(w){a(F(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(U,{open:d,onOpenChange:r,children:e.jsx($,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx(z,{children:"New reviewer"}),e.jsx(K,{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(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(J,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("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."})]}),t.data&&t.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),t.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(Y,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{be as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,h as Me,a6 as de,a7 as Oe,d as ue,a5 as _e,E as me,i as he,j as e,a8 as Ye,e as Q,aG as ve,aM as Ue,f as pe,aN as Qe,aO as Je,B as V,y as Ae,aP as Xe,aQ as Ze,o as et,aR as tt}from"./index-DMCyFEmS.js";import{u as Fe}from"./useQuery-Cl9FITTP.js";import{f as Te,h as Le,j as Ve,u as Ke,A as st,c as nt,n as at,g as ye,e as it,k as ot,l as rt,a as dt,I as ae,L as q}from"./label-CL3Ivlhy.js";import{O as lt,L as ct,M as ut,N as mt,A as ft,aL as je,ak as Re,ad as le,a9 as ce,aM as Ce,aN as Ie,ao as ht,aO as we,aa as pt,ab as gt,aP as ke,aQ as Ne,aR as Se,aS as Ee,aT as xt,aU as bt,X as vt}from"./dialog-lgIL_ZCX.js";import{b as yt,u as jt,C as Rt}from"./CompositeItem-DpSaUtYZ.js";import{u as Ct}from"./useValueChanged-Dh5Yg1r8.js";import{u as It}from"./FieldItemContext-4dJ9QpEG.js";import{u as wt}from"./useAriaLabelledBy-Ce10PDSC.js";import{C as He}from"./ConfirmDialog-s6KLZt6w.js";import{C as kt}from"./CopyButton-Cqz1MLVB.js";import{I as Nt}from"./InstallTag-B4frNgVO.js";import{B as St}from"./badge-CrUHZwEL.js";import{a as ne,P as Et}from"./parts-b71WkkoI.js";import{u as Be}from"./me-6-FBHysO.js";import{S as Pe}from"./switch-CYLwE1-9.js";import{S as Pt}from"./SaveState-DfBHRtEq.js";import{P as Dt}from"./plus-BOeukd4A.js";import"./useBaseQuery-BI_bJwNl.js";import"./check-BKP4SJjJ.js";import"./copy-nRZWPHR1.js";import"./useRender-Ck8DP-Z3.js";import"./card-C4v3pSqd.js";import"./labels--UUyt9uB.js";const Mt=l.createContext(void 0);function Ot(s=!1){const t=l.useContext(Mt);if(!t&&!s)throw new Error(Me(86));return t}function At(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}function Ft(s){return s==null||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"}const fe={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...lt,...Te},Ge="data-composite-item-active",ze=l.createContext(void 0);function Tt(){return l.useContext(ze)}function Lt(s){if(s==null)return"";if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return String(s)}}const We=l.createContext(void 0);function Vt(){const s=l.useContext(We);if(s===void 0)throw new Error(Me(52));return s}const Kt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:i,inputRef:T,nativeButton:h=!1,id:O,style:y,...j}=t,I=Tt(),{disabled:E,readOnly:_,required:b,form:B,checkedValue:R,touched:A=!1,validation:G,name:w,setCheckedValue:$=de,setTouched:Y=de,registerInputRef:a=de}=I??{},{setTouched:g,setFilled:v,state:k,disabled:P}=Le(),D=It(),{labelId:K,getDescriptionProps:J}=Ve(),m=P||D.disabled||E||c,f=_||r,L=b||p,H=B,N=I?R===i:i==="",F=l.useRef(null),S=l.useRef(null),z=G?.registerInput,W=l.useCallback(C=>z?.(C,{controlRef:F,value:void 0}),[z]),X=Oe(T,S,a,W);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){a(null);return}a(S.current)}},[N,m,a]);const ee=Ke(),te=st({id:O,implicit:!1,controlRef:F}),se=h?void 0:te,ie=wt(x,K,S,!h,se),oe={role:"radio","aria-checked":N,"aria-labelledby":ie,[Ge]:N?"":void 0,id:h?te:ee,onKeyDown(C){C.key==="Enter"&&C.preventDefault()},onClick(C){if(C.defaultPrevented||m||f)return;C.preventDefault();const Z=S.current;Z&&Ye(Z,C)},onFocus(C){C.defaultPrevented||m||f||!A||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=_e({disabled:m,native:h,composite:!1}),M={type:"radio",ref:X,form:H,id:se,name:w,tabIndex:-1,style:w?ct:ut,"aria-hidden":!0,...i!==void 0?{value:Lt(i)}:me,disabled:m,checked:N,required:L,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||i===void 0)return;const Z=nt(at,C.nativeEvent);$(i,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){F.current?.focus()}},U=l.useMemo(()=>({...k,required:L,disabled:m,readOnly:f,checked:N}),[k,m,f,N,L]),$e=U,ge=I!==void 0,xe=[n,F,u],be=[oe,j,re,J,G?C=>G.getValidationProps(m,C):me],qe=he("span",t,{enabled:!ge,state:U,ref:xe,props:be,stateAttributesMapping:fe});return e.jsxs(We.Provider,{value:$e,children:[ge?e.jsx(yt,{tag:"span",render:d,className:o,style:y,state:U,refs:xe,props:be,stateAttributesMapping:fe}):qe,e.jsx("input",{...M,suppressHydrationWarning:!0})]})}),Ht=l.forwardRef(function(t,n){const{render:d,className:o,style:c,keepMounted:r=!1,...p}=t,x=Vt(),i=x.checked,{mounted:T,transitionStatus:h,setMounted:O}=mt(i),y={...x,transitionStatus:h},j=l.useRef(null),I=r||T,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return ft({open:i,ref:j,onComplete(){i||O(!1)}}),I?E:null}),Bt=[];function Gt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:o,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:i=!1,stopEventPropagation:T,disabledIndices:h,modifierKeys:O=Bt}=s,[y,j]=l.useState(0),I=d!=null,E=l.useRef(null),_=Oe(E,x),b=l.useRef([]),B=l.useRef(!1),R=r??y,A=Q((a,g=!1)=>{if((p??j)(a),g){const v=b.current[a];je(E.current,v,c,n)}}),G=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(Ge))??null,k=v?a.get(v)?.index??-1:-1;if(k!==-1)A(k);else if(Re(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||A(P)}je(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!B.current)return;const a=b.current;if(Re(a,R,h)){const g=le(a,{disabledIndices:h});ce(a,g)||A(g)}},[h,r,R,b,A]);const w=Q((a,g,v)=>o?o(a,g,v,b):v),$=Q(a=>{const g=a.key===Ce||a.key===Ie;if(!ht.has(a.key)||!i&&g||zt(a,O)||!E.current)return;const k=c==="rtl",P=k?Se:Ee,D=k?Ee:Se,K=n==="vertical"?ke:P,J=n==="vertical"?Ne:D,m=ye(a.nativeEvent);if(m!=null&&we(m)&&!Ft(m)){const S=m.selectionStart,z=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==z||a.key!==J&&S<W.length||a.key!==K&&S>0)return}let f=R;const L=pt(b,h),H=gt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:a,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:L,onLoop:w,orientation:n,rtl:k}));const N=n!=="vertical"&&a.key===P||n!=="horizontal"&&a.key===ke,F=n!=="vertical"&&a.key===D||n!=="horizontal"&&a.key===Ne;i&&(a.key===Ce?f=L:a.key===Ie&&(f=H)),f===R&&(N||F)&&(t&&f===H&&N?(f=L,o&&(f=o(a,R,f,b))):t&&f===L&&F?(f=H,o&&(f=o(a,R,f,b))):f=le(b.current,{startingIndex:f,decrement:F,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(T&&a.stopPropagation(),(I||g||N||F)&&a.preventDefault(),A(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(a){const g=E.current,v=ye(a.nativeEvent);!g||v==null||!we(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:$},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:b,onMapChange:G,relayKeyboardEvent:$}}function zt(s,t){for(const n of xt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function Wt(s){const{render:t,className:n,style:d,refs:o=ve,props:c=ve,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:i,orientation:T,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:I,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:B,highlightItemOnHover:R=!1,tag:A="div",...G}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=Gt({grid:h,loopFocus:O,onLoop:y,orientation:T,highlightedIndex:x,onHighlightedIndexChange:i,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:w,disabledIndices:b,modifierKeys:B}),P=he(A,s,{state:r,ref:o,props:[$,...c,G],stateAttributesMapping:p}),D=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:a,highlightItemOnHover:R,relayKeyboardEvent:k}),[Y,a,R,k]);return e.jsx(Ue.Provider,{value:D,children:e.jsx(Rt,{elementsRef:g,onMapChange:K=>{I?.(K),v(K)},children:P})})}const $t=[bt],qt=l.forwardRef(function(t,n){const{render:d,className:o,disabled:c,readOnly:r,required:p,onValueChange:x,value:i,defaultValue:T,form:h,name:O,inputRef:y,id:j,style:I,...E}=t,{setTouched:_,setFocused:b,validationMode:B,name:R,disabled:A,state:G,validation:w,setDirty:$,setFilled:Y,validityData:a}=Le(),{labelId:g}=Ve(),{clearErrors:v,elementRef:k}=it(),P=Ot(!0),D=A||c,K=R??O,J=Ke(j),[m,f]=ot({controlled:i,default:T,name:"RadioGroup",state:"value"}),[L,H]=l.useState(!1),N=Q((u,M)=>{x?.(u,M),!M.isCanceled&&f(u)}),F=w.getInputControl,S=l.useMemo(()=>({get current(){return F()}}),[F]),z=l.useRef(null),W=l.useRef(null);function X(u){let M;return y&&(typeof y=="function"?M=y(u):y.current=u),z.current=u,M}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const M=z.current,U=u.checked||M==null||M.disabled?X(u):void 0;return()=>{W.current===u&&(W.current=null),z.current===u?U?(U(),z.current=null):X(null):U?.()}}),te=Q(()=>{const u=k.current;if(!u)return m??null;for(const M of w.registeredInputs.keys())if(M.checked&&At(M,u))return m??null;return null});rt(S,J,m??null,te,!D,O),Ct(m,()=>{v(K),$(m!==a.initialValue),Y(m!=null),w.change(m);const u=W.current;m==null&&u&&!u.disabled&&X(u)});const se=g??P?.legendId,ie={...G,disabled:D??!1,required:p??!1,readOnly:r??!1},oe=l.useMemo(()=>({checkedValue:m,disabled:D,form:h,validation:w,name:K,readOnly:r,registerInputRef:ee,required:p,setCheckedValue:N,setTouched:H,touched:L}),[m,D,h,w,K,r,ee,p,N,H,L]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":D||void 0,"aria-readonly":r||void 0,"aria-labelledby":se,onFocus(){b(!0)},onBlur(u){dt(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),B==="onBlur"&&w.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(ze.Provider,{value:oe,children:e.jsx(Wt,{render:d,className:o,style:I,state:ie,props:[re,E,u=>w.getValidationProps(D??!1,u)],refs:[n],stateAttributesMapping:Te,enableHomeAndEndKeys:!1,modifierKeys:$t})})});function _t({className:s,...t}){return e.jsx(qt,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Yt({className:s,...t}){return e.jsx(Kt,{"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(Ht,{"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 Ut({uid:s}){const t=Be(),n=Fe(Ae.rounds(s)),d=t.user.role==="owner"||t.user.role==="admin",o=n.data?.data??[],c=o.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ne,{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:[o.map(r=>e.jsx(Qt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&o.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const De="Open another round first — new comments need somewhere to go.";function Qt({uid:s,round:t,manager:n,last:d}){const o=Qe(s),c=Je(s),[r,p]=l.useState(!1),[x,i]=l.useState(t.name),[T,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=o.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 I=x.trim();if(!I||I===t.name)return p(!1);o.mutate({id:t.id,name:I},{onSuccess:()=>p(!1)})},children:[e.jsx(ae,{"aria-label":`New name for ${t.name}`,value:x,maxLength:80,autoFocus:!0,onChange:j=>i(j.target.value),onKeyDown:j=>j.key==="Escape"&&p(!1)}),e.jsx(V,{type:"submit",size:"sm",disabled:!x.trim()||o.isPending,children:"Save"}),e.jsx(V,{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(St,{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?De:void 0,children:[e.jsx(V,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{i(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>o.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(V,{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:De}),e.jsx(He,{open:T,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 Jt=[{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 ws(){const{site:s}=Xe.useParams(),t=Be(),n=t.projects.find(i=>i.uid===s),d=t.user.role==="owner"||t.user.role==="admin",o=Fe(Ae.origins(s)),c=Ze(s),[r,p]=l.useState(null),x=i=>c.mutate(i,{onSuccess:()=>p(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Et,{title:"Settings",sub:n.name,actions:e.jsx(Pt,{saving:c.isPending,savedAt:r})}),e.jsxs(ne,{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(kt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Xt,{name:n.name,onSave:i=>x({name:i})}),e.jsx(Zt,{domain:o.data?.domain??null,loaded:o.isSuccess,onSave:i=>x({domain:i})}),e.jsx(es,{list:o.data?.origins??[],loaded:o.isSuccess,hasDomain:!!o.data?.domain,onChange:i=>x({origins:i})})]}),e.jsxs(ne,{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(Pe,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:i=>x({status:i?"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(Pe,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!d,onCheckedChange:i=>x({guestsCanChangeStatus:i})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{children:"Who can comment"}),e.jsx(_t,{value:n.writeMode,onValueChange:i=>x({writeMode:String(i)}),className:"gap-2",children:Jt.map(i=>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===i.id&&"border-brand bg-brand-soft"),children:[e.jsx(Yt,{value:i.id,className:"mt-0.5","aria-label":i.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:i.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:i.note})]})]},i.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"The tag"}),e.jsx(Nt,{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(Ut,{uid:s}),e.jsx(ts,{uid:s,name:n.name})]})}function Xt({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const o=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),o&&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)}),o&&e.jsx(V,{type:"submit",variant:"outline",children:"Save"})]})]})}function Zt({domain:s,loaded:t,onSave:n}){const[d,o]=l.useState(s??"");l.useEffect(()=>o(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=>o(r.target.value),disabled:!t}),c&&e.jsx(V,{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 es({list:s,loaded:t,hasDomain:n,onChange:d}){const[o,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(V,{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(vt,{})})]},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=o.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:o,onChange:r=>c(r.target.value)}),e.jsxs(V,{type:"submit",variant:"outline",disabled:!o.trim(),children:[e.jsx(Dt,{}),"Add"]})]})]})}function ts({uid:s,name:t}){const[n,d]=l.useState(!1),o=et(),c=tt(s);return e.jsxs(ne,{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(V,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(He,{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),o({to:"/sites"})}})})]})}export{ws as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as p,r as u,p as h,x as g,z as f,A as j,j as e,G as N,B as w,L as v,F as y,H as t}from"./index-DMCyFEmS.js";import{u as b,a as S}from"./zod-khKoKeAB.js";import{L as o,I as i}from"./label-CL3Ivlhy.js";const A=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(A)}),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(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{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(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{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(o,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{X as v,r as x,j as e,B as c,L as N,o as y,t as w,p as A,A as S,F as $,H as p}from"./index-DMCyFEmS.js";import{u as k,a as _}from"./zod-khKoKeAB.js";import{C}from"./card-C4v3pSqd.js";import{E,G as D,I as F,H as I,J as L,K as P}from"./dialog-lgIL_ZCX.js";import{L as h,I as g}from"./label-CL3Ivlhy.js";import{P as z,E as H}from"./parts-b71WkkoI.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-6-FBHysO.js";import{P as f}from"./plus-BOeukd4A.js";import{L as q}from"./layout-grid-B-9bb2Av.js";import{I as B}from"./image-off-B6flKQEZ.js";import"./useBaseQuery-BI_bJwNl.js";function te(){const i=T(),{add:a}=v.useSearch(),[m,r]=x.useState(!!a);x.useEffect(()=>{a&&r(!0)},[a]);const d=i.projects.reduce((s,o)=>s+o.unresolved,0),t=i.limits.projects.limit,n=t!==null&&i.projects.length>=t;return e.jsxs("div",{className:"p-7",children:[e.jsx(z,{title:"Sites",sub:i.projects.length?`${i.projects.length}${t!==null?` of ${t}`:""} site${i.projects.length===1&&t===null?"":"s"} · ${d} open`:t!==null?`0 of ${t} sites`:void 0,actions:e.jsxs(c,{onClick:()=>r(!0),disabled:n,title:n?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(f,{}),"Add a site"]})}),i.projects.length===0?e.jsx(C,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(q,{className:"size-5"}),title:"No sites yet",action:e.jsxs(c,{onClick:()=>r(!0),children:[e.jsx(f,{}),"Add a site"]}),children:"A site is one client website. Add it, paste the tag, and comments start arriving here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:i.projects.map(s=>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",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(B,{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}),s.status==="paused"&&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:"Paused"})]}),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)}`:""}`})]})]},s.uid))}),e.jsx(Q,{open:m,onOpenChange:r})]})}const G=$({name:p().trim().min(1,"A name"),domain:p().trim().min(1,"Its domain")});function Q({open:i,onOpenChange:a}){const m=y(),r=w(),[d,t]=x.useState(""),{register:n,handleSubmit:s,formState:o,reset:j}=k({resolver:_(G)}),b=s(async u=>{t("");try{const l=await A.createProject(u.name,"",u.domain);await r.invalidateQueries({queryKey:["me"]}),j(),a(!1),m({to:"/s/$site/comments",params:{site:l.uid}})}catch(l){t(l instanceof S?l.message:"Could not add the site.")}});return e.jsx(E,{open:i,onOpenChange:a,children:e.jsx(D,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(F,{children:[e.jsx(I,{children:"Add a site"}),e.jsx(L,{children:"One client website. The tag it needs is shown right after."})]}),d&&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:d}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-name",children:"Name"}),e.jsx(g,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!o.errors.name,...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-domain",children:"Domain"}),e.jsx(g,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!o.errors.domain,...n("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(P,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(c,{type:"submit",loading:o.isSubmitting,children:o.isSubmitting?"Adding…":"Add site"})]})]})})})}export{te as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-DMCyFEmS.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as B,r as h,Z as v,p as y,_ as b,Y as C,j as e,B as g,y as S,A as K,S as _}from"./index-DMCyFEmS.js";import{u as w}from"./useQuery-Cl9FITTP.js";import{L as A,I as k}from"./label-CL3Ivlhy.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-lgIL_ZCX.js";import{C as G}from"./ConfirmDialog-s6KLZt6w.js";import{a as D,P as O}from"./parts-b71WkkoI.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-6-FBHysO.js";import{S as q}from"./SaveState-DfBHRtEq.js";import{b as H}from"./studio-CBGrW0G1.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-BI_bJwNl.js";import"./card-C4v3pSqd.js";function V({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),N=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),N.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(N.limits.storage.used)," of ",R(N.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(P,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(E,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(P,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(W,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(J,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(G,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function E({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function P({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,N,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(k,{id:`st-${r}`,type:m,placeholder:N,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),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}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function J({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&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:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(k,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(k,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function me(){const n=z(),s=w(S.meta()),i=w(S.members()),t=H(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(O,{title:"General",sub:n.org.name,actions:e.jsx(q,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{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:[s.data?.version??"—"," ",e.jsx(Y,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Z,{owner:c})}),s.data?.commit&&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:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(V,{owner:c})]})}function Y({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).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"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(_,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function Z({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),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."})]})}export{me as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as z,r as i,Z as P,_ as A,Y as K,p as T,$ as J,j as e,V as Q,B as N,y as U,a0 as oe,A as H}from"./index-DMCyFEmS.js";import{u as B}from"./useQuery-Cl9FITTP.js";import{B as G}from"./badge-CrUHZwEL.js";import{E,G as O,I as R,H as D,J as L,K as M}from"./dialog-lgIL_ZCX.js";import{L as C,I as F}from"./label-CL3Ivlhy.js";import{S as ae}from"./switch-CYLwE1-9.js";import{C as V}from"./ConfirmDialog-s6KLZt6w.js";import{P as re,a as Y}from"./parts-b71WkkoI.js";import{C as W}from"./CopyButton-Cqz1MLVB.js";import{b as Z}from"./labels--UUyt9uB.js";import{u as ie}from"./me-6-FBHysO.js";import"./useBaseQuery-BI_bJwNl.js";import"./useRender-Ck8DP-Z3.js";import"./useAriaLabelledBy-Ce10PDSC.js";import"./useValueChanged-Dh5Yg1r8.js";import"./card-C4v3pSqd.js";import"./check-BKP4SJjJ.js";import"./copy-nRZWPHR1.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Re(){const r=ie(),c=r.user.role==="owner"||r.user.role==="admin",k=r.user.role==="owner",f=B(U.integrations()),g=z(),j=()=>g.invalidateQueries({queryKey:["integrations"]}),[d,p]=i.useState(null),[l,m]=i.useState(null),[h,u]=i.useState(null),v=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>u({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(K(t))}),w=P({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(a=>({...a,provider:s})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${J[t.provider]} can see ${t.target}`:t.detail??`${J[t.provider]} refused the token`),j()},onError:t=>A.error(K(t))}),x=P({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{m(null),j()},onError:t=>A.error(K(t))}),y=f.data?.data??[],b=t=>y.filter(s=>s.provider===t),n=t=>r.projects.filter(s=>!b(t).some(a=>a.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=b(t),a=n(t);return e.jsxs(Y,{title:J[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(Q,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{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(o=>{const I=ce[o.health]??{label:o.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:o.siteName??o.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:o.provider==="github"?`${o.owner}/${o.repo}`:o.provider==="linear"?`${o.teamKey} · ${o.teamName}`:o.provider==="jira"?`${o.projectKey} · ${o.projectName}`:`#${o.channelName} · ${o.teamName}`}),e.jsx(G,{variant:"outline",className:I.tone==="ok"?"border-ok text-ok":I.tone==="bad"?"border-destructive text-destructive":"",children:I.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.provider==="slack"?o.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":o.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",o.provider==="github"&&o.labels.length?` · labels ${o.labels.join(", ")}`:"",o.provider!=="github"&&o.provider!=="slack"&&!o.hasWebhookSecret?` · no webhook secret yet, so ${J[o.provider]} cannot move comments here`:""," · ",Z(o.updatedAt)]}),o.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:o.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[o.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(o.site),children:"Webhook…"}):o.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>u({site:o.site,provider:o.provider,hook:{url:`${location.origin}/api/v1/integrations/${o.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:w.isPending,onClick:()=>w.mutate({uid:o.site,provider:o.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(o),children:"Disconnect"})]})]},`${o.provider}:${o.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>p(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,instanceOwner:k,sites:r.projects}),e.jsx(le,{open:d==="github",onOpenChange:t=>!t&&p(null),sites:n("github"),onDone:(t,s)=>{j(),s&&u({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(me,{open:d==="linear",onOpenChange:t=>!t&&p(null),sites:n("linear"),onDone:(t,s)=>{j(),u({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(he,{open:d==="jira",onOpenChange:t=>!t&&p(null),sites:n("jira"),onDone:(t,s)=>{j(),u({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ue,{open:d==="slack",onOpenChange:t=>!t&&p(null),sites:n("slack"),onDone:()=>void j()}),e.jsx(de,{state:h,onClose:()=>u(null),siteName:t=>y.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(V,{open:l!==null,onOpenChange:t=>!t&&m(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?J[l.provider]:"the tracker"}?`,description:l?.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:x.isPending,onConfirm:async()=>{l&&await x.mutateAsync({uid:l.site,provider:l.provider})}})]})}function le({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"github",{repository:d.trim(),token:l.trim(),labels:h,createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook&&"secret"in a.webhook?a.webhook:void 0),A.success("GitHub connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{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."]})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>p(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(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:s=>m(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(F,{id:"gh-labels",placeholder:"review, bug",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:k}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?k(r.site):"")}),e.jsx(L,{children:r?.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.":r?.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${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&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:r.hook.url}),e.jsx(W,{text:r.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(W,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(!1),[x,y]=i.useState(""),b=P({mutationFn:s=>T.connectTracker(s,"linear",{team:d.trim(),apiKey:l.trim(),...h.trim()?{webhookSecret:h.trim()}:{},createOn:v?"thread.created":"manual"})}),n=g||k[0]?.uid||"",t=async s=>{s.preventDefault(),y("");try{const a=await b.mutateAsync(n);p(""),m(""),u(""),w(!1),c(!1),f(n,a.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(a){y(a instanceof H?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{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."})]}),x&&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:x}),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:n,onChange:s=>j(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>p(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(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:s=>m(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(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:h,onChange:s=>u(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:v,onChange:s=>w(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!d.trim()||!l.trim()||!n,children:b.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(""),[v,w]=i.useState(""),[x,y]=i.useState(""),[b,n]=i.useState(!1),[t,s]=i.useState(""),a=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:l.trim(),email:h.trim(),apiToken:v.trim(),...x.trim()?{webhookSecret:x.trim()}:{},createOn:b?"thread.created":"manual"})}),o=g||k[0]?.uid||"",I=async S=>{S.preventDefault(),s("");try{const _=await a.mutateAsync(o);m(""),w(""),y(""),n(!1),c(!1),f(o,_.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(_){s(_ instanceof H?_.message:"Could not reach the server.")}},$=(S,_,X,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:_}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:X,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:S=>void I(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{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:o,onChange:S=>j(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),$("url","Jira site",d,p,"https://kilnwork.atlassian.net"),$("project","Project key",l,m,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",h,u,"you@kilnwork.studio","email"),$("token","API token",v,w,"","password"),$("secret","Webhook secret",x,y,"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: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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:a.isPending,disabled:!d.trim()||!l.trim()||!h.trim()||!v.trim()||!o,children:a.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:k,onDone:f}){const[g,j]=i.useState(""),[d,p]=i.useState(""),[l,m]=i.useState(""),[h,u]=i.useState(!0),[v,w]=i.useState(""),x=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:t=>T.connectTracker(t,"slack",{channel:d.trim(),token:l.trim(),createOn:h?"thread.created":"manual"})}),b=g||k[0]?.uid||"",n=async t=>{t.preventDefault(),w("");try{await y.mutateAsync(b),p(""),m(""),u(!0),c(!1),f(b),A.success("Slack connected")}catch(s){w(s instanceof H?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void n(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{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."})]}),v&&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:v}),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:b,onChange:t=>j(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:k.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(N,{type:"button",variant:"outline",size:"sm",disabled:!x.data,render:e.jsx("a",{href:x.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(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:t=>m(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(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:t=>p(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:h,onChange:t=>u(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(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!l.trim()||!b,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,instanceOwner:c,sites:k}){const f=z(),g=B(U.mcpTokens()),[j,d]=i.useState(!1),[p,l]=i.useState(null),[m,h]=i.useState(null),u=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{h(null),f.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(K(n))}),v=g.data?.data??[],w=v.filter(n=>!n.revokedAt),x=g.data?.http??null,y=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{f.setQueryData(U.instance().queryKey,n),f.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(K(n))}),b=n=>{const t=new Set(n),s=t.has("comments:write")||t.has("threads:write");return!s&&!t.has("context:read")?"Read-only":s?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(Y,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[g.isPending&&e.jsx(Q,{rows:2}),x&&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(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[x.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:x.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),x.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:x.enabled,disabled:!c||x.source==="env"||y.isPending,onCheckedChange:n=>y.mutate(n)})]}),g.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),v.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:v.map(n=>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] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":b(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Z(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),n.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(pe,{open:j,onOpenChange:d,sites:k,http:g.data?.http??null,onDone:n=>{f.invalidateQueries({queryKey:["mcp-tokens"]}),l(n)}}),e.jsx(fe,{state:p,http:g.data?.http??null,onClose:()=>l(null)}),e.jsx(V,{open:m!==null,onOpenChange:n=>!n&&h(null),title:`Revoke “${m?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:u.isPending,onConfirm:async()=>{m&&await u.mutateAsync(m.id)}})]})}function pe({open:r,onOpenChange:c,sites:k,http:f,onDone:g}){const[j,d]=i.useState(""),[p,l]=i.useState(""),[m,h]=i.useState(["threads:read","source:map"]),[u,v]=i.useState(""),[w,x]=i.useState(!1),[y,b]=i.useState(""),n=P({mutationFn:()=>T.mintMcpToken({name:j.trim(),...p?{site:p}:{},scopes:m,...u?{expiresInDays:Number(u)}:{},...w?{allowRemoteWrites:!0}:{}})}),t=(a,o)=>h(I=>o?[...new Set([...I,a])]:I.filter($=>$!==a)),s=async a=>{a.preventDefault(),b("");try{const o=await n.mutateAsync();d(""),l(""),h(["threads:read","source:map"]),v(""),x(!1),c(!1),g(o)}catch(o){b(o instanceof H?o.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void s(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&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:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:j,onChange:a=>d(a.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:p,onChange:a=>l(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),k.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(a=>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:m.includes(a.scope),onChange:o=>t(a.scope,o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:a.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:a.hint})]})]},a.scope))]}),f?.enabled&&(m.includes("comments:write")||m.includes("threads:write"))&&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:w,onChange:a=>x(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:u,onChange:a=>v(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(M,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!j.trim()||m.length===0,children:n.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:k}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},j=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([h,u])=>`-e ${h}=${u}`),"--","npx -y @snagset/mcp"].join(" "),p=`Bearer ${r?.secret??""}`,l=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${p}"`].join(" "),m=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:p}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:h=>!h&&k(),children:e.jsxs(O,{className:"sm:max-w-xl",children:[e.jsxs(R,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(W,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(W,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(W,{text:m,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:m}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(W,{text:j,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:j}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(M,{children:e.jsx(N,{type:"button",onClick:k,children:"Done"})})]})})}export{Re as component};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as L,j as e,f as q,r as p,B as x,Y as y,C as G,F as _,a1 as V,a2 as Y,a3 as J,H as K,y as w}from"./index-DMCyFEmS.js";import{u as N}from"./useQuery-Cl9FITTP.js";import{u as Q,a as W}from"./zod-khKoKeAB.js";import{A as X,a as U}from"./avatar-DkFTIwsR.js";import{B as Z}from"./badge-CrUHZwEL.js";import{C as A}from"./card-C4v3pSqd.js";import{X as ee,E as se,G as ie,I as k,H as C,J as S,K as I}from"./dialog-lgIL_ZCX.js";import{L as R,I as te}from"./label-CL3Ivlhy.js";import{T as D,a as P,b as j,c as o,d as T,e as d}from"./table-BgojscGP.js";import{C as ne}from"./ConfirmDialog-s6KLZt6w.js";import{C as ae}from"./CopyButton-Cqz1MLVB.js";import{P as re,b as le}from"./parts-b71WkkoI.js";import{a as oe}from"./labels--UUyt9uB.js";import{u as de}from"./me-6-FBHysO.js";import{c as ce,d as me,e as xe,f as he,g as ue}from"./studio-CBGrW0G1.js";import{P as pe}from"./plus-BOeukd4A.js";import"./useBaseQuery-BI_bJwNl.js";import"./useRender-Ck8DP-Z3.js";import"./check-BKP4SJjJ.js";import"./copy-nRZWPHR1.js";/**
|
|
2
|
-
* @license lucide-react v1.39.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const je=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],fe=L("mail",je);function $({className:s,...t}){return e.jsx("select",{className:q("h-8 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 disabled:opacity-50",s),...t})}function qe(){const s=de(),t=s.user.role==="owner",l=N(w.members()),i=N(w.invites()),[c,r]=p.useState(!1),a=s.limits.members.limit,n=a!==null&&s.limits.members.used>=a;return e.jsxs("div",{className:"p-7",children:[e.jsx(re,{title:"Members",sub:`${t?"Owners and admins can do everything; only owners change this list.":"Owners and admins can do everything. Ask an owner to change this list."}${a!==null?` ${s.limits.members.used} of ${a} members.`:""}`,actions:t?e.jsxs(x,{onClick:()=>r(!0),disabled:n,title:n?`This studio's plan allows ${a} members.`:void 0,children:[e.jsx(pe,{}),"Invite"]}):void 0}),e.jsx(A,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(D,{children:[e.jsx(P,{children:e.jsxs(j,{children:[e.jsx(o,{children:"Name"}),e.jsx(o,{children:"Email"}),e.jsx(o,{children:"Role"}),t&&e.jsx(o,{className:"w-0"})]})}),e.jsx(T,{children:(l.data?.data??[]).map(h=>e.jsx(ge,{m:h,owner:t},h.email))})]})}),(i.data?.data.length??0)>0&&e.jsx(ve,{invites:i.data.data,owner:t}),e.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",e.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),t&&e.jsx(ye,{open:c,onOpenChange:r,mail:i.data?.mail??!1})]})}const B=s=>new Date(s).toLocaleDateString(void 0,{day:"numeric",month:"short"});function ve({invites:s,owner:t}){const l=xe();return e.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[e.jsx("div",{id:"pending-invites",className:"mb-2",children:e.jsx(le,{children:"Pending invites"})}),e.jsx(A,{className:"overflow-hidden py-0",children:e.jsxs(D,{children:[e.jsx(P,{children:e.jsxs(j,{children:[e.jsx(o,{children:"For"}),e.jsx(o,{children:"Role"}),e.jsx(o,{children:"Invited by"}),e.jsx(o,{children:"Expires"}),t&&e.jsx(o,{className:"w-0"})]})}),e.jsx(T,{children:s.map(i=>e.jsxs(j,{children:[e.jsx(d,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),e.jsx(d,{className:"capitalize",children:i.role}),e.jsx(d,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),e.jsx(d,{className:"text-muted-foreground",children:B(i.expiresAt)}),t&&e.jsx(d,{className:"text-right",children:e.jsx(x,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:l.isPending&&l.variables===i.id,onClick:()=>l.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function ge({m:s,owner:t}){const l=ce(),i=me(),[c,r]=p.useState(!1);return e.jsxs(j,{children:[e.jsx(d,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(X,{className:"size-6",children:e.jsx(U,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:oe(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(Z,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(d,{className:"text-muted-foreground",children:s.email}),e.jsx(d,{children:t?e.jsxs($,{"aria-label":`Role for ${s.email}`,value:s.role,onChange:a=>l.mutate({email:s.email,role:a.target.value}),children:[e.jsx("option",{value:"owner",children:"Owner"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx("span",{className:"capitalize",children:s.role})}),t&&e.jsxs(d,{className:"text-right",children:[!s.you&&e.jsx(x,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>r(!0),children:e.jsx(ee,{})}),e.jsx(ne,{open:c,onOpenChange:r,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:i.isPending,onConfirm:()=>{r(!1),i.mutate(s.email)}})]})]})}const be=_({email:Y([J(""),K().trim().email("An email address, or leave it empty")]),role:V(["owner","admin"])});function ye({open:s,onOpenChange:t,mail:l}){const i=he(),c=ue(),[r,a]=p.useState(""),[n,h]=p.useState(null),[v,g]=p.useState(null),{register:b,handleSubmit:M,formState:u,reset:E}=Q({resolver:W(be),defaultValues:{role:"admin",email:""}}),f=m=>{t(m),m||(h(null),g(null),a(""),c.reset(),E())},F=M(async m=>{a("");try{h(await i.mutateAsync({role:m.role,...m.email?{email:m.email}:{}}))}catch(H){a(y(H))}}),O=async()=>{if(n){a("");try{g((await c.mutateAsync({id:n.invite.id,token:n.token})).to)}catch(m){a(y(m))}}},z=(n?.mail??l)&&!!n?.invite.email;return e.jsx(se,{open:s,onOpenChange:f,children:e.jsx(ie,{children:n?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs(k,{children:[e.jsx(C,{children:"Invite link"}),e.jsxs(S,{children:[n.invite.email?`${n.invite.email} can`:"Anyone with this link can"," join as ",G(n.invite.role)," ","until ",B(n.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&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:r}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:n.url}),e.jsx(ae,{text:n.url,label:"Copy link",withText:!0})]}),z&&(v?e.jsxs("p",{role:"status",className:"m-0 text-[13px] text-muted-foreground",children:["Sent to ",v,"."]}):e.jsxs(x,{type:"button",variant:"outline",className:"self-start",loading:c.isPending,onClick:()=>void O(),children:[e.jsx(fe,{}),c.isPending?"Sending…":`Send by email to ${n.invite.email}`]})),e.jsx(I,{children:e.jsx(x,{type:"button",onClick:()=>f(!1),children:"Done"})})]}):e.jsxs("form",{onSubmit:F,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(k,{children:[e.jsx(C,{children:"Invite someone"}),e.jsx(S,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&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:r}),e.jsxs("fieldset",{disabled:u.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(R,{htmlFor:"invite-role",children:"Role"}),e.jsxs($,{id:"invite-role",className:"w-full",...b("role"),children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"owner",children:"Owner"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(R,{htmlFor:"invite-email",children:["Email ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(te,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!u.errors.email,...b("email")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:u.errors.email?.message??(l?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),e.jsxs(I,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>f(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:u.isSubmitting,children:u.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}export{qe as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u}from"./useBaseQuery-BI_bJwNl.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as n}from"./index-DMCyFEmS.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,v as w,j as e,f as b,w as y,B as f,Y as N}from"./index-DMCyFEmS.js";import{L as c,I as m}from"./label-CL3Ivlhy.js";import{P as S,a as h}from"./parts-b71WkkoI.js";import{S as C}from"./SaveState-DfBHRtEq.js";import{u as P}from"./me-6-FBHysO.js";import{u as A,a as k}from"./studio-CBGrW0G1.js";import{M as F,S as E,a as M}from"./sun-ygOg7Lon.js";import"./card-C4v3pSqd.js";import"./labels--UUyt9uB.js";import"./useBaseQuery-BI_bJwNl.js";function T({items:t}){const[a,n]=r.useState(w);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:t.map(s=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===s.value,onClick:()=>{y(s.value),n(s.value)},className:b("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===s.value&&"border-line-strong bg-muted text-foreground"),children:[s.icon,s.label]},s.value))})}function J(){const t=P(),a=A(),[n,s]=r.useState(t.user.name),[u,l]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const d=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(S,{title:"You",sub:"Your own account on this studio",actions:e.jsx(C,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:i=>{i.preventDefault(),d&&a.mutate(n.trim(),{onSuccess:()=>l(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{id:"your-name",value:n,onChange:i=>s(i.target.value)}),d&&e.jsx(f,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(m,{id:"your-email",value:t.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(D,{})}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(T,{items:[{value:"system",label:"System",icon:e.jsx(F,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(E,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(M,{className:"size-3.5"})}]})})]})}function D(){const t=k(),[a,n]=r.useState(""),[s,u]=r.useState(""),[l,d]=r.useState(""),[i,g]=r.useState(""),[j,x]=r.useState(!1),p=a.length>0&&s.length>=12&&s===l;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!p||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),d(""),x(!0)}catch(v){g(N(v))}}},children:[i&&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:i}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(m,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),x(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(m,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),x(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(m,{id:"pw-again",type:"password",autoComplete:"new-password",value:l,onChange:o=>{d(o.target.value),x(!1)}}),l.length>0&&s!==l&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(f,{type:"submit",loading:t.isPending,disabled:!p,children:t.isPending?"Changing…":j&&!p?"Changed":"Change password"})})]})}export{J as component};
|