@snagset/server 0.1.20 → 0.1.21
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 +3 -0
- package/dist/app.js.map +1 -1
- package/dist/instance/region.js +78 -0
- package/dist/instance/region.js.map +1 -0
- package/dist/routes/owner.js +2 -0
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/threads.js +23 -12
- package/dist/routes/threads.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-DFk-PY9L.js → CompositeItem-9k6gamy_.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-COCFkJPd.js → ConfirmDialog-CJ4rxhiM.js} +1 -1
- package/static/dashboard/assets/{CopyButton-BSZUdGOe.js → CopyButton-DQaUk_fX.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-B1tO9RIm.js → FieldItemContext-DwjMGEtR.js} +1 -1
- package/static/dashboard/assets/{InstallTag-C-bSYUSW.js → InstallTag-Bv5eJ-pY.js} +1 -1
- package/static/dashboard/assets/{SaveState-9-TiAnKs.js → SaveState-BAmXwwnU.js} +1 -1
- package/static/dashboard/assets/{_app-dK3H_NFl.js → _app-BhtEIIYY.js} +1 -1
- package/static/dashboard/assets/{_app-B6Dr81cl.js → _app-dUX6QHB2.js} +2 -2
- package/static/dashboard/assets/{activity-B-4_ONuX.js → activity-C0C-uw85.js} +1 -1
- package/static/dashboard/assets/{arrow-left-et5uGMTY.js → arrow-left-5yNow0eG.js} +1 -1
- package/static/dashboard/assets/{avatar-BYKf3ktl.js → avatar-BTlpQ4so.js} +1 -1
- package/static/dashboard/assets/{badge-DRNYZLcD.js → badge-D1jeec03.js} +1 -1
- package/static/dashboard/assets/{card-DktMrBl6.js → card-BVWe16yF.js} +1 -1
- package/static/dashboard/assets/{check-BeXhTRNQ.js → check-9egtmHPl.js} +1 -1
- package/static/dashboard/assets/{chevron-right-BoL12ADN.js → chevron-right-Bmstp0HK.js} +1 -1
- package/static/dashboard/assets/{copy-0Bxto2zb.js → copy-GnUBMqNX.js} +1 -1
- package/static/dashboard/assets/{dialog-CNPOwLFE.js → dialog-BGVcKKLs.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-QyfFmK0B.js → dropdown-menu-DwN7ik3X.js} +1 -1
- package/static/dashboard/assets/{image-off-1l9j0o-Y.js → image-off-BV5DPLn4.js} +1 -1
- package/static/dashboard/assets/{index-C9T0i6pH.js → index-DFxWyhmm.js} +3 -3
- package/static/dashboard/assets/{invite-B3ovcCvz.js → invite-D7bpUPrA.js} +1 -1
- package/static/dashboard/assets/{label-CgEiXFTT.js → label-CxnO6qKO.js} +1 -1
- package/static/dashboard/assets/{layout-grid-CFk40Q2_.js → layout-grid-xfets3-n.js} +1 -1
- package/static/dashboard/assets/me-C8ixZq4k.js +1 -0
- package/static/dashboard/assets/{parts-BGzYN_gW.js → parts-fnhfMAxC.js} +1 -1
- package/static/dashboard/assets/{plus-D5bA9-ud.js → plus-BxZTgJzO.js} +1 -1
- package/static/dashboard/assets/s._site-B5wWH_CZ.js +1 -0
- package/static/dashboard/assets/{s._site.comments-DPD4knbJ.js → s._site.comments-_0tYLKCp.js} +1 -1
- package/static/dashboard/assets/{s._site.reviewers-cXimPkop.js → s._site.reviewers-bbW3QZhQ.js} +1 -1
- package/static/dashboard/assets/{s._site.settings-S8ZkUOGQ.js → s._site.settings-oWHkv4r8.js} +1 -1
- package/static/dashboard/assets/{setup-ytPE-o-a.js → setup-CLmg80L_.js} +1 -1
- package/static/dashboard/assets/{sign-in-CApTsuZI.js → sign-in-C2kQL0Ys.js} +1 -1
- package/static/dashboard/assets/{sign-up-DV3c0gT-.js → sign-up-DhbXaP75.js} +1 -1
- package/static/dashboard/assets/{sites-DpoUZ8eC.js → sites-CD7tpHGZ.js} +1 -1
- package/static/dashboard/assets/studio-C8vSzSiD.js +1 -0
- package/static/dashboard/assets/{studio-Cd2-mZl3.js → studio-DWr-gNJq.js} +1 -1
- package/static/dashboard/assets/{studio.index-CdwWnkIX.js → studio.index-BANtPBsV.js} +1 -1
- package/static/dashboard/assets/{studio.integrations-Bwi2ns8H.js → studio.integrations-DA6TbGub.js} +1 -1
- package/static/dashboard/assets/{studio.members-DwvB-uiz.js → studio.members-CTj98khj.js} +1 -1
- package/static/dashboard/assets/{sun-DYPmuuya.js → sun-Dd-jHZ7E.js} +1 -1
- package/static/dashboard/assets/{switch-C4MjDp48.js → switch-MVges_VF.js} +1 -1
- package/static/dashboard/assets/{table-CoSJYMlW.js → table-DY_ZkUQS.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-CVMe8zQw.js → useAriaLabelledBy-D-E1Md1d.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-BNAoRl4M.js → useBaseQuery-CmgDPl0Z.js} +1 -1
- package/static/dashboard/assets/useQuery-DKkrpniW.js +1 -0
- package/static/dashboard/assets/useRender-P0lZXDvs.js +1 -0
- package/static/dashboard/assets/{useValueChanged-BzSqaaKy.js → useValueChanged-CFJAwkwT.js} +1 -1
- package/static/dashboard/assets/{users-CxehfZhl.js → users-DbYHCs3H.js} +1 -1
- package/static/dashboard/assets/{welcome-B0Xqk_GB.js → welcome-BRH6NIwS.js} +1 -1
- package/static/dashboard/assets/{widget-signin-BaYrguyh.js → widget-signin-DO_gjUUQ.js} +1 -1
- package/static/dashboard/assets/{you-CYkvyH8i.js → you-rr6TKyGj.js} +1 -1
- package/static/dashboard/assets/{zod-CYYNMx2f.js → zod-Di32GmP2.js} +1 -1
- package/static/dashboard/index.html +1 -1
- package/static/dashboard/assets/me-DnFJ72fX.js +0 -1
- package/static/dashboard/assets/s._site-BU8qgyq7.js +0 -1
- package/static/dashboard/assets/studio-CFiRRKhi.js +0 -1
- package/static/dashboard/assets/useQuery-D4G3Az8s.js +0 -1
- package/static/dashboard/assets/useRender-BIly5s7F.js +0 -1
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-DFxWyhmm.js";import{u as L,a as B}from"./zod-Di32GmP2.js";import{L as u,I as p}from"./label-CxnO6qKO.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 +1 @@
|
|
|
1
|
-
import{r as o,a5 as l,h as J,E as V,aY as W,a3 as A,e as M,d as v,k as X,aT as Q,i as Z,j as T,f as _}from"./index-
|
|
1
|
+
import{r as o,a5 as l,h as J,E as V,aY as W,a3 as A,e as M,d as v,k as X,aT as Q,i as Z,j as T,f as _}from"./index-DFxWyhmm.js";function ee(t){return t?.ownerDocument||document}const te={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ne={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},se={disabled:!1,...ne},ae={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},re={invalid:void 0,name:void 0,validityData:{state:te,errors:[],error:"",value:"",initialValue:null},setValidityData:l,disabled:void 0,setTouched:l,setDirty:l,setFilled:l,setFocused:l,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:se,registerFieldControl:l,validation:{getValidationProps:(t,e=V)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:l,getInputControl:()=>null,commit:async()=>{},change:l}},oe=o.createContext(re);function N(t=!0){const e=o.useContext(oe);if(e.setValidityData===l&&!t)throw new Error(J(28));return e}const ie=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function le(){return o.useContext(ie)}let S=0;function ue(t,e="mui"){const[n,s]=o.useState(t),u=t||n;return o.useEffect(()=>{n==null&&(S+=1,s(`${e}-${S}`))},[n,e]),u}const L=W.useId;function de(t,e){if(L!==void 0){const n=L();return t??(e?`${e}-${n}`:n)}return ue(t,e)}function ce(t){return de(t,"base-ui")}const fe=o.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:t=>t});function U(){return o.useContext(fe)}function ge(t={}){const{id:e,implicit:n=!1,controlRef:s}=t,{controlId:u,registerControlId:i}=U(),a=ce(e),r=n?u:void 0,c=A(()=>Symbol()),p=o.useRef(!1),b=o.useRef(e!=null),f=M(()=>{!p.current||i===l||(p.current=!1,i(c.current,void 0))});return v(()=>{if(i===l)return;let m;if(n){const I=s?.current;X(I)&&I.closest("label")!=null?m=e??null:m=r??a}else if(e!=null)b.current=!0,m=e;else if(b.current)m=a;else{f();return}if(m===void 0){f();return}p.current=!0,i(c.current,m)},[e,s,r,i,n,a,c,f]),o.useEffect(()=>f,[f]),u??a}function pe(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function he(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Q(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function me({controlled:t,default:e,name:n,state:s="value"}){const{current:u}=o.useRef(t!==void 0),[i,a]=o.useState(e),r=u?t:i,c=o.useCallback(p=>{u||a(p)},[]);return[r,c]}function be(t,e,n,s,u=!0,i){const{registerFieldControl:a}=N(),r=A(()=>Symbol());v(()=>{const c=r.current;if(!u){a(c,void 0);return}a(c,{controlRef:t,getValue:s,id:e,name:i,value:n})},[t,u,s,e,i,a,r,n]),v(()=>{const c=r.current;return()=>{a(c,void 0)}},[a,r])}const ve="none",we="trigger-press",ye="trigger-hover",Fe="trigger-focus",De="outside-press",Pe="item-press",Se="close-press",Le="focus-out",Ve="escape-key",Ae="list-navigation",Me="cancel-open",_e="sibling-open",Ne="disabled",Ue="imperative-action";function Ie(t,e,n,s){let u=!1,i=!1;const a=s??V;return{reason:t,event:e??new Event("base-ui"),cancel(){u=!0},allowPropagation(){i=!0},get isCanceled(){return u},get isPropagationAllowed(){return i},trigger:n,...a}}const Ee=o.forwardRef(function(e,n){const{render:s,className:u,id:i,name:a,value:r,disabled:c=!1,onValueChange:p,defaultValue:b,autoFocus:f=!1,style:m,...I}=e,{state:k,name:O,disabled:j,setTouched:w,setDirty:B,validityData:$,setFocused:E,setFilled:R,validationMode:Y,validation:g}=N(),{clearErrors:K}=le(),C=j||c,y=O??a,q={...k,disabled:C},{labelId:z}=U(),F=ge({id:i});v(()=>{const d=r!=null;g.inputRef.current?.value||d&&r!==""?R(!0):d&&r===""&&R(!1)},[g.inputRef,R,r]);const h=o.useRef(null);v(()=>{f&&h.current===pe(ee(h.current))&&E(!0)},[f,E]);const[G]=me({controlled:r,default:b,name:"FieldControl",state:"value"}),D=r!==void 0,P=D?G:void 0,H=M(()=>g.inputRef.current?.value);return be(g.inputRef,F,P,H,!C,a),Z("input",e,{ref:[n,h],state:q,props:[{id:F,disabled:C,name:y,ref:g.inputRef,"aria-labelledby":z,autoFocus:f,...D?{value:P}:{defaultValue:b},onChange(d){const x=d.currentTarget.value;p?.(x,Ie(ve,d.nativeEvent)),B(x!==($.initialValue??"")),R(x!==""),d.nativeEvent.defaultPrevented||(K(y),g.change(x))},onFocus(){E(!0)},onBlur(d){w(!0),E(!1),Y==="onBlur"&&g.commit(d.currentTarget.value)},onKeyDown(d){d.currentTarget.tagName==="INPUT"&&d.key==="Enter"&&(w(!0),g.commit(d.currentTarget.value))}},I,d=>g.getValidationProps(C,d)],stateAttributesMapping:ae})}),Re=o.forwardRef(function(e,n){return T.jsx(Ee,{ref:n,...e})});function ke({className:t,type:e,...n}){return T.jsx(Re,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none 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",t),...n})}function Oe({className:t,...e}){return T.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{ge as A,Se as B,ke as I,Oe as L,he as a,ye as b,Ie as c,Ne as d,le as e,ae as f,Te as g,N as h,Ue as i,U as j,me as k,be as l,pe as m,ve as n,ee as o,Fe as p,Ve as q,Ae as r,Le as s,we as t,ce as u,Pe as v,De as w,_e as x,de as y,Me as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u,d as s}from"./useBaseQuery-CmgDPl0Z.js";import{y as t}from"./index-DFxWyhmm.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 +1 @@
|
|
|
1
|
-
import{j as e,f as r}from"./index-
|
|
1
|
+
import{j as e,f as r}from"./index-DFxWyhmm.js";import{C as x}from"./card-BVWe16yF.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-DFxWyhmm.js";const n=()=>t.jsx(o,{});export{n as component};
|
package/static/dashboard/assets/{s._site.comments-DPD4knbJ.js → s._site.comments-_0tYLKCp.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Z,r as h,h as zs,a3 as Is,a4 as Es,d as Je,a5 as Ze,a6 as Ts,m as Ps,E as _s,i as ns,j as e,a7 as Bs,g as Fs,f as D,B as M,a8 as as,a9 as Ls,_ as Qe,aa as Os,Z as rs,A as Vs,ab as Xe,o as qs,ac as Us,ad as Ye,ae as Ks,af as Hs,ag as Ws,ah as Gs,ai as Js,aj as Zs,ak as Qs,al as Xs,am as Ys,an as et,ao as be,L as os,F as st,a0 as es,H as je,ap as tt,y as Se}from"./index-
|
|
1
|
+
import{c as Z,r as h,h as zs,a3 as Is,a4 as Es,d as Je,a5 as Ze,a6 as Ts,m as Ps,E as _s,i as ns,j as e,a7 as Bs,g as Fs,f as D,B as M,a8 as as,a9 as Ls,_ as Qe,aa as Os,Z as rs,A as Vs,ab as Xe,o as qs,ac as Us,ad as Ye,ae as Ks,af as Hs,ag as Ws,ah as Gs,ai as Js,aj as Zs,ak as Qs,al as Xs,am as Ys,an as et,ao as be,L as os,F as st,a0 as es,H as je,ap as tt,y as Se}from"./index-DFxWyhmm.js";import{u as ve}from"./useQuery-DKkrpniW.js";import{C as is}from"./check-9egtmHPl.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 De}from"./label-CxnO6qKO.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-BGVcKKLs.js";import{u as gt}from"./FieldItemContext-DwjMGEtR.js";import{u as bt}from"./useAriaLabelledBy-D-E1Md1d.js";import{u as jt}from"./useValueChanged-CFJAwkwT.js";import{D as se,i as te,j as ne,k as me,l as Re,m as G,n as xs,E as ts,o as Ue,p as de,S as vt}from"./dropdown-menu-DwN7ik3X.js";import{A as he,a as xe}from"./avatar-BTlpQ4so.js";import{C as ps}from"./ConfirmDialog-CJ4rxhiM.js";import{b as Ke,S as fs,E as Oe}from"./parts-fnhfMAxC.js";import{S as pe,i as yt,b as ze,c as $e,a as ye}from"./labels--UUyt9uB.js";import{C as kt}from"./copy-GnUBMqNX.js";import{I as Nt}from"./image-off-BV5DPLn4.js";import{C as wt}from"./chevron-right-Bmstp0HK.js";import{I as Ct}from"./InstallTag-Bv5eJ-pY.js";import{u as St}from"./me-C8ixZq4k.js";import{A as $t}from"./arrow-left-5yNow0eG.js";import"./useBaseQuery-CmgDPl0Z.js";import"./CompositeItem-9k6gamy_.js";import"./card-BVWe16yF.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/static/dashboard/assets/{s._site.reviewers-cXimPkop.js → s._site.reviewers-bbW3QZhQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aH as A,r as f,j as e,B as g,aI as S,f as I,aJ as E,y as k,X as F,F as H,H as y}from"./index-
|
|
1
|
+
import{aH as A,r as f,j as e,B as g,aI as S,f as I,aJ as E,y as k,X as F,F as H,H as y}from"./index-DFxWyhmm.js";import{u as C}from"./useQuery-DKkrpniW.js";import{u as L,a as P}from"./zod-Di32GmP2.js";import{C as R}from"./card-BVWe16yF.js";import{X as M,E as U,G as $,I as B,H as z,J,K}from"./dialog-BGVcKKLs.js";import{L as N,I as V}from"./label-CxnO6qKO.js";import{T as X,a as Y,b as D,c as p,d as q,e as j}from"./table-DY_ZkUQS.js";import{C as G}from"./ConfirmDialog-CJ4rxhiM.js";import{C as O}from"./CopyButton-DQaUk_fX.js";import{P as Q,E as W}from"./parts-fnhfMAxC.js";import{b as T}from"./labels--UUyt9uB.js";import{C as Z}from"./check-9egtmHPl.js";import{U as _}from"./users-DbYHCs3H.js";import{P as ee}from"./plus-BxZTgJzO.js";import"./useBaseQuery-CmgDPl0Z.js";import"./copy-GnUBMqNX.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(Q,{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(O,{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(X,{children:[e.jsx(Y,{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(q,{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(G,{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=H({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}=L({resolver:P(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(J,{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(V,{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(K,{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};
|
package/static/dashboard/assets/{s._site.settings-S8ZkUOGQ.js → s._site.settings-oWHkv4r8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,h as Me,a5 as de,a6 as Oe,d as ue,a4 as _e,E as me,i as he,j as e,a7 as Ye,e as Q,aF as ve,aL as Ue,f as pe,aM as Qe,aN as Je,B as V,y as Ae,aO as Xe,aP as Ze,o as et,aQ as tt}from"./index-C9T0i6pH.js";import{u as Fe}from"./useQuery-D4G3Az8s.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-CgEiXFTT.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-CNPOwLFE.js";import{b as yt,u as jt,C as Rt}from"./CompositeItem-DFk-PY9L.js";import{u as Ct}from"./useValueChanged-BzSqaaKy.js";import{u as It}from"./FieldItemContext-B1tO9RIm.js";import{u as wt}from"./useAriaLabelledBy-CVMe8zQw.js";import{C as He}from"./ConfirmDialog-COCFkJPd.js";import{C as kt}from"./CopyButton-BSZUdGOe.js";import{I as Nt}from"./InstallTag-C-bSYUSW.js";import{B as St}from"./badge-DRNYZLcD.js";import{a as ne,P as Et}from"./parts-BGzYN_gW.js";import{u as Be}from"./me-DnFJ72fX.js";import{S as Pe}from"./switch-C4MjDp48.js";import{S as Pt}from"./SaveState-9-TiAnKs.js";import{P as Dt}from"./plus-D5bA9-ud.js";import"./useBaseQuery-BNAoRl4M.js";import"./check-BeXhTRNQ.js";import"./copy-0Bxto2zb.js";import"./useRender-BIly5s7F.js";import"./card-DktMrBl6.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},ze="data-composite-item-active",Ge=l.createContext(void 0);function Tt(){return l.useContext(Ge)}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:z,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),G=z?.registerInput,W=l.useCallback(C=>G?.(C,{controlRef:F,value:void 0}),[G]),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,[ze]: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,z?C=>z.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 zt(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)}}),z=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(ze))??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||Gt(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,G=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==G||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:z,relayKeyboardEvent:$}}function Gt(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",...z}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=zt({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,z],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:z,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]),G=l.useRef(null),W=l.useRef(null);function X(u){let M;return y&&(typeof y=="function"?M=y(u):y.current=u),G.current=u,M}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const M=G.current,U=u.checked||M==null||M.disabled?X(u):void 0;return()=>{W.current===u&&(W.current=null),G.current===u?U?(U(),G.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={...z,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(Ge.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
|
+
import{r as l,h as Me,a5 as de,a6 as Oe,d as ue,a4 as _e,E as me,i as he,j as e,a7 as Ye,e as Q,aF as ve,aL as Ue,f as pe,aM as Qe,aN as Je,B as V,y as Ae,aO as Xe,aP as Ze,o as et,aQ as tt}from"./index-DFxWyhmm.js";import{u as Fe}from"./useQuery-DKkrpniW.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-CxnO6qKO.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-BGVcKKLs.js";import{b as yt,u as jt,C as Rt}from"./CompositeItem-9k6gamy_.js";import{u as Ct}from"./useValueChanged-CFJAwkwT.js";import{u as It}from"./FieldItemContext-DwjMGEtR.js";import{u as wt}from"./useAriaLabelledBy-D-E1Md1d.js";import{C as He}from"./ConfirmDialog-CJ4rxhiM.js";import{C as kt}from"./CopyButton-DQaUk_fX.js";import{I as Nt}from"./InstallTag-Bv5eJ-pY.js";import{B as St}from"./badge-D1jeec03.js";import{a as ne,P as Et}from"./parts-fnhfMAxC.js";import{u as Be}from"./me-C8ixZq4k.js";import{S as Pe}from"./switch-MVges_VF.js";import{S as Pt}from"./SaveState-BAmXwwnU.js";import{P as Dt}from"./plus-BxZTgJzO.js";import"./useBaseQuery-CmgDPl0Z.js";import"./check-9egtmHPl.js";import"./copy-GnUBMqNX.js";import"./useRender-P0lZXDvs.js";import"./card-BVWe16yF.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},ze="data-composite-item-active",Ge=l.createContext(void 0);function Tt(){return l.useContext(Ge)}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:z,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),G=z?.registerInput,W=l.useCallback(C=>G?.(C,{controlRef:F,value:void 0}),[G]),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,[ze]: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,z?C=>z.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 zt(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)}}),z=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(ze))??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||Gt(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,G=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==G||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:z,relayKeyboardEvent:$}}function Gt(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",...z}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=zt({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,z],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:z,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]),G=l.useRef(null),W=l.useRef(null);function X(u){let M;return y&&(typeof y=="function"?M=y(u):y.current=u),G.current=u,M}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const M=G.current,U=u.checked||M==null||M.disabled?X(u):void 0;return()=>{W.current===u&&(W.current=null),G.current===u?U?(U(),G.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={...z,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(Ge.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 +1 @@
|
|
|
1
|
-
import{I as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as b,B as y,F as S,H as r}from"./index-
|
|
1
|
+
import{I as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as b,B as y,F as S,H as r}from"./index-DFxWyhmm.js";import{u as v,a as A}from"./zod-Di32GmP2.js";import{L as i,I as o}from"./label-CxnO6qKO.js";const F=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(F)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as w,o as y,r as l,y as d,p as N,x as S,A as k,j as e,G as C,B as F,f as E,L,F as R,H as m}from"./index-
|
|
1
|
+
import{J as w,o as y,r as l,y as d,p as N,x as S,A as k,j as e,G as C,B as F,f as E,L,F as R,H as m}from"./index-DFxWyhmm.js";import{u as c}from"./useQuery-DKkrpniW.js";import{u as A,a as I}from"./zod-Di32GmP2.js";import{L as u,I as p}from"./label-CxnO6qKO.js";import{C as z}from"./chevron-right-Bmstp0HK.js";import"./useBaseQuery-CmgDPl0Z.js";const B=R({email:m().trim().min(1,"Your email"),password:m().min(1,"Your password")});function Q(){const{redirect:x}=w.useSearch(),r=y(),[a,o]=l.useState(""),[s,h]=l.useState(!1),{register:i,handleSubmit:f,formState:t}=A({resolver:I(B)});c({...d.claimed(),enabled:!0}).data===!1&&r({to:"/setup",replace:!0});const g=c(d.setupState()),j=f(async({email:b,password:v})=>{o("");try{await N.login(b,v),S("in"),r({to:x??"/sites",replace:!0})}catch(n){o(n instanceof k?n.message:"Could not reach the server.")}});return e.jsx(C,{children:e.jsxs("form",{onSubmit:j,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),a&&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:a}),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","aria-invalid":!!t.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"password",children:"Password"}),e.jsx(p,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!t.errors.password,...i("password")})]}),e.jsx(F,{type:"submit",size:"lg",loading:t.isSubmitting,children:t.isSubmitting?"Signing in…":"Sign in"}),e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>h(!s),children:[e.jsx(z,{className:E("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),g.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",e.jsx(L,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"There's no reset email — a fresh install has no mail set up, and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{Q as component};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-DFxWyhmm.js";import{u as b,a as S}from"./zod-Di32GmP2.js";import{L as o,I as i}from"./label-CxnO6qKO.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 +1 @@
|
|
|
1
|
-
import{W 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-
|
|
1
|
+
import{W 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-DFxWyhmm.js";import{u as k,a as _}from"./zod-Di32GmP2.js";import{C}from"./card-BVWe16yF.js";import{E,G as D,I as F,H as I,J as L,K as P}from"./dialog-BGVcKKLs.js";import{L as h,I as g}from"./label-CxnO6qKO.js";import{P as z,E as H}from"./parts-fnhfMAxC.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-C8ixZq4k.js";import{P as f}from"./plus-BxZTgJzO.js";import{L as q}from"./layout-grid-xfets3-n.js";import{I as B}from"./image-off-BV5DPLn4.js";import"./useBaseQuery-CmgDPl0Z.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-DFxWyhmm.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as o,y as s,Y as u,p as i,Z as y,X as c}from"./index-
|
|
1
|
+
import{t as o,y as s,Y as u,p as i,Z as y,X as c}from"./index-DFxWyhmm.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as B,r as h,Y as v,p as y,Z as b,X as C,j as e,B as g,y as S,A as K,S as _}from"./index-C9T0i6pH.js";import{u as w}from"./useQuery-D4G3Az8s.js";import{L as A,I as k}from"./label-CgEiXFTT.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-CNPOwLFE.js";import{C as G}from"./ConfirmDialog-COCFkJPd.js";import{a as D,P as O}from"./parts-BGzYN_gW.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-DnFJ72fX.js";import{S as q}from"./SaveState-9-TiAnKs.js";import{b as H}from"./studio-Cd2-mZl3.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-BNAoRl4M.js";import"./card-DktMrBl6.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(X,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Y,{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 X({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 Y({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
|
+
import{t as B,r as h,Y as v,p as y,Z as b,X as C,j as e,B as g,y as S,A as K,S as _}from"./index-DFxWyhmm.js";import{u as w}from"./useQuery-DKkrpniW.js";import{L as A,I as k}from"./label-CxnO6qKO.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-BGVcKKLs.js";import{C as G}from"./ConfirmDialog-CJ4rxhiM.js";import{a as D,P as O}from"./parts-fnhfMAxC.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-C8ixZq4k.js";import{S as q}from"./SaveState-BAmXwwnU.js";import{b as H}from"./studio-DWr-gNJq.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-CmgDPl0Z.js";import"./card-BVWe16yF.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(X,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(Y,{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 X({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 Y({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};
|