@dubusoft/toodo-linux-arm64 1.9.1-dev.114 → 1.9.2-dev.115
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/bin/toodo +0 -0
- package/bin/toodo-server +0 -0
- package/package.json +1 -1
- package/web/assets/{details-sheet-LzPkfw74.js → details-sheet-D3E2O1qq.js} +1 -1
- package/web/assets/{index-BDqYqqXj.js → index-c_O4h5hL.js} +3 -3
- package/web/assets/{offline-screen-D5mdj0f-.js → offline-screen-9vqiS81k.js} +1 -1
- package/web/assets/{review-DZLCbfhu.js → review-D7iL0hmH.js} +1 -1
- package/web/assets/{server-access-0dWieKNm.js → server-access-e0lSMQU4.js} +1 -1
- package/web/assets/{task-details-kwmOmiyK.js → task-details-DDqvGFLu.js} +1 -1
- package/web/assets/{task-graph-BWaTtdIR.js → task-graph-SuG12RSn.js} +1 -1
- package/web/index.html +2 -2
- package/web/sw.js +2 -2
- package/web/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,s as r}from"./dist-ZmB2kPfR.js";import{mn as i,pt as a,t as o}from"./queries-BX_TBXN8.js";import{d as s,f as c,h as l,m as u}from"./event-DMqRNLc_.js";import{bt as d}from"./index-
|
|
1
|
+
import{i as e,n as t,r as n,s as r}from"./dist-ZmB2kPfR.js";import{mn as i,pt as a,t as o}from"./queries-BX_TBXN8.js";import{d as s,f as c,h as l,m as u}from"./event-DMqRNLc_.js";import{bt as d}from"./index-c_O4h5hL.js";var f={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};f.node;var p=t(f),m=r(e(),1),h=n();function g({children:e}){let t=(0,m.useSyncExternalStore)(u,s),n=t===`unreachable`||t===`retrying`;return(0,h.jsxs)(h.Fragment,{children:[n&&(0,h.jsx)(_,{retrying:t===`retrying`}),e,n&&(0,h.jsx)(`div`,{"aria-hidden":!0,className:`h-40`})]})}function _({retrying:e}){let t=navigator.onLine?l():`This device is offline.`,n=i().getQueryState(o.tasks)?.dataUpdatedAt;return(0,h.jsxs)(`div`,{role:`alert`,className:`fixed inset-x-2 bottom-2 z-50 mx-auto flex max-w-xl flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-amber-500 bg-amber-100 p-3 text-sm text-amber-950 shadow-md dark:bg-amber-950 dark:text-amber-100`,children:[(0,h.jsx)(p,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`p`,{className:`font-medium`,children:`Can't reach the Toodo server`}),(0,h.jsxs)(`p`,{className:`text-xs`,children:[t,` `,n?(0,h.jsxs)(h.Fragment,{children:[`Read-only: the tasks shown were loaded `,(0,h.jsx)(d,{at:Math.floor(n/1e3)}),` and may be out of date.`]}):`What you see may be out of date.`,` `,`Changes are paused. Toodo reconnects on its own as soon as the server answers.`]})]}),(0,h.jsx)(a,{size:`sm`,variant:`outline`,disabled:e,onClick:c,children:e?`Trying...`:`Retry now`})]})}export{g as ConnectionGate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{$ as a,B as o,F as s,I as c,L as l,R as u,U as d,_ as f,ft as p,n as m,o as ee,pt as h}from"./queries-BX_TBXN8.js";import{A as g,Bt as te,C as ne,Ct as re,D as _,Dt as v,E as y,Et as b,It as x,K as ie,M as ae,N as oe,Nt as S,O as C,P as se,Pt as w,S as ce,St as T,T as E,V as D,Vt as le,Z as O,_ as ue,_t as k,b as A,bt as j,c as de,d as fe,f as M,g as N,h as P,j as F,k as pe,l as I,m as L,p as R,q as me,s as he,u as z,v as B,w as ge,x as V,xt as H,y as U,zt as W}from"./index-BDqYqqXj.js";import{t as G}from"./opener-DWhHPoCL.js";var K={name:`calendar-check`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]};K.node;var _e=t(K),q=r(e(),1),J=n(),ve={completed:x.success,opened_for_review:x.review,started:x.progress,worked_on:x.progress,planned:x.neutral},Y=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,S.neutral),ye=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function be(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function xe({disabled:e,children:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>e.key===`Escape`&&r(!1);return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,J.jsxs)(`div`,{ref:i,className:`relative`,children:[(0,J.jsxs)(h,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":n,disabled:e,onClick:()=>r(!n),children:[(0,J.jsx)(W,{}),(0,J.jsx)(`span`,{className:`max-md:sr-only`,children:`Export`})]}),n&&(0,J.jsx)(`div`,{role:`menu`,"aria-label":`Export review`,className:`absolute right-0 z-10 mt-1 flex w-48 flex-col rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:t(()=>r(!1))})]})}function X(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z({onSelect:e,children:t}){return(0,J.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:e,className:`rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted max-md:min-h-11`,children:t})}function Se(){let e=u(),t=d(),[n,r]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(null),l=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];async function f(e){c(null);try{await t.mutateAsync(e),r(!1)}catch(e){c(e instanceof Error?e.message:String(e))}}if(!e.data)return null;let{timeZone:p,configured:m}=e.data;return n?(0,J.jsxs)(`form`,{"aria-label":`Review time zone`,className:`flex flex-wrap items-center gap-2 print:hidden`,onSubmit:e=>{e.preventDefault(),f(a)},children:[(0,J.jsx)(`label`,{htmlFor:`review-time-zone`,className:`text-xs`,children:`Time zone for every device`}),(0,J.jsx)(`input`,{id:`review-time-zone`,list:`review-time-zones`,required:!0,className:i(O,`w-56`),value:a,onChange:e=>o(e.target.value)}),(0,J.jsx)(`datalist`,{id:`review-time-zones`,children:l.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsx)(h,{size:`sm`,type:`submit`,disabled:t.isPending,children:`Save`}),m!==null&&(0,J.jsx)(h,{size:`sm`,type:`button`,variant:`outline`,onClick:()=>void f(null),children:`Use the server's`}),(0,J.jsx)(h,{size:`sm`,type:`button`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),s&&(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-destructive`,children:s})]}):(0,J.jsxs)(`span`,{children:[`Days are in `,p,m===null&&` (the server's time zone)`,`.`,` `,(0,J.jsx)(`button`,{type:`button`,className:`text-primary underline underline-offset-2 hover:no-underline print:hidden`,onClick:()=>{o(m??p),r(!0)},children:`Change time zone`})]})}function Q({onShowTask:e}){let[t,n]=(0,q.useState)(()=>V(`week`,T(Date.now()/1e3))),[r,u]=(0,q.useState)(null),[d,v]=(0,q.useState)(U),[y,b]=(0,q.useState)(null),[x,oe]=(0,q.useState)(null),C=s(t.from,t.to),w=l(),E=c(x),k=o(),M=f(),N=x!==null,P=N?E:C,F=a(),I=ee(),L=N?E.data?.workspaces??[]:[...F.data??[],...I.data?.workspaces??[]],R=new Map(L.map(e=>[e.id,e.name])),z=N?E.data&&{period:{kind:E.data.summary.period,from:E.data.summary.from,to:E.data.summary.to},entries:E.data.entries,start:E.data.summary.start,end:E.data.summary.end,timeZone:E.data.summary.timeZone,now:E.data.summary.savedAt}:C.data&&{period:t,entries:C.data.entries,start:C.data.start,end:C.data.end,timeZone:C.data.timeZone,now:Date.now()/1e3},B=z?.period??t,H=z&&fe(z.entries,d),W=pe(z?.entries??[]);d.label!==null&&!W.includes(d.label)&&W.push(d.label);let G=[d.workspaceId===null?`across all workspaces`:`in ${R.get(d.workspaceId)??`workspace ${d.workspaceId}`}`,d.label!==null&&`labelled ${d.label}`].filter(Boolean).join(`, `),K=ne[B.kind];function Q(e){u(null),n(e)}function $(e){u(null),b(null),oe(e)}async function Oe(){try{let e=await k.mutateAsync({period:t.kind,from:t.from,to:t.kind===`custom`?t.to:null,workspaceId:d.workspaceId,label:d.label,title:null});u(`Saved "${e.title}" with ${X(e.entryCount,`task`)}; reopen it from Saved reviews.`)}catch(e){u(`Could not save the review: ${e instanceof Error?e.message:String(e)}`)}}async function ke(e){try{await M.mutateAsync(e),$(null),u(`Deleted the saved review.`)}catch(e){u(`Could not delete the saved review: ${e instanceof Error?e.message:String(e)}`)}}function Ae(e){e!==t.kind&&Q(e===`custom`?{...t,kind:e}:V(e,t.from))}function je(e){return N?E.data?Promise.resolve(e===`csv`?E.data.csv:E.data.markdown):Promise.reject(Error(`the saved review is still loading`)):m(p.reviewReport({period:t.kind,date:null,from:t.from,to:t.kind===`custom`?t.to:null,format:e,timeZone:null,workspaceId:d.workspaceId,label:d.label}))}async function Me(){try{let e=je(`markdown`);if(typeof ClipboardItem>`u`)await navigator.clipboard.writeText((await e).contents);else{let t=e.then(({contents:e})=>new Blob([e],{type:`text/plain`}));await navigator.clipboard.write([new ClipboardItem({"text/plain":t})])}u(`Copied as Markdown.`)}catch(e){u(`Could not copy: ${String(e)}`)}}async function Ne(e){try{let t=await je(e);be(t.fileName,t.contents,t.mediaType),u(`Downloaded ${t.fileName}`)}catch(e){u(`Could not export: ${String(e)}`)}}return(0,J.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:N&&E.data?E.data.summary.title:ge[B.kind]}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,B.from,` to `,B.to,` `,G,`.`,` `,N?E.data&&(0,J.jsxs)(`span`,{children:[`Saved `,re(E.data.summary.savedAt),`, with days in `,E.data.summary.timeZone,`; it stays as it was when saved.`]}):(0,J.jsx)(Se,{})]})]}),(N||(w.data?.length??0)>0)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,J.jsxs)(`select`,{"aria-label":`Saved reviews`,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-auto max-md:min-w-0 max-md:flex-1`),value:x??``,onChange:e=>$(e.target.value===``?null:Number(e.target.value)),children:[(0,J.jsx)(`option`,{value:``,children:`Live review`}),w.data?.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.title,` (saved `,T(e.savedAt),`)`]},e.id))]}),x!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>$(null),children:`Back to the live review`}),(0,J.jsx)(h,{size:`sm`,variant:`ghost`,disabled:M.isPending,onClick:()=>void ke(x),children:`Delete saved review`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[!N&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{role:`group`,"aria-label":`Review period`,className:`flex rounded-md border p-0.5 max-md:w-full`,children:ye.map(({kind:e,label:n})=>(0,J.jsx)(h,{size:`sm`,variant:t.kind===e?`default`:`ghost`,"aria-pressed":t.kind===e,onClick:()=>Ae(e),children:n},e))}),t.kind===`week`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`label`,{htmlFor:`week-start`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`Week starting`}),(0,J.jsx)(`input`,{id:`week-start`,type:`date`,required:!0,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40 max-md:w-0 max-md:min-w-0 max-md:flex-1`),value:t.from,onChange:e=>e.target.value&&Q(ae(e.target.value))})]}),t.kind===`custom`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`label`,{htmlFor:`review-from`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`From`}),(0,J.jsx)(`input`,{id:`review-from`,type:`date`,required:!0,max:t.to,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40`),value:t.from,onChange:e=>e.target.value&&e.target.value<=t.to&&Q({...t,from:e.target.value})}),(0,J.jsx)(`label`,{htmlFor:`review-to`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`To`}),(0,J.jsx)(`input`,{id:`review-to`,type:`date`,required:!0,min:t.from,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40`),value:t.to,onChange:e=>e.target.value&&e.target.value>=t.from&&Q({...t,to:e.target.value})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,J.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:ce(t)}),(0,J.jsx)(h,{size:`icon-sm`,variant:`outline`,"aria-label":`Previous ${K}`,title:`Previous ${K}`,onClick:()=>Q(g(t,-1)),children:(0,J.jsx)(te,{})}),(0,J.jsx)(h,{size:`icon-sm`,variant:`outline`,"aria-label":`Next ${K}`,title:`Next ${K}`,onClick:()=>Q(g(t,1)),children:(0,J.jsx)(le,{})}),t.kind!==`custom`&&(0,J.jsxs)(h,{size:`sm`,variant:`ghost`,onClick:()=>Q(V(t.kind,T(Date.now()/1e3))),children:[(0,J.jsx)(_e,{className:`md:hidden`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`max-md:sr-only`,children:[`This `,K]})]})]}),(0,J.jsx)(`div`,{className:`ml-auto`,children:(0,J.jsx)(xe,{disabled:!H,children:e=>(0,J.jsxs)(J.Fragment,{children:[!N&&(0,J.jsx)(Z,{onSelect:()=>{e(),Oe()},children:`Save as snapshot`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Me()},children:`Copy as Markdown`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Ne(`markdown`)},children:`Save as Markdown`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Ne(`csv`)},children:`Save as CSV`}),(0,J.jsx)(Z,{onSelect:()=>{e(),window.print()},children:`Print or save as PDF`})]})})})]}),(0,J.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,J.jsxs)(`select`,{"aria-label":`Workspace`,className:i(O,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.workspaceId??``,onChange:e=>v({...d,workspaceId:e.target.value===``?null:Number(e.target.value)}),children:[(0,J.jsx)(`option`,{value:``,children:`All workspaces`}),L.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,J.jsxs)(`select`,{"aria-label":`Label`,className:i(O,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.label??``,onChange:e=>v({...d,label:e.target.value===``?null:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:W.length===0?`No labels in this period`:`Any label`}),W.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}),(d.workspaceId!==null||d.label!==null)&&(0,J.jsx)(h,{size:`sm`,variant:`ghost`,onClick:()=>v(U),children:`Clear filters`})]}),r&&(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:r}),(0,J.jsx)(`p`,{role:`status`,className:i(`text-sm text-muted-foreground`,!P.isPending&&`sr-only`),children:P.isPending?`Loading the review...`:H?`Showing ${H.length} ${H.length===1?`task`:`tasks`} with activity in this ${K}.`:``}),P.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,P.error.message]}),H?.length===0&&(0,J.jsx)(he,{title:z?.entries.length===0?`No recorded activity in this ${K}.`:`No recorded activity in this ${K} matches the filters.`,hint:N?`This saved review keeps the tasks it had when it was saved.`:z?.entries.length===0?`Toodo records each task as it is planned, started, moved to review, and completed, so reviews fill up as you work.`:`Pick another period or change the filters to look at other work.`,action:N?void 0:(0,J.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:(0,J.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>Q(g(t,-1)),children:[`Show the `,K,` before`]})})}),z&&H&&H.length>0&&(0,J.jsx)(De,{shown:z,entries:H,workspaces:L}),z&&H&&(0,J.jsx)(Ee,{shown:z,entries:H,editable:!N}),B.kind===`year`&&H&&(0,J.jsx)(Te,{entries:H}),H&&ue(H).map(t=>(0,J.jsxs)(`section`,{"aria-label":A[t.outcome],className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`h3`,{className:i(`text-sm font-semibold`,ve[t.outcome]),children:[A[t.outcome],` `,(0,J.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,J.jsx)(`ul`,{className:`flex flex-col divide-y rounded-lg border`,children:t.entries.map(({task:t,at:n,commits:r,archived:a,pullRequest:o})=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(D,{type:t.taskType}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open #${t.id} ${t.title}`,title:t.title,onClick:()=>e?.(t.id),className:`min-w-0 flex-1 truncate text-left text-sm font-medium hover:underline max-md:min-h-11`,children:t.title}),t.resolution===`not_adopted`&&(0,J.jsx)(`span`,{className:Y,children:`Not adopted`}),a&&(0,J.jsx)(`span`,{className:Y,children:`Archived`}),t.resolution===`completed`&&(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,S.success),children:`Completed`}),_(t)&&(0,J.jsx)(we,{url:_(t),stats:o}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[R.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,J.jsx)(j,{at:n})]})]}),(0,J.jsx)(me,{task:t}),a||N?null:y?.id===t.id?(0,J.jsx)(se,{task:t,focusPlan:y.field,onDone:()=>b(null)}):(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground empty:hidden print:hidden`,children:(0,J.jsx)(ie,{task:t,onEdit:e=>b({id:t.id,field:e})})}),t.completionNote&&(0,J.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),z&&(0,J.jsx)(Ce,{task:t,shown:z}),r.length>0&&(0,J.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${K}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,J.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,J.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,J.jsx)(`span`,{className:`truncate`,children:de(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function $(e){return e===0?`0h`:L(e)}function Ce({task:e,shown:t}){let{start:n,end:r,now:i}=t,a=H(e.timeline,i),o=b(e.timeline,i);if(a===null||o===null)return null;let s=v(e.timeline).filter(e=>e.state===`paused`&&e.start<r&&(e.end??i)>n);return(0,J.jsxs)(`div`,{"aria-label":`Time of #${e.id}`,className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:[(0,J.jsxs)(`p`,{children:[$(a),` active, `,$(o),` waiting`]}),s.length>0&&(0,J.jsx)(`ul`,{"aria-label":`Waits of #${e.id}`,className:`flex flex-col gap-0.5`,children:s.map(e=>(0,J.jsxs)(`li`,{className:`break-words-keep`,children:[`Waiting `,$(Math.max((e.end??i)-e.start,0)),` from `,T(e.start),e.end===null&&`, still waiting`,`: `,e.reason??`no reason recorded`]},e.start))})]})}function we({url:e,stats:t}){let n=y(e),r=t=>{t.preventDefault(),G(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,J.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${C(t)}`:e,"aria-label":n?`Pull request #${n}`:`Pull request`,onClick:r,onAuxClick:r,className:`shrink-0 text-xs text-primary underline underline-offset-2 hover:no-underline max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:n?`#${n}`:`PR`})}function Te({entries:e}){let t=oe(e);return t===null?null:(0,J.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,J.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,J.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,J.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,J.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,J.jsxs)(`dd`,{className:`text-lg font-semibold`,title:N(t.pullRequests),children:[t.pullRequests.reviews,(0,J.jsxs)(`span`,{className:`ml-1 text-xs font-normal text-muted-foreground`,children:[`on `,t.pullRequests.reviewed,` of `,t.pullRequests.pullRequests]})]})]})]}),t.largest.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,J.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(D,{type:e.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:C(t)})]},e.id))})]}),t.research.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,J.jsx)(`ul`,{"aria-label":`Research conclusions`,className:`flex flex-col divide-y rounded-md border`,children:t.research.map(({task:e,at:t,adopted:n})=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,n?S.success:S.neutral),children:n?`Adopted`:`Not adopted`}),(0,J.jsx)(j,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,J.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,J.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(D,{type:e.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,L(t),`, `,L(n),` active`]})]},e.id))})]})]})}function Ee({shown:e,entries:t,editable:n}){let r=E(e.end,t,e.now),a=n?t.filter(({archived:e})=>!e).map(({task:e})=>k(e)):[],o=a.filter(e=>e.includes(`estimate`)).length,s=a.filter(e=>e.includes(`dueDate`)).length;if(r===null&&o+s===0)return null;let c=(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Missing plan`}),(0,J.jsxs)(`dd`,{children:[[o>0&&`${X(o,`task`)} without an estimate`,s>0&&`${X(s,`task`)} without a due date`].filter(Boolean).join(`, `),`; add them from the marks on the tasks below`]})]});return(0,J.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),r===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-sm`,children:`No reviewed task has an estimate or a due date, so there is nothing to compare yet.`}),(0,J.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:c})]}):(0,J.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,J.jsx)(`dd`,{children:r.time?P(r.time):`No completed task had an estimate`})]}),(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,J.jsx)(`dd`,{children:r.dueDates?R(r.dueDates):`No completed task had a due date`})]}),o+s>0&&c]}),r!==null&&r.late.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,J.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:r.late.map(e=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,J.jsx)(D,{type:e.task.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,J.jsx)(`span`,{className:i(`ml-auto shrink-0 text-xs`,x.danger),children:B(e)})]},e.task.id))})]})]})}function De({shown:e,entries:t,workspaces:n}){let r=F(e.period,t,n,e.timeZone),a=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,J.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:A[e]}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,J.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[I.map(e=>{let t=r[e];return(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:z[e]}),(0,J.jsx)(`dd`,{children:t===null?`No data`:`${L(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,J.jsx)(`dd`,{children:M(r.changes)})]}),r.completedByType.length>0&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,J.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,J.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,J.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:i(`h-2 rounded-sm`,w.success),style:{width:`${t/a*60}%`,minWidth:t>0?4:0}}),(0,J.jsx)(`span`,{children:t})]},e))})]})]})}export{Q as Review};
|
|
1
|
+
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{$ as a,B as o,F as s,I as c,L as l,R as u,U as d,_ as f,ft as p,n as m,o as ee,pt as h}from"./queries-BX_TBXN8.js";import{A as g,Bt as te,C as ne,Ct as re,D as _,Dt as v,E as y,Et as b,It as x,K as ie,M as ae,N as oe,Nt as S,O as C,P as se,Pt as w,S as ce,St as T,T as E,V as D,Vt as le,Z as O,_ as ue,_t as k,b as A,bt as j,c as de,d as fe,f as M,g as N,h as P,j as F,k as pe,l as I,m as L,p as R,q as me,s as he,u as z,v as B,w as ge,x as V,xt as H,y as U,zt as W}from"./index-c_O4h5hL.js";import{t as G}from"./opener-DWhHPoCL.js";var K={name:`calendar-check`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]};K.node;var _e=t(K),q=r(e(),1),J=n(),ve={completed:x.success,opened_for_review:x.review,started:x.progress,worked_on:x.progress,planned:x.neutral},Y=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,S.neutral),ye=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function be(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function xe({disabled:e,children:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>e.key===`Escape`&&r(!1);return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,J.jsxs)(`div`,{ref:i,className:`relative`,children:[(0,J.jsxs)(h,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":n,disabled:e,onClick:()=>r(!n),children:[(0,J.jsx)(W,{}),(0,J.jsx)(`span`,{className:`max-md:sr-only`,children:`Export`})]}),n&&(0,J.jsx)(`div`,{role:`menu`,"aria-label":`Export review`,className:`absolute right-0 z-10 mt-1 flex w-48 flex-col rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:t(()=>r(!1))})]})}function X(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z({onSelect:e,children:t}){return(0,J.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:e,className:`rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted max-md:min-h-11`,children:t})}function Se(){let e=u(),t=d(),[n,r]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(null),l=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];async function f(e){c(null);try{await t.mutateAsync(e),r(!1)}catch(e){c(e instanceof Error?e.message:String(e))}}if(!e.data)return null;let{timeZone:p,configured:m}=e.data;return n?(0,J.jsxs)(`form`,{"aria-label":`Review time zone`,className:`flex flex-wrap items-center gap-2 print:hidden`,onSubmit:e=>{e.preventDefault(),f(a)},children:[(0,J.jsx)(`label`,{htmlFor:`review-time-zone`,className:`text-xs`,children:`Time zone for every device`}),(0,J.jsx)(`input`,{id:`review-time-zone`,list:`review-time-zones`,required:!0,className:i(O,`w-56`),value:a,onChange:e=>o(e.target.value)}),(0,J.jsx)(`datalist`,{id:`review-time-zones`,children:l.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsx)(h,{size:`sm`,type:`submit`,disabled:t.isPending,children:`Save`}),m!==null&&(0,J.jsx)(h,{size:`sm`,type:`button`,variant:`outline`,onClick:()=>void f(null),children:`Use the server's`}),(0,J.jsx)(h,{size:`sm`,type:`button`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),s&&(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-destructive`,children:s})]}):(0,J.jsxs)(`span`,{children:[`Days are in `,p,m===null&&` (the server's time zone)`,`.`,` `,(0,J.jsx)(`button`,{type:`button`,className:`text-primary underline underline-offset-2 hover:no-underline print:hidden`,onClick:()=>{o(m??p),r(!0)},children:`Change time zone`})]})}function Q({onShowTask:e}){let[t,n]=(0,q.useState)(()=>V(`week`,T(Date.now()/1e3))),[r,u]=(0,q.useState)(null),[d,v]=(0,q.useState)(U),[y,b]=(0,q.useState)(null),[x,oe]=(0,q.useState)(null),C=s(t.from,t.to),w=l(),E=c(x),k=o(),M=f(),N=x!==null,P=N?E:C,F=a(),I=ee(),L=N?E.data?.workspaces??[]:[...F.data??[],...I.data?.workspaces??[]],R=new Map(L.map(e=>[e.id,e.name])),z=N?E.data&&{period:{kind:E.data.summary.period,from:E.data.summary.from,to:E.data.summary.to},entries:E.data.entries,start:E.data.summary.start,end:E.data.summary.end,timeZone:E.data.summary.timeZone,now:E.data.summary.savedAt}:C.data&&{period:t,entries:C.data.entries,start:C.data.start,end:C.data.end,timeZone:C.data.timeZone,now:Date.now()/1e3},B=z?.period??t,H=z&&fe(z.entries,d),W=pe(z?.entries??[]);d.label!==null&&!W.includes(d.label)&&W.push(d.label);let G=[d.workspaceId===null?`across all workspaces`:`in ${R.get(d.workspaceId)??`workspace ${d.workspaceId}`}`,d.label!==null&&`labelled ${d.label}`].filter(Boolean).join(`, `),K=ne[B.kind];function Q(e){u(null),n(e)}function $(e){u(null),b(null),oe(e)}async function Oe(){try{let e=await k.mutateAsync({period:t.kind,from:t.from,to:t.kind===`custom`?t.to:null,workspaceId:d.workspaceId,label:d.label,title:null});u(`Saved "${e.title}" with ${X(e.entryCount,`task`)}; reopen it from Saved reviews.`)}catch(e){u(`Could not save the review: ${e instanceof Error?e.message:String(e)}`)}}async function ke(e){try{await M.mutateAsync(e),$(null),u(`Deleted the saved review.`)}catch(e){u(`Could not delete the saved review: ${e instanceof Error?e.message:String(e)}`)}}function Ae(e){e!==t.kind&&Q(e===`custom`?{...t,kind:e}:V(e,t.from))}function je(e){return N?E.data?Promise.resolve(e===`csv`?E.data.csv:E.data.markdown):Promise.reject(Error(`the saved review is still loading`)):m(p.reviewReport({period:t.kind,date:null,from:t.from,to:t.kind===`custom`?t.to:null,format:e,timeZone:null,workspaceId:d.workspaceId,label:d.label}))}async function Me(){try{let e=je(`markdown`);if(typeof ClipboardItem>`u`)await navigator.clipboard.writeText((await e).contents);else{let t=e.then(({contents:e})=>new Blob([e],{type:`text/plain`}));await navigator.clipboard.write([new ClipboardItem({"text/plain":t})])}u(`Copied as Markdown.`)}catch(e){u(`Could not copy: ${String(e)}`)}}async function Ne(e){try{let t=await je(e);be(t.fileName,t.contents,t.mediaType),u(`Downloaded ${t.fileName}`)}catch(e){u(`Could not export: ${String(e)}`)}}return(0,J.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:N&&E.data?E.data.summary.title:ge[B.kind]}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,B.from,` to `,B.to,` `,G,`.`,` `,N?E.data&&(0,J.jsxs)(`span`,{children:[`Saved `,re(E.data.summary.savedAt),`, with days in `,E.data.summary.timeZone,`; it stays as it was when saved.`]}):(0,J.jsx)(Se,{})]})]}),(N||(w.data?.length??0)>0)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,J.jsxs)(`select`,{"aria-label":`Saved reviews`,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-auto max-md:min-w-0 max-md:flex-1`),value:x??``,onChange:e=>$(e.target.value===``?null:Number(e.target.value)),children:[(0,J.jsx)(`option`,{value:``,children:`Live review`}),w.data?.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.title,` (saved `,T(e.savedAt),`)`]},e.id))]}),x!==null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>$(null),children:`Back to the live review`}),(0,J.jsx)(h,{size:`sm`,variant:`ghost`,disabled:M.isPending,onClick:()=>void ke(x),children:`Delete saved review`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[!N&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{role:`group`,"aria-label":`Review period`,className:`flex rounded-md border p-0.5 max-md:w-full`,children:ye.map(({kind:e,label:n})=>(0,J.jsx)(h,{size:`sm`,variant:t.kind===e?`default`:`ghost`,"aria-pressed":t.kind===e,onClick:()=>Ae(e),children:n},e))}),t.kind===`week`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`label`,{htmlFor:`week-start`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`Week starting`}),(0,J.jsx)(`input`,{id:`week-start`,type:`date`,required:!0,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40 max-md:w-0 max-md:min-w-0 max-md:flex-1`),value:t.from,onChange:e=>e.target.value&&Q(ae(e.target.value))})]}),t.kind===`custom`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`label`,{htmlFor:`review-from`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`From`}),(0,J.jsx)(`input`,{id:`review-from`,type:`date`,required:!0,max:t.to,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40`),value:t.from,onChange:e=>e.target.value&&e.target.value<=t.to&&Q({...t,from:e.target.value})}),(0,J.jsx)(`label`,{htmlFor:`review-to`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`To`}),(0,J.jsx)(`input`,{id:`review-to`,type:`date`,required:!0,min:t.from,className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`w-40`),value:t.to,onChange:e=>e.target.value&&e.target.value>=t.from&&Q({...t,to:e.target.value})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,J.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:ce(t)}),(0,J.jsx)(h,{size:`icon-sm`,variant:`outline`,"aria-label":`Previous ${K}`,title:`Previous ${K}`,onClick:()=>Q(g(t,-1)),children:(0,J.jsx)(te,{})}),(0,J.jsx)(h,{size:`icon-sm`,variant:`outline`,"aria-label":`Next ${K}`,title:`Next ${K}`,onClick:()=>Q(g(t,1)),children:(0,J.jsx)(le,{})}),t.kind!==`custom`&&(0,J.jsxs)(h,{size:`sm`,variant:`ghost`,onClick:()=>Q(V(t.kind,T(Date.now()/1e3))),children:[(0,J.jsx)(_e,{className:`md:hidden`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`max-md:sr-only`,children:[`This `,K]})]})]}),(0,J.jsx)(`div`,{className:`ml-auto`,children:(0,J.jsx)(xe,{disabled:!H,children:e=>(0,J.jsxs)(J.Fragment,{children:[!N&&(0,J.jsx)(Z,{onSelect:()=>{e(),Oe()},children:`Save as snapshot`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Me()},children:`Copy as Markdown`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Ne(`markdown`)},children:`Save as Markdown`}),(0,J.jsx)(Z,{onSelect:()=>{e(),Ne(`csv`)},children:`Save as CSV`}),(0,J.jsx)(Z,{onSelect:()=>{e(),window.print()},children:`Print or save as PDF`})]})})})]}),(0,J.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,J.jsxs)(`select`,{"aria-label":`Workspace`,className:i(O,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.workspaceId??``,onChange:e=>v({...d,workspaceId:e.target.value===``?null:Number(e.target.value)}),children:[(0,J.jsx)(`option`,{value:``,children:`All workspaces`}),L.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,J.jsxs)(`select`,{"aria-label":`Label`,className:i(O,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.label??``,onChange:e=>v({...d,label:e.target.value===``?null:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:W.length===0?`No labels in this period`:`Any label`}),W.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}),(d.workspaceId!==null||d.label!==null)&&(0,J.jsx)(h,{size:`sm`,variant:`ghost`,onClick:()=>v(U),children:`Clear filters`})]}),r&&(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:r}),(0,J.jsx)(`p`,{role:`status`,className:i(`text-sm text-muted-foreground`,!P.isPending&&`sr-only`),children:P.isPending?`Loading the review...`:H?`Showing ${H.length} ${H.length===1?`task`:`tasks`} with activity in this ${K}.`:``}),P.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,P.error.message]}),H?.length===0&&(0,J.jsx)(he,{title:z?.entries.length===0?`No recorded activity in this ${K}.`:`No recorded activity in this ${K} matches the filters.`,hint:N?`This saved review keeps the tasks it had when it was saved.`:z?.entries.length===0?`Toodo records each task as it is planned, started, moved to review, and completed, so reviews fill up as you work.`:`Pick another period or change the filters to look at other work.`,action:N?void 0:(0,J.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:(0,J.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>Q(g(t,-1)),children:[`Show the `,K,` before`]})})}),z&&H&&H.length>0&&(0,J.jsx)(De,{shown:z,entries:H,workspaces:L}),z&&H&&(0,J.jsx)(Ee,{shown:z,entries:H,editable:!N}),B.kind===`year`&&H&&(0,J.jsx)(Te,{entries:H}),H&&ue(H).map(t=>(0,J.jsxs)(`section`,{"aria-label":A[t.outcome],className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`h3`,{className:i(`text-sm font-semibold`,ve[t.outcome]),children:[A[t.outcome],` `,(0,J.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,J.jsx)(`ul`,{className:`flex flex-col divide-y rounded-lg border`,children:t.entries.map(({task:t,at:n,commits:r,archived:a,pullRequest:o})=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(D,{type:t.taskType}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open #${t.id} ${t.title}`,title:t.title,onClick:()=>e?.(t.id),className:`min-w-0 flex-1 truncate text-left text-sm font-medium hover:underline max-md:min-h-11`,children:t.title}),t.resolution===`not_adopted`&&(0,J.jsx)(`span`,{className:Y,children:`Not adopted`}),a&&(0,J.jsx)(`span`,{className:Y,children:`Archived`}),t.resolution===`completed`&&(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,S.success),children:`Completed`}),_(t)&&(0,J.jsx)(we,{url:_(t),stats:o}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[R.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,J.jsx)(j,{at:n})]})]}),(0,J.jsx)(me,{task:t}),a||N?null:y?.id===t.id?(0,J.jsx)(se,{task:t,focusPlan:y.field,onDone:()=>b(null)}):(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground empty:hidden print:hidden`,children:(0,J.jsx)(ie,{task:t,onEdit:e=>b({id:t.id,field:e})})}),t.completionNote&&(0,J.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),z&&(0,J.jsx)(Ce,{task:t,shown:z}),r.length>0&&(0,J.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${K}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,J.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,J.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,J.jsx)(`span`,{className:`truncate`,children:de(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function $(e){return e===0?`0h`:L(e)}function Ce({task:e,shown:t}){let{start:n,end:r,now:i}=t,a=H(e.timeline,i),o=b(e.timeline,i);if(a===null||o===null)return null;let s=v(e.timeline).filter(e=>e.state===`paused`&&e.start<r&&(e.end??i)>n);return(0,J.jsxs)(`div`,{"aria-label":`Time of #${e.id}`,className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:[(0,J.jsxs)(`p`,{children:[$(a),` active, `,$(o),` waiting`]}),s.length>0&&(0,J.jsx)(`ul`,{"aria-label":`Waits of #${e.id}`,className:`flex flex-col gap-0.5`,children:s.map(e=>(0,J.jsxs)(`li`,{className:`break-words-keep`,children:[`Waiting `,$(Math.max((e.end??i)-e.start,0)),` from `,T(e.start),e.end===null&&`, still waiting`,`: `,e.reason??`no reason recorded`]},e.start))})]})}function we({url:e,stats:t}){let n=y(e),r=t=>{t.preventDefault(),G(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,J.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${C(t)}`:e,"aria-label":n?`Pull request #${n}`:`Pull request`,onClick:r,onAuxClick:r,className:`shrink-0 text-xs text-primary underline underline-offset-2 hover:no-underline max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:n?`#${n}`:`PR`})}function Te({entries:e}){let t=oe(e);return t===null?null:(0,J.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,J.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,J.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,J.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,J.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,J.jsxs)(`dd`,{className:`text-lg font-semibold`,title:N(t.pullRequests),children:[t.pullRequests.reviews,(0,J.jsxs)(`span`,{className:`ml-1 text-xs font-normal text-muted-foreground`,children:[`on `,t.pullRequests.reviewed,` of `,t.pullRequests.pullRequests]})]})]})]}),t.largest.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,J.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(D,{type:e.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:C(t)})]},e.id))})]}),t.research.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,J.jsx)(`ul`,{"aria-label":`Research conclusions`,className:`flex flex-col divide-y rounded-md border`,children:t.research.map(({task:e,at:t,adopted:n})=>(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,n?S.success:S.neutral),children:n?`Adopted`:`Not adopted`}),(0,J.jsx)(j,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,J.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,J.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsx)(D,{type:e.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,L(t),`, `,L(n),` active`]})]},e.id))})]})]})}function Ee({shown:e,entries:t,editable:n}){let r=E(e.end,t,e.now),a=n?t.filter(({archived:e})=>!e).map(({task:e})=>k(e)):[],o=a.filter(e=>e.includes(`estimate`)).length,s=a.filter(e=>e.includes(`dueDate`)).length;if(r===null&&o+s===0)return null;let c=(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Missing plan`}),(0,J.jsxs)(`dd`,{children:[[o>0&&`${X(o,`task`)} without an estimate`,s>0&&`${X(s,`task`)} without a due date`].filter(Boolean).join(`, `),`; add them from the marks on the tasks below`]})]});return(0,J.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),r===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-sm`,children:`No reviewed task has an estimate or a due date, so there is nothing to compare yet.`}),(0,J.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:c})]}):(0,J.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,J.jsx)(`dd`,{children:r.time?P(r.time):`No completed task had an estimate`})]}),(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,J.jsx)(`dd`,{children:r.dueDates?R(r.dueDates):`No completed task had a due date`})]}),o+s>0&&c]}),r!==null&&r.late.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,J.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:r.late.map(e=>(0,J.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,J.jsx)(D,{type:e.task.taskType}),(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,J.jsx)(`span`,{className:i(`ml-auto shrink-0 text-xs`,x.danger),children:B(e)})]},e.task.id))})]})]})}function De({shown:e,entries:t,workspaces:n}){let r=F(e.period,t,n,e.timeZone),a=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,J.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,J.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:A[e]}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,J.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,J.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[I.map(e=>{let t=r[e];return(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:z[e]}),(0,J.jsx)(`dd`,{children:t===null?`No data`:`${L(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,J.jsx)(`dd`,{children:M(r.changes)})]}),r.completedByType.length>0&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,J.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,J.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,J.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:i(`h-2 rounded-sm`,w.success),style:{width:`${t/a*60}%`,minWidth:t>0?4:0}}),(0,J.jsx)(`span`,{children:t})]},e))})]})]})}export{Q as Review};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,r as t,s as n}from"./dist-ZmB2kPfR.js";import{pt as r}from"./queries-BX_TBXN8.js";import{c as i,l as a,s as o}from"./event-DMqRNLc_.js";import{Z as s,a as c,i as l,n as u,o as d,r as f}from"./index-
|
|
1
|
+
import{i as e,r as t,s as n}from"./dist-ZmB2kPfR.js";import{pt as r}from"./queries-BX_TBXN8.js";import{c as i,l as a,s as o}from"./event-DMqRNLc_.js";import{Z as s,a as c,i as l,n as u,o as d,r as f}from"./index-c_O4h5hL.js";var p=n(e(),1),m=t();function h({children:e}){return(0,p.useSyncExternalStore)(a,o)===null?(0,m.jsx)(g,{}):e}function g(){let[e,t]=(0,p.useState)(``),[n,a]=(0,p.useState)(()=>c(navigator.userAgent)),[o,h]=(0,p.useState)(u.scope),[g,_]=(0,p.useState)(String(u.expiresInDays)),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(!1),w=(0,p.useRef)(null),T=(0,p.useId)(),E=`${T}-help`,D=`${T}-rejected`;async function O(t){t.preventDefault(),C(!0),y(null),x(!1);try{let t=g===`never`?null:Number(g);i(await d(e.trim(),n.trim(),{scope:o,expiresInDays:t}))}catch(e){e instanceof l?(x(!0),w.current?.focus(),w.current?.select()):e instanceof TypeError?y(`Could not reach the server: ${String(e)}`):y(e instanceof Error?e.message:String(e))}finally{C(!1)}}return(0,m.jsx)(`main`,{className:`flex min-h-svh flex-col items-center justify-center gap-4 p-6`,children:(0,m.jsxs)(`form`,{onSubmit:O,"aria-label":`Server access`,className:`flex w-full max-w-sm flex-col gap-3 rounded-lg border p-5`,children:[(0,m.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Toodo server`}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sign in with the server's access token. This browser then gets a token of its own, which you can revoke under Devices.`}),(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`label`,{htmlFor:`${T}-token`,className:`text-xs text-muted-foreground`,children:`Access token`}),(0,m.jsx)(`input`,{ref:w,id:`${T}-token`,className:`${s} aria-invalid:border-destructive`,type:`password`,autoComplete:`current-password`,value:e,onChange:e=>{t(e.target.value),x(!1)},"aria-invalid":b||void 0,"aria-describedby":b?`${D} ${E}`:E,required:!0}),b&&(0,m.jsxs)(`p`,{id:D,role:`alert`,className:`text-xs text-destructive`,children:[`The server did not accept this token. Paste the whole contents of`,` `,(0,m.jsx)(`code`,{className:`text-xs`,children:`web-token`}),` again; a device token stops working once it is revoked.`]}),(0,m.jsxs)(`p`,{id:E,className:`text-xs text-muted-foreground`,children:[`Copy it from `,(0,m.jsx)(`code`,{className:`text-xs`,children:`web-token`}),` in the server's data directory.`]})]}),(0,m.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Device name`,(0,m.jsx)(`input`,{className:s,maxLength:80,value:n,onChange:e=>a(e.target.value),required:!0})]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,m.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Access`,(0,m.jsxs)(`select`,{className:s,value:o,onChange:e=>h(e.target.value),children:[(0,m.jsx)(`option`,{value:`full`,children:`Full access`}),(0,m.jsx)(`option`,{value:`read`,children:`Read-only`})]})]}),(0,m.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Token expires after`,(0,m.jsx)(`select`,{className:s,value:g,onChange:e=>_(e.target.value),children:f.map(({label:e,days:t})=>(0,m.jsx)(`option`,{value:t===null?`never`:String(t),children:e},e))})]})]}),(0,m.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Applies when you sign in with `,(0,m.jsx)(`code`,{className:`text-xs`,children:`web-token`}),`. When the token expires, sign in again.`]}),v&&(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:v}),(0,m.jsx)(r,{type:`submit`,disabled:S||!e.trim()||!n.trim(),children:S?`Checking...`:`Continue`})]})})}export{h as ServerAccess};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{A as a,K as o,Y as s,a as c,pt as l,u}from"./queries-BX_TBXN8.js";import{Ct as d,F as f,G as p,Ht as m,I as h,It as g,J as _,L as v,Lt as y,Nt as b,R as ee,Tt as x,U as S,W as C,Y as w,bt as T,gt as E,q as D,wt as O,z as k}from"./index-BDqYqqXj.js";import{t as A}from"./opener-DWhHPoCL.js";import{t as te}from"./details-sheet-LzPkfw74.js";var j={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};j.node;var M=t(j),N={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};N.node;var P=t(N),F={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};F.node;var I=t(F),L=r(e(),1),R=n();function z({onClose:e,children:t}){let n=(0,L.useRef)(null),[r,i]=(0,L.useState)(!1);function a(){n.current?.querySelector(`form[data-dirty]`)?i(!0):e()}return(0,L.useEffect)(()=>{function e(e){e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role=menu]`)||(r?i(!1):e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select`)||a())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)}),(0,R.jsx)(te,{ref:n,width:`min(480px, max(360px, 40vw), calc(100vw - 32px))`,onClose:a,banner:r&&(0,R.jsxs)(`div`,{role:`group`,"aria-label":`Unsaved changes`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted px-4 py-2 text-xs`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Discard your unsaved changes?`}),(0,R.jsx)(l,{size:`xs`,variant:`outline`,autoFocus:!0,onClick:()=>i(!1),children:`Keep editing`}),(0,R.jsx)(l,{size:`xs`,variant:`destructive`,onClick:e,children:`Discard changes`})]}),children:t})}function B(e){switch(e.status){case`in_progress`:return`Started`;case`in_review`:return`In review`;case`done`:return`Completed`;case`planned`:return e.reopened?`Reopened`:`Paused`}}function V({task:e}){let t=e.timeline.filter(e=>e.reason!==null);return t.length===0?null:(0,R.jsx)(`ol`,{"aria-label":`Reasons of #${e.id}`,className:`mt-1 flex flex-col gap-0.5`,children:t.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2 max-md:flex-wrap max-md:gap-y-0`,children:[(0,R.jsx)(T,{className:`shrink-0 text-muted-foreground`,at:e.at}),(0,R.jsx)(`span`,{className:`shrink-0 font-medium`,children:B(e)}),(0,R.jsx)(`span`,{className:`min-w-0 whitespace-pre-line break-words-keep max-md:basis-full`,children:e.reason})]},t))})}var H={lane:`Lane`,discord:`Discord`,pr:`PR`};function U({value:e}){if(/^https?:\/\//i.test(e)){let t=t=>{t.preventDefault(),A(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,R.jsx)(`a`,{href:e,onClick:t,onAuxClick:t,className:`min-w-0 break-all text-primary underline underline-offset-2 hover:no-underline`,children:e})}let t=e.indexOf(`:`),n=t>0?H[e.slice(0,t)]:void 0;return n===void 0?(0,R.jsx)(`code`,{className:`min-w-0 break-all`,children:e}):(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:n}),(0,R.jsx)(`code`,{className:`min-w-0 break-all`,children:e.slice(t+1)})]})}function W({task:e}){return e.refs.length===0?null:(0,R.jsx)(S,{label:`Refs`,children:(0,R.jsx)(`ul`,{"aria-label":`Refs of #${e.id}`,className:`flex flex-col gap-0.5`,children:e.refs.map(e=>(0,R.jsx)(`li`,{className:`flex min-w-0`,children:(0,R.jsx)(U,{value:e})},e))})})}function G({task:e,detailed:t}){let n=x(e.milestones);return n.length===0?null:t?(0,R.jsxs)(S,{label:`Timeline`,children:[(0,R.jsx)(`dl`,{"aria-label":`Timeline of #${e.id}`,className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5`,children:n.map(({label:e,at:t})=>(0,R.jsxs)(`div`,{className:`contents`,children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{children:(0,R.jsx)(T,{at:t})})]},e))}),(0,R.jsx)(V,{task:e})]}):(0,R.jsx)(`p`,{"aria-label":`Timeline of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:n.map(({label:e,at:t})=>(0,R.jsx)(T,{at:t,prefix:`${e} `},e))})}function K({task:e,tasks:t,context:n,navigation:r}){let s=o(),l=c(),u=a(),d=(s.data??[]).flatMap(({taskId:t,relatedId:n})=>t===e.id?[n]:n===e.id?[t]:[]).filter(e=>n.byId.has(e)),f=t.filter(t=>t.id!==e.id&&!d.includes(t.id)),p=[...new Set([e.workspaceId,...f.map(e=>e.workspaceId)])].map(e=>({workspaceId:e,tasks:f.filter(t=>t.workspaceId===e)})).filter(e=>e.tasks.length>0),m=w(),h=l.isPending||u.isPending||m,g=l.error??u.error;if(d.length===0&&p.length===0)return null;let v=p.length>0&&(0,R.jsxs)(`select`,{"aria-label":`Add related task to #${e.id}`,className:i(`h-6 rounded-md border border-input bg-background px-1.5 text-xs outline-none max-md:h-11 max-md:px-2.5 max-md:text-sm focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50`,`max-w-48`),value:``,disabled:h,onChange:t=>{t.target.value&&l.mutate({taskId:e.id,relatedId:Number(t.target.value)})},children:[(0,R.jsx)(`option`,{value:``,children:`Add related task...`}),p.map(e=>(0,R.jsx)(`optgroup`,{label:n.workspaceName(e.workspaceId),children:e.tasks.map(e=>(0,R.jsxs)(`option`,{value:e.id,children:[`#`,e.id,` `,e.title]},e.id))},e.workspaceId))]}),b=g&&(0,R.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:g.message});return d.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs`,children:[v,b]}):(0,R.jsxs)(S,{label:`Related`,children:[(0,R.jsxs)(`ul`,{"aria-label":`Related tasks of #${e.id}`,className:`flex flex-wrap items-center gap-1 max-md:gap-2`,children:[d.map(t=>{let i=n.byId.get(t),a=_(t,e.workspaceId,n);return(0,R.jsxs)(`li`,{className:`inline-flex h-6 min-w-0 items-center rounded-md border max-md:h-11 max-md:gap-2 max-md:border-0`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Open related task ${a}`,title:i?.title,className:`h-full min-w-0 max-w-56 truncate rounded-l-md px-1.5 tabular-nums hover:bg-muted max-md:rounded-md max-md:border max-md:px-3 disabled:cursor-default disabled:hover:bg-transparent`,disabled:r===void 0||!r.canOpen(t),onClick:()=>r?.open(t),children:[a,` `,i?.title]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Remove related task #${t} from #${e.id}`,title:`Remove related task`,className:`flex h-full items-center justify-center rounded-r-md p-1 text-muted-foreground hover:bg-muted max-md:w-11 max-md:rounded-md max-md:border hover:text-foreground disabled:opacity-50`,disabled:h,onClick:()=>u.mutate({taskId:e.id,relatedId:t}),children:(0,R.jsx)(y,{className:`size-3`})})]},t)}),v]}),b]})}function q({task:e}){let t=s();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(l,{size:`xs`,variant:`outline`,changesData:!0,"aria-pressed":e.autopilot,"aria-label":`Autopilot of #${e.id}`,title:e.autopilot?`Marked for autopilot: an executor may take it up on its own once it is ready. Click to clear.`:`Not marked for autopilot. Click to let an executor take it up on its own once it is ready.`,disabled:t.isPending,onClick:()=>t.mutate({status:null,id:e.id,taskType:e.taskType,title:e.title,description:e.description,estimate:e.estimate,dueDate:e.dueDate,autopilot:!e.autopilot,criteria:null}),className:i(`shrink-0`,e.autopilot&&b.info),children:[(0,R.jsx)(m,{"aria-hidden":!0}),e.autopilot?`Autopilot on`:`Autopilot off`]}),t.error&&(0,R.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:t.error.message})]})}function J({task:e}){return(0,R.jsxs)(R.Fragment,{children:[(e.estimate!==null||e.dueDate!==null)&&(0,R.jsxs)(`p`,{"aria-label":`Plan of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:[e.estimate!==null&&(0,R.jsxs)(`span`,{children:[`Estimate `,E(e.estimate)]}),e.dueDate!==null&&(0,R.jsx)(C,{task:e})]}),(0,R.jsx)(D,{task:e}),(0,R.jsx)(W,{task:e})]})}var Y={progress:`Progress`,blocker:`Blocker`,decision:`Decision`},X={progress:`neutral`,blocker:`attention`,decision:`info`};function Z({kind:e}){return(0,R.jsx)(`span`,{"data-note-kind":e,className:i(`shrink-0 rounded-md px-1.5 font-medium`,b[X[e]]),children:Y[e]})}function ne({task:e,detailed:t}){let n=e.notes;if(n.length===0)return null;if(!t){let t=n[n.length-1];return(0,R.jsxs)(`p`,{"aria-label":`Latest note of #${e.id}`,className:`flex min-w-0 items-center gap-1.5 text-xs`,title:d(t.at),children:[(0,R.jsx)(Z,{kind:t.kind}),(0,R.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:k(t.body)}),n.length>1&&(0,R.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`+${n.length-1} more`})]})}return(0,R.jsx)(S,{label:`Notes (${n.length})`,children:(0,R.jsx)(`ol`,{"aria-label":`Notes of #${e.id}`,className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(Z,{kind:e.kind}),(0,R.jsx)(T,{className:`text-muted-foreground`,at:e.at})]}),(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(`p`,{className:`whitespace-pre-line break-words-keep`,children:e.body}),children:(0,R.jsx)(p,{source:e.body})})]},t))})})}var re={pending:`Pending`,met:`Met`,failed:`Failed`},ie={pending:g.neutral,met:g.success,failed:g.danger},Q={user:`you`,agent:`an agent`,toodo:`Toodo`};function $({state:e}){let t=e===`met`?M:e===`failed`?P:I;return(0,R.jsx)(`span`,{role:`img`,"aria-label":re[e],className:i(`flex size-4 shrink-0 items-center justify-center`,ie[e]),children:(0,R.jsx)(t,{"aria-hidden":!0,className:`size-3.5`})})}function ae(e){if(e.checkedBy===null)return null;let t=e.checkedAt===null?``:` ${O(e.checkedAt)}`;return`Checked by ${Q[e.checkedBy]}${t}`}function oe({task:e,detailed:t}){let n=e.criteria;if(n.length===0)return null;let r=(0,R.jsx)(`ul`,{"aria-label":`Criteria of #${e.id}`,className:`flex flex-col gap-0.5`,children:n.map(n=>(0,R.jsx)(se,{task:e,criterion:n,detailed:t},n.id))});if(!t)return r;let i=n.filter(e=>e.state===`met`).length;return(0,R.jsx)(S,{label:`Criteria (${i} of ${n.length} met)`,children:r})}function se({task:e,criterion:t,detailed:n}){let r=u(),a=w(),[o,s]=(0,L.useState)(!1),[c,d]=(0,L.useState)(``),p=t.kind===`manual`&&e.status!==`done`,m=ae(t),_=h(t.kind)?t.target:null;function y(){s(!1),d(``)}let b=ee(c.trim()!==``,y,r.isPending);function x(n){o?y():n?(r.reset(),s(!0)):r.mutate({taskId:e.id,criterionId:t.id,met:!1,evidence:null})}function S(n){n.preventDefault(),r.mutate({taskId:e.id,criterionId:t.id,met:!0,evidence:c.trim()||null},{onSuccess:y})}return(0,R.jsxs)(`li`,{"data-criterion-state":t.state,className:`flex min-w-0 flex-col gap-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,title:n?void 0:[m,t.evidence,_].filter(Boolean).join(`
|
|
1
|
+
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{A as a,K as o,Y as s,a as c,pt as l,u}from"./queries-BX_TBXN8.js";import{Ct as d,F as f,G as p,Ht as m,I as h,It as g,J as _,L as v,Lt as y,Nt as b,R as ee,Tt as x,U as S,W as C,Y as w,bt as T,gt as E,q as D,wt as O,z as k}from"./index-c_O4h5hL.js";import{t as A}from"./opener-DWhHPoCL.js";import{t as te}from"./details-sheet-D3E2O1qq.js";var j={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};j.node;var M=t(j),N={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};N.node;var P=t(N),F={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};F.node;var I=t(F),L=r(e(),1),R=n();function z({onClose:e,children:t}){let n=(0,L.useRef)(null),[r,i]=(0,L.useState)(!1);function a(){n.current?.querySelector(`form[data-dirty]`)?i(!0):e()}return(0,L.useEffect)(()=>{function e(e){e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role=menu]`)||(r?i(!1):e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select`)||a())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)}),(0,R.jsx)(te,{ref:n,width:`min(480px, max(360px, 40vw), calc(100vw - 32px))`,onClose:a,banner:r&&(0,R.jsxs)(`div`,{role:`group`,"aria-label":`Unsaved changes`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted px-4 py-2 text-xs`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Discard your unsaved changes?`}),(0,R.jsx)(l,{size:`xs`,variant:`outline`,autoFocus:!0,onClick:()=>i(!1),children:`Keep editing`}),(0,R.jsx)(l,{size:`xs`,variant:`destructive`,onClick:e,children:`Discard changes`})]}),children:t})}function B(e){switch(e.status){case`in_progress`:return`Started`;case`in_review`:return`In review`;case`done`:return`Completed`;case`planned`:return e.reopened?`Reopened`:`Paused`}}function V({task:e}){let t=e.timeline.filter(e=>e.reason!==null);return t.length===0?null:(0,R.jsx)(`ol`,{"aria-label":`Reasons of #${e.id}`,className:`mt-1 flex flex-col gap-0.5`,children:t.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2 max-md:flex-wrap max-md:gap-y-0`,children:[(0,R.jsx)(T,{className:`shrink-0 text-muted-foreground`,at:e.at}),(0,R.jsx)(`span`,{className:`shrink-0 font-medium`,children:B(e)}),(0,R.jsx)(`span`,{className:`min-w-0 whitespace-pre-line break-words-keep max-md:basis-full`,children:e.reason})]},t))})}var H={lane:`Lane`,discord:`Discord`,pr:`PR`};function U({value:e}){if(/^https?:\/\//i.test(e)){let t=t=>{t.preventDefault(),A(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,R.jsx)(`a`,{href:e,onClick:t,onAuxClick:t,className:`min-w-0 break-all text-primary underline underline-offset-2 hover:no-underline`,children:e})}let t=e.indexOf(`:`),n=t>0?H[e.slice(0,t)]:void 0;return n===void 0?(0,R.jsx)(`code`,{className:`min-w-0 break-all`,children:e}):(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:n}),(0,R.jsx)(`code`,{className:`min-w-0 break-all`,children:e.slice(t+1)})]})}function W({task:e}){return e.refs.length===0?null:(0,R.jsx)(S,{label:`Refs`,children:(0,R.jsx)(`ul`,{"aria-label":`Refs of #${e.id}`,className:`flex flex-col gap-0.5`,children:e.refs.map(e=>(0,R.jsx)(`li`,{className:`flex min-w-0`,children:(0,R.jsx)(U,{value:e})},e))})})}function G({task:e,detailed:t}){let n=x(e.milestones);return n.length===0?null:t?(0,R.jsxs)(S,{label:`Timeline`,children:[(0,R.jsx)(`dl`,{"aria-label":`Timeline of #${e.id}`,className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5`,children:n.map(({label:e,at:t})=>(0,R.jsxs)(`div`,{className:`contents`,children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{children:(0,R.jsx)(T,{at:t})})]},e))}),(0,R.jsx)(V,{task:e})]}):(0,R.jsx)(`p`,{"aria-label":`Timeline of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:n.map(({label:e,at:t})=>(0,R.jsx)(T,{at:t,prefix:`${e} `},e))})}function K({task:e,tasks:t,context:n,navigation:r}){let s=o(),l=c(),u=a(),d=(s.data??[]).flatMap(({taskId:t,relatedId:n})=>t===e.id?[n]:n===e.id?[t]:[]).filter(e=>n.byId.has(e)),f=t.filter(t=>t.id!==e.id&&!d.includes(t.id)),p=[...new Set([e.workspaceId,...f.map(e=>e.workspaceId)])].map(e=>({workspaceId:e,tasks:f.filter(t=>t.workspaceId===e)})).filter(e=>e.tasks.length>0),m=w(),h=l.isPending||u.isPending||m,g=l.error??u.error;if(d.length===0&&p.length===0)return null;let v=p.length>0&&(0,R.jsxs)(`select`,{"aria-label":`Add related task to #${e.id}`,className:i(`h-6 rounded-md border border-input bg-background px-1.5 text-xs outline-none max-md:h-11 max-md:px-2.5 max-md:text-sm focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50`,`max-w-48`),value:``,disabled:h,onChange:t=>{t.target.value&&l.mutate({taskId:e.id,relatedId:Number(t.target.value)})},children:[(0,R.jsx)(`option`,{value:``,children:`Add related task...`}),p.map(e=>(0,R.jsx)(`optgroup`,{label:n.workspaceName(e.workspaceId),children:e.tasks.map(e=>(0,R.jsxs)(`option`,{value:e.id,children:[`#`,e.id,` `,e.title]},e.id))},e.workspaceId))]}),b=g&&(0,R.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:g.message});return d.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs`,children:[v,b]}):(0,R.jsxs)(S,{label:`Related`,children:[(0,R.jsxs)(`ul`,{"aria-label":`Related tasks of #${e.id}`,className:`flex flex-wrap items-center gap-1 max-md:gap-2`,children:[d.map(t=>{let i=n.byId.get(t),a=_(t,e.workspaceId,n);return(0,R.jsxs)(`li`,{className:`inline-flex h-6 min-w-0 items-center rounded-md border max-md:h-11 max-md:gap-2 max-md:border-0`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Open related task ${a}`,title:i?.title,className:`h-full min-w-0 max-w-56 truncate rounded-l-md px-1.5 tabular-nums hover:bg-muted max-md:rounded-md max-md:border max-md:px-3 disabled:cursor-default disabled:hover:bg-transparent`,disabled:r===void 0||!r.canOpen(t),onClick:()=>r?.open(t),children:[a,` `,i?.title]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Remove related task #${t} from #${e.id}`,title:`Remove related task`,className:`flex h-full items-center justify-center rounded-r-md p-1 text-muted-foreground hover:bg-muted max-md:w-11 max-md:rounded-md max-md:border hover:text-foreground disabled:opacity-50`,disabled:h,onClick:()=>u.mutate({taskId:e.id,relatedId:t}),children:(0,R.jsx)(y,{className:`size-3`})})]},t)}),v]}),b]})}function q({task:e}){let t=s();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(l,{size:`xs`,variant:`outline`,changesData:!0,"aria-pressed":e.autopilot,"aria-label":`Autopilot of #${e.id}`,title:e.autopilot?`Marked for autopilot: an executor may take it up on its own once it is ready. Click to clear.`:`Not marked for autopilot. Click to let an executor take it up on its own once it is ready.`,disabled:t.isPending,onClick:()=>t.mutate({status:null,id:e.id,taskType:e.taskType,title:e.title,description:e.description,estimate:e.estimate,dueDate:e.dueDate,autopilot:!e.autopilot,criteria:null}),className:i(`shrink-0`,e.autopilot&&b.info),children:[(0,R.jsx)(m,{"aria-hidden":!0}),e.autopilot?`Autopilot on`:`Autopilot off`]}),t.error&&(0,R.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:t.error.message})]})}function J({task:e}){return(0,R.jsxs)(R.Fragment,{children:[(e.estimate!==null||e.dueDate!==null)&&(0,R.jsxs)(`p`,{"aria-label":`Plan of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:[e.estimate!==null&&(0,R.jsxs)(`span`,{children:[`Estimate `,E(e.estimate)]}),e.dueDate!==null&&(0,R.jsx)(C,{task:e})]}),(0,R.jsx)(D,{task:e}),(0,R.jsx)(W,{task:e})]})}var Y={progress:`Progress`,blocker:`Blocker`,decision:`Decision`},X={progress:`neutral`,blocker:`attention`,decision:`info`};function Z({kind:e}){return(0,R.jsx)(`span`,{"data-note-kind":e,className:i(`shrink-0 rounded-md px-1.5 font-medium`,b[X[e]]),children:Y[e]})}function ne({task:e,detailed:t}){let n=e.notes;if(n.length===0)return null;if(!t){let t=n[n.length-1];return(0,R.jsxs)(`p`,{"aria-label":`Latest note of #${e.id}`,className:`flex min-w-0 items-center gap-1.5 text-xs`,title:d(t.at),children:[(0,R.jsx)(Z,{kind:t.kind}),(0,R.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:k(t.body)}),n.length>1&&(0,R.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`+${n.length-1} more`})]})}return(0,R.jsx)(S,{label:`Notes (${n.length})`,children:(0,R.jsx)(`ol`,{"aria-label":`Notes of #${e.id}`,className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(Z,{kind:e.kind}),(0,R.jsx)(T,{className:`text-muted-foreground`,at:e.at})]}),(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(`p`,{className:`whitespace-pre-line break-words-keep`,children:e.body}),children:(0,R.jsx)(p,{source:e.body})})]},t))})})}var re={pending:`Pending`,met:`Met`,failed:`Failed`},ie={pending:g.neutral,met:g.success,failed:g.danger},Q={user:`you`,agent:`an agent`,toodo:`Toodo`};function $({state:e}){let t=e===`met`?M:e===`failed`?P:I;return(0,R.jsx)(`span`,{role:`img`,"aria-label":re[e],className:i(`flex size-4 shrink-0 items-center justify-center`,ie[e]),children:(0,R.jsx)(t,{"aria-hidden":!0,className:`size-3.5`})})}function ae(e){if(e.checkedBy===null)return null;let t=e.checkedAt===null?``:` ${O(e.checkedAt)}`;return`Checked by ${Q[e.checkedBy]}${t}`}function oe({task:e,detailed:t}){let n=e.criteria;if(n.length===0)return null;let r=(0,R.jsx)(`ul`,{"aria-label":`Criteria of #${e.id}`,className:`flex flex-col gap-0.5`,children:n.map(n=>(0,R.jsx)(se,{task:e,criterion:n,detailed:t},n.id))});if(!t)return r;let i=n.filter(e=>e.state===`met`).length;return(0,R.jsx)(S,{label:`Criteria (${i} of ${n.length} met)`,children:r})}function se({task:e,criterion:t,detailed:n}){let r=u(),a=w(),[o,s]=(0,L.useState)(!1),[c,d]=(0,L.useState)(``),p=t.kind===`manual`&&e.status!==`done`,m=ae(t),_=h(t.kind)?t.target:null;function y(){s(!1),d(``)}let b=ee(c.trim()!==``,y,r.isPending);function x(n){o?y():n?(r.reset(),s(!0)):r.mutate({taskId:e.id,criterionId:t.id,met:!1,evidence:null})}function S(n){n.preventDefault(),r.mutate({taskId:e.id,criterionId:t.id,met:!0,evidence:c.trim()||null},{onSuccess:y})}return(0,R.jsxs)(`li`,{"data-criterion-state":t.state,className:`flex min-w-0 flex-col gap-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,title:n?void 0:[m,t.evidence,_].filter(Boolean).join(`
|
|
2
2
|
`)||void 0,children:[p?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`label`,{className:`flex size-4 shrink-0 items-center justify-center max-md:-mx-3.5 max-md:size-11`,children:(0,R.jsx)(`input`,{type:`checkbox`,"aria-label":`Check criterion ${t.id} of #${e.id}`,checked:t.state===`met`||o,disabled:r.isPending||a,onChange:e=>x(e.target.checked)})}),t.state===`failed`&&(0,R.jsx)($,{state:`failed`})]}):(0,R.jsx)($,{state:t.state}),(0,R.jsx)(`span`,{className:i(`min-w-0`,n?`break-words-keep`:`truncate`,t.state===`failed`&&g.danger),children:t.text}),t.kind!==`manual`&&(0,R.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-1.5 text-muted-foreground`,children:f[t.kind]}),!n&&t.evidence&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.evidence})]}),n&&_&&(0,R.jsx)(`code`,{className:`ml-5.5 break-all text-muted-foreground`,children:_}),n&&(t.evidence||m)&&(0,R.jsxs)(`p`,{className:`ml-5.5 whitespace-pre-line break-words-keep text-muted-foreground`,children:[t.evidence,t.evidence&&m&&` · `,t.checkedBy!==null&&(0,R.jsxs)(R.Fragment,{children:[`Checked by `,Q[t.checkedBy],t.checkedAt!==null&&(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(T,{at:t.checkedAt})]})]})]}),o&&(0,R.jsxs)(`form`,{onSubmit:S,className:`ml-5.5 flex flex-wrap items-center gap-1`,onKeyDown:b.onKeyDown,children:[(0,R.jsx)(`input`,{className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 text-sm outline-none max-md:h-11 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,`h-7 flex-1 basis-48`),"aria-label":`Evidence for criterion ${t.id}`,placeholder:`Evidence (optional), e.g. a link or what you checked`,value:c,onChange:e=>d(e.target.value),autoFocus:!0}),b.asking?(0,R.jsx)(v,{label:`Discard evidence for criterion ${t.id}`,question:`Discard the evidence?`,onKeep:b.keep,onDiscard:b.discard}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{type:`submit`,size:`xs`,disabled:r.isPending,children:r.isPending?`Saving...`:`Save`}),(0,R.jsx)(l,{type:`button`,size:`xs`,variant:`ghost`,onClick:b.request,children:`Cancel`})]})]}),r.isError&&(0,R.jsx)(`p`,{role:`alert`,className:`ml-5.5 text-destructive`,children:r.error.message})]})}export{q as AutopilotToggle,K as RelatedTasks,oe as TaskCriteria,z as TaskDetailsSheet,ne as TaskNotes,J as TaskPlan,G as TaskTimeline};
|