@dubusoft/toodo-linux-arm64 1.3.3-dev.64 → 1.3.3-dev.65
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-BHRfmUm7.js → details-sheet-C66cuNM0.js} +1 -1
- package/web/assets/{index-CEjVLKaZ.js → index-CA6XfQF_.js} +5 -8
- package/web/assets/{markdown-4g2NTZpH.js → markdown-D0-9L3kk.js} +1 -1
- package/web/assets/{offline-screen-BSGAT4r-.js → offline-screen-But1V_BX.js} +1 -1
- package/web/assets/review-Cr_Fn4ZM.js +1 -0
- package/web/assets/{server-access-CnP0j-8e.js → server-access-CGxnevaj.js} +1 -1
- package/web/assets/{status-styles-DLZB0S-A.js → status-styles-HqDkXABu.js} +1 -1
- package/web/assets/task-details-DIx92WqK.js +4 -0
- package/web/assets/task-graph-CawZ2SR-.js +8 -0
- package/web/assets/{workspace-list-CbAQLx7f.js → workspace-list-BKokJOU3.js} +1 -1
- package/web/index.html +3 -3
- package/web/sw.js +2 -2
- package/web/assets/review-x0gUUMTL.js +0 -1
- package/web/assets/task-details-BeFv75VE.js +0 -4
- package/web/assets/task-graph-D1MVyhVc.js +0 -8
|
@@ -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,G as s,L as c,Pt as l,Vt as u,_t as d,d as f,nn as p,q as m,z as h}from"./status-styles-DLZB0S-A.js";import{f as g,g as _,h as v}from"./event-CwtUqkXR.js";var y={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};y.node;var b=t(y),x={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};x.node;var S=t(x),C={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};C.node;var w=t(C),T={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};T.node;var E=t(T),D={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};D.node;var O=t(D),k={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};k.node;var A=t(k),j={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};j.node;var M=t(j),N={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};N.node;var P=t(N),F=r(e(),1),I=n();function ee(e,t){if(e===null)return;let n=[...e.querySelectorAll(`a[href], button, input, select, textarea, summary, [tabindex]`)].filter(e=>!e.matches(`:disabled, [tabindex='-1']`)&&e.getClientRects().length>0);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement,o=a instanceof Node&&e.contains(a);(t.shiftKey?!o||a===r:!o||a===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}function L(e){let t=/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)||e.includes(`\\`)&&!e.includes(`/`),n=t?`\\`:`/`,r=``,i=e,a=t?/^[\\/]{2}[^\\/]+[\\/]+[^\\/]+/.exec(e):null,o=t?/^[a-zA-Z]:([\\/]?)/.exec(e):null;a?(r=`${a[0].replace(/[\\/]+/g,`\\`).replace(/^\\/,`\\\\`)}\\`,i=e.slice(a[0].length)):o?(r=o[0].slice(0,2)+(o[1]?n:``),i=e.slice(o[0].length)):/^[\\/]/.test(e)&&(r=n,i=e.replace(/^[\\/]+/,``));let s=[];for(let e of i.split(t?/[\\/]+/:/\/+/))e!==``&&e!==`.`&&(e===`..`?s.length>0&&s[s.length-1]!==`..`?s.pop():r===``&&s.push(e):s.push(e));return{root:r,separator:n,segments:s}}function R(e){let{root:t,separator:n,segments:r}=L(e),i=t+r.join(n);return i===``?`.`:i}function z(e){return/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)}function B(e,t=2){let{separator:n,segments:r}=L(e);return r.length<=t?R(e):`…${n}${r.slice(-t).join(n)}`}var V=200;function H(e,t){let n=z(e)?`\\`:`/`;return/[\\/]$/.test(e)?`${e}${t}`:`${e}${n}${t}`}function te(e){return e.replace(/(?<=[^\\/:])[\\/]+$/,``)}function U(e,t){let[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function ne({id:e,machine:t,value:n,onChange:r,describedBy:a,required:s,autoFocus:c,className:l}){let[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(-1),m=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`)),h=m<0?null:n.slice(0,m+1),g=n.slice(m+1).toLowerCase(),_=U(h,V),v=o(t,u?_:null),y=u&&h!==null&&_===h,b=y&&v.data?v.data.directories.filter(e=>e.toLowerCase().startsWith(g)):[],x=b.length>0,S=`${e}-folders`,C=t.kind===`local`?`the server`:t.label;function w(e){r(e),p(-1),d(!0)}function T(e){h!==null&&w(`${H(h,e)}${z(h)?`\\`:`/`}`)}function E(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!x){d(!0);return}let t=b.length,n=e.key===`ArrowDown`;p(e=>e<0?n?0:t-1:(e+(n?1:t-1))%t)}else if(e.key===`Enter`){if(!x||f<0)return;e.preventDefault(),T(b[f])}else if(e.key===`Tab`){if(!x||e.shiftKey||f<0&&g===``)return;e.preventDefault(),e.stopPropagation(),T(b[Math.max(f,0)])}else if(e.key===`Escape`){if(!x)return;e.preventDefault(),e.stopPropagation(),d(!1)}}return(0,I.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{id:e,role:`combobox`,"aria-expanded":x,"aria-controls":S,"aria-autocomplete":`list`,"aria-activedescendant":x&&f>=0?`${S}-${f}`:void 0,"aria-describedby":a,autoComplete:`off`,spellCheck:!1,className:l,value:n,onChange:e=>w(e.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:E,required:s,autoFocus:c}),x&&(0,I.jsx)(`ul`,{id:S,role:`listbox`,"aria-label":`Folders in ${h}`,className:`absolute top-full right-0 left-0 z-10 mt-1 flex max-h-56 flex-col overflow-y-auto rounded-lg border bg-popover p-1 font-mono text-xs text-popover-foreground shadow-md`,children:b.map((e,t)=>(0,I.jsxs)(`li`,{id:`${S}-${t}`,role:`option`,"aria-selected":t===f,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e),className:i(`cursor-pointer truncate rounded px-1.5 py-1 hover:bg-muted max-md:py-2`,t===f&&`bg-secondary hover:bg-secondary`),children:[e,z(h??``)?`\\`:`/`]},e))}),y&&v.isError&&(0,I.jsxs)(`p`,{role:`status`,className:`mt-1 text-xs break-words text-muted-foreground`,children:[`No suggestions: `,v.error.message,`. Type the path of a folder that exists on `,C,`, ending in a separator, to see its subfolders.`]})]})}var re=[`none`,`local_git`,`github`],ie=[`manual`,`local_merge`,`pr_merge`],ae=[`herdr`,`plain`,`tmux`,`none`],oe=[`open`,`init`,`clone`],W={none:`Plain folder`,local_git:`Local git`,github:`GitHub`},G={manual:`Manual`,local_merge:`Local merge`,pr_merge:`PR merge`},K={none:`No runner`,herdr:`herdr`,plain:`Plain`,tmux:`tmux`},se={open:`Open existing`,init:`New repository`,clone:`Clone URL`};function q(e){return e===`none`?`manual`:e===`local_git`?`local_merge`:`pr_merge`}function ce(e,t=!1){return e===`none`?`none`:t?`plain`:`herdr`}function le(e){return e===`none`?null:`open`}function ue(e,t){switch(t){case`manual`:return null;case`local_merge`:return e===`local_git`?null:e===`none`?`Needs a git repository; choose source Local git`:`GitHub tasks merge through pull requests; choose source Local git`;case`pr_merge`:return e===`github`?null:e===`none`?`Needs a git repository; choose source GitHub`:`Needs a GitHub origin remote; choose source GitHub`}}function de(e,t,n){return n!==`none`&&e===`none`?`Needs a git repository for task worktrees; choose source Local git or GitHub`:n===`none`&&t!==`manual`?`${G[t]} needs the task branch that herdr, ${K.plain}, or ${K.tmux} creates; choose completion Manual`:null}function fe(e,t){return e===`tmux`&&t.kind===`ssh`&&z(t.path)?`Needs a POSIX host; choose ${K.plain} or ${K.herdr} for a Windows SSH workspace, or choose a POSIX path for ${K.tmux}`:null}function pe(e,t){return e===`none`?`A plain folder has no repository; choose source Local git or GitHub`:e===`github`&&t===`init`?`A new repository has no GitHub origin; choose source Local git`:null}function me(e,t=!1){let{source:n}=e,r=e.repository!==null&&pe(n,e.repository)===null?e.repository:le(n),i=e.completion!==null&&ue(n,e.completion)===null?e.completion:q(n);return{source:n,repository:r,completion:i,runner:e.runner!==null&&de(n,i,e.runner)===null?e.runner:ce(n,t)}}function he(e,t,n=!1){let r={...e,...t},i=me(r,n);return{source:r.source,repository:r.repository===i.repository?r.repository:null,completion:r.completion===i.completion?r.completion:null,runner:r.runner===i.runner?r.runner:null}}var J=`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`,Y=`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`;function X(e){let t=R(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}function ge(e){let t=B(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}var _e={foreign:`Windows path, not on this server`,missing:`Folder not found on the server`};function ve({problem:e,className:t}){return(0,I.jsxs)(`span`,{className:i(`flex min-w-0 items-start gap-1 text-xs text-destructive`,t),title:`Toodo cannot run git in this repository until its path is corrected`,children:[(0,I.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,I.jsx)(`span`,{children:_e[e]})]})}function ye({workspace:e}){let t=W[e.source],n=G[e.completion],r=K[e.runner];return(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:`Source ${t}, completion ${n}, runner ${r}; set when the workspace was added`,children:[(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:t}),` · `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:n}),` `,`· `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:r})]})}function be(e){return e.kind===`local`?null:e.machine}function xe(e,t){let n=t.filter(t=>t.target===e);return n.length===0?`Not saved in herdr`:n.some(e=>e.enabled)?null:`Disabled in herdr`}function Se(e){return/[\\/]$/.test(e)?e:H(e,``)}function Z({label:e,help:t,children:n}){let r=(0,F.useId)(),i=`${r}-help`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`label`,{htmlFor:r,className:`text-xs text-muted-foreground`,children:e}),n({id:r,describedBy:t?i:void 0}),t&&(0,I.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground`,children:t})]})}function Ce(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()??``}function we(e){return Ce(e.trim().replace(/\.git$/,``)).split(`:`).pop()??``}function Te({selectedId:e,onSelect:t}){let n=u(),r=(0,F.useSyncExternalStore)(v,g),i=r===`unreachable`||r===`retrying`,a=s(),o=d().data?.herdr.installed===!1,[c,l]=(0,F.useState)(null),f=(0,F.useRef)(null),m=()=>{l(null),f.current?.focus()},[h,y]=(0,F.useState)(!1),b=a.data??[],x=[null,...new Set([...b.map(e=>e.target),...(n.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])];return(0,I.jsxs)(`section`,{"aria-labelledby":`workspaces-heading`,className:`flex shrink-0 flex-col gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{id:`workspaces-heading`,className:`text-xs font-medium uppercase text-muted-foreground`,children:`Workspaces`}),(0,I.jsxs)(p,{variant:`ghost`,size:`xs`,onClick:()=>y(e=>!e),children:[!h&&(0,I.jsx)(O,{}),h?`Cancel`:`Add machine`]})]}),h&&(0,I.jsx)(Oe,{herdrMissing:o,onClose:()=>y(!1)}),a.isError&&(o?(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`herdr is not installed on this server, so there are no SSH machines; workspaces on Local can use runner`,` `,K.plain,`.`]}):(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to list herdr machines: `,a.error.message]})),n.isPending&&!i&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces...`}),(n.isError||n.isPending&&i)&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[(0,I.jsxs)(`p`,{children:[`Failed to load workspaces:`,` `,n.error?.message??(_()||`The Toodo server does not answer.`)]}),(0,I.jsx)(p,{size:`xs`,variant:`outline`,onClick:()=>void n.refetch(),children:`Retry now`})]}),n.data?.length===0&&c===null&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workspaces yet.`}),(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.data&&x.map(r=>{let i=r??`Local`,o=n.data.filter(e=>be(e.location)===r),s=r!==null&&a.isSuccess?xe(r,b):null;return(0,I.jsxs)(`section`,{"aria-label":`Machine ${i}`,className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsxs)(`h3`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-1 text-xs font-semibold`,children:[r===null?(0,I.jsx)(E,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(A,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate`,children:i}),s&&(0,I.jsx)(`span`,{className:`ml-1.5 font-normal text-destructive`,children:s})]}),(0,I.jsxs)(p,{size:`xs`,variant:`outline`,"aria-label":`Add workspace on ${i}`,title:`Add a workspace on this machine`,"aria-haspopup":`dialog`,"aria-expanded":c!==null&&c.machine===r,onClick:e=>{f.current=e.currentTarget,l({machine:r})},children:[(0,I.jsx)(O,{}),`Add`]})]}),o.length>0&&(0,I.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(n=>(0,I.jsx)(Ee,{workspace:n,selected:n.id===e,onSelect:t},n.id))})]},i)})}),c&&(0,I.jsx)(Le,{machine:c.machine,onCreated:e=>{m(),t(e.id)},onClose:m})]})}function Ee({workspace:e,selected:t,onSelect:n}){let r=h(),[a,o]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:i(`group flex items-center rounded-lg hover:bg-sidebar-accent`,t&&`bg-sidebar-accent`),children:[(0,I.jsxs)(`button`,{type:`button`,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:`flex min-w-0 flex-1 flex-col px-2.5 py-1.5 text-left`,children:[(0,I.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:X(e.location),children:B(e.location.path)}),(0,I.jsx)(ye,{workspace:e}),e.pathProblem&&(0,I.jsx)(ve,{problem:e.pathProblem})]}),!a&&(0,I.jsx)(p,{size:`icon-xs`,variant:`ghost`,"aria-label":`Remove ${e.name}`,title:`Move the workspace and its tasks to the archive`,className:`mr-1 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,onClick:()=>{r.reset(),o(!0)},children:(0,I.jsx)(P,{})})]}),a&&(0,I.jsxs)(`div`,{role:`group`,"aria-label":`Remove ${e.name}`,className:`flex flex-col gap-1.5 rounded-lg border p-2`,onKeyDown:e=>{e.key===`Escape`&&!r.isPending&&(e.preventDefault(),o(!1))},children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Remove `,e.name,` and its tasks from Toodo? They move to Settings > Archive, where they can be restored. The repository, worktrees, and herdr workspaces are kept.`]}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(p,{changesData:!0,size:`xs`,variant:`destructive`,"aria-label":`Confirm remove ${e.name}`,disabled:r.isPending,onClick:()=>r.mutate(e.id),children:r.isPending?`Removing...`:`Remove`}),(0,I.jsx)(p,{size:`xs`,variant:`ghost`,autoFocus:!0,onClick:()=>o(!1),children:`Back`})]})]})]})}function Q(e,t=!1){return n=>{n.key===`Escape`&&!t&&!n.defaultPrevented&&(n.preventDefault(),e())}}function De({workspace:e,onClose:t}){let n=a(),r=s(),i=u(),[o,c]=(0,F.useState)(be(e.location)),[l,d]=(0,F.useState)(e.location.path),f=[...new Set([...(r.data??[]).map(e=>e.target),...(i.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])],m=te(l.trim());function h(r){r.preventDefault();let i=o===null?{kind:`local`,path:m}:{kind:`ssh`,machine:o,path:m};n.mutate({id:e.id,location:i},{onSuccess:t})}return(0,I.jsxs)(`form`,{onSubmit:h,"aria-label":`Move ${e.name}`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t,n.isPending),children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Point the workspace at the same repository on another machine or in another folder. Its tasks stay. A repository on a Windows host takes a Windows path such as D:\\dev\\repo.`}),(0,I.jsx)(Z,{label:`Machine`,children:({id:e})=>(0,I.jsxs)(`select`,{id:e,className:J,value:o??``,onChange:e=>c(e.target.value===``?null:e.target.value),autoFocus:!0,children:[(0,I.jsx)(`option`,{value:``,children:`Local (this server)`}),f.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))]})}),(0,I.jsx)(Z,{label:`Folder`,help:`The repository's own folder on that machine.`,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:o===null?{kind:`local`}:{kind:`ssh`,label:o},className:J,describedBy:t,value:l,onChange:d,required:!0})}),n.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:n.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(p,{type:`submit`,size:`sm`,disabled:n.isPending||m===``,children:n.isPending?`Moving...`:`Move workspace`}),(0,I.jsx)(p,{type:`button`,size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:t,children:`Cancel`})]})]})}function Oe({herdrMissing:e,onClose:t}){let[n,r]=(0,F.useState)(null),[i,a]=(0,F.useState)(``),o=l(),s=(0,F.useId)(),c=`herdr machine add ${i.trim()||`<host>`}`;function u(e){e.preventDefault(),i.trim()!==``&&o.mutate(i.trim())}async function d(){try{await navigator.clipboard.writeText(c),r(`Copied the command.`)}catch(e){r(`Could not copy: ${String(e)}`)}}return(0,I.jsxs)(`section`,{"aria-label":`Add machine`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t),children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e&&`Install herdr on the server first; SSH machines need it. `,`Enter an SSH host from the server's ~/.ssh/config and test the connection. herdr asks questions in a terminal, which the Toodo server cannot open, so then run the command below in a terminal on the server and reload the machine list here.`]}),(0,I.jsxs)(`form`,{"aria-label":`Test SSH connection`,className:`flex flex-col gap-1`,onSubmit:u,children:[(0,I.jsx)(`label`,{htmlFor:s,className:`text-xs font-medium`,children:`SSH host`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`input`,{id:s,className:J,value:i,placeholder:`devbox`,autoComplete:`off`,spellCheck:!1,onChange:e=>{a(e.target.value),o.reset()}}),(0,I.jsx)(p,{type:`submit`,size:`sm`,variant:`outline`,disabled:i.trim()===``||o.isPending,children:o.isPending?`Testing...`:`Test connection`})]})]}),o.isError&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Could not test the connection: `,o.error.message]}),o.data?.problem&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.data.problem}),o.data?.gitVersion&&(0,I.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Connected to `,o.variables,` without a prompt and found `,o.data.gitVersion,`. Run the command below to save it in herdr.`]}),(0,I.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,I.jsx)(`code`,{className:`max-w-full rounded bg-muted px-1.5 py-1 text-xs`,"aria-label":`Add machine command`,children:c}),(0,I.jsx)(p,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void d(),children:`Copy command`})]}),n&&(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:n})]})}var ke=[`Source`,`Completion`,`Runner`,`Details`],Ae={none:`A folder without git. Tasks get no branch, worktree, or pull request.`,local_git:`A git repository without GitHub. Task branches merge locally.`,github:`A git repository with a GitHub origin. Tasks ship as pull requests.`},je={open:`The folder already holds the repository.`,init:`Make a folder a new git repository without a remote.`,clone:`Clone a repository URL into a new folder.`},Me={manual:`When its criteria are met; nothing is merged.`,local_merge:`Once its branch is merged into the base branch locally.`,pr_merge:`Once its pull request is merged into the base branch.`},Ne=`https://github.com/dev-bokdong/toodo/blob/main/docs/runners.md`,Pe={herdr:`Opens agents in herdr on a worktree and branch of the task.`,plain:`Runs Claude or Codex in the background in a worktree and branch of the task, without herdr.`,tmux:`Runs Claude or Codex in a tmux session in a worktree and branch of the task, without herdr.`,none:`Only marks the task in progress.`};function Fe(e){return e?`herdr is not running on this server; start it there before starting tasks, or choose ${K.plain}.`:`herdr is not running on this server since it is not installed there; install and start herdr before starting tasks, or choose ${K.plain}.`}var Ie={clone:{submit:`Clone workspace`,pending:`Cloning...`},open:{submit:`Open workspace`,pending:`Opening...`},init:{submit:`Init workspace`,pending:`Initializing...`},none:{submit:`Add workspace`,pending:`Adding...`}};function $({legend:e,value:t,choices:n,onChange:r,autoFocus:a=!1}){let o=(0,F.useId)();return(0,I.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,I.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:e}),n.map(e=>{let n=e.value===t,s=e.problem!==null,c=s?null:e.note??null,l=`${o}-${e.value}`;return(0,I.jsxs)(`label`,{className:i(`flex items-start gap-2.5 rounded-lg border px-3 py-2 transition-colors has-focus-visible:border-ring has-focus-visible:ring-3 has-focus-visible:ring-ring/50`,s?`cursor-not-allowed border-dashed`:`cursor-pointer hover:bg-muted`,n&&`border-ring bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:s,autoFocus:a&&n,"aria-labelledby":l,"aria-describedby":c===null?`${l}-about`:`${l}-about ${l}-note`,onChange:()=>!s&&r(e.value),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{id:l,className:i(`text-sm font-medium`,s&&`text-muted-foreground`),children:e.label}),(0,I.jsxs)(`span`,{id:`${l}-about`,className:`flex items-start gap-1 text-xs text-muted-foreground`,children:[s&&(0,I.jsx)(b,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),e.problem??e.description]}),c!==null&&(0,I.jsxs)(`span`,{id:`${l}-note`,className:i(`flex items-start gap-1 text-xs`,f.attention),children:[(0,I.jsx)(M,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),c]})]})]},e.value)})]})}function Le({machine:e,onCreated:t,onClose:n}){let r=c(),a=(0,F.useRef)(null),o=(0,F.useId)(),[s,l]=(0,F.useState)(0),[u,f]=(0,F.useState)({source:`github`,repository:null,completion:null,runner:null}),[h,g]=(0,F.useState)(``),[_,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(null),[x,C]=(0,F.useState)(``),T=e??`Local`,E=e===null?{kind:`local`}:{kind:`ssh`,label:e},D=d().data?.herdr,O=e===null&&D!==void 0&&!D.running?Fe(D.installed):null,k=O!==null,A=me(u,k),j=A.repository===`clone`,M=m(E).data,N=M===void 0?``:j?M:Se(M),L=_??N,R=!j&&_===null,z=y??(j?we(h):R?``:Ce(L)),B=j&&L.trim()&&z.trim()?H(L.trim(),z.trim()):te(L.trim()),V=s===ke.length-1,U=r.isPending,q=Ie[A.repository??`none`],ce=[W[A.source],G[A.completion],K[A.runner],T],le=j?void 0:A.source===`none`?`The folder the tasks are about. Toodo runs no git or herdr there.`:`The repository's own folder.`;function J(e){let t=he(u,e,k);me(t,k).repository===`clone`!==j&&v(null),f(t)}function Y(e){l(e)}function X(){U||n()}function ge(n){if(n.preventDefault(),!V){Y(s+1);return}let i={name:z,location:e===null?{kind:`local`,path:B}:{kind:`ssh`,machine:e,path:B},repository:A.repository===null?null:A.repository===`clone`?{kind:`clone`,url:h}:{kind:A.repository},source:A.source,completion:A.completion,runner:A.runner,defaultBaseBranch:A.source===`none`?null:x.trim()||null};r.mutate(i,{onSuccess:t})}return(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-0 bg-black/40 max-md:hidden`,onClick:X}),(0,I.jsx)(`div`,{ref:a,role:`dialog`,"aria-modal":!0,"aria-labelledby":o,onKeyDown:e=>{e.key===`Tab`?ee(a.current,e.nativeEvent):Q(n,U)(e)},className:i(`relative flex flex-col overflow-hidden bg-background text-foreground`,`max-md:h-full max-md:pt-[env(safe-area-inset-top)] max-md:pb-[env(safe-area-inset-bottom)]`,`md:absolute md:top-1/2 md:left-1/2 md:h-[min(40rem,calc(100dvh-4rem))] md:w-[min(36rem,calc(100vw-4rem))] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl md:border md:shadow-xl`),children:(0,I.jsxs)(`form`,{onSubmit:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pt-3 pb-2 md:px-6 md:pt-4`,children:[(0,I.jsxs)(`h2`,{id:o,className:`min-w-0 flex-1 truncate text-base font-semibold`,children:[`New workspace on `,T]}),(0,I.jsx)(p,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close new workspace`,title:`Close (Esc)`,disabled:U,onClick:X,children:(0,I.jsx)(P,{})})]}),(0,I.jsx)(`ol`,{"aria-label":`Steps`,className:`grid shrink-0 grid-cols-2 gap-1 px-4 pb-3 md:grid-cols-4 md:px-6`,children:ke.map((e,t)=>{let n=t===s;return(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsxs)(`button`,{type:`button`,"aria-current":n?`step`:void 0,disabled:U,onClick:()=>Y(t),className:i(`flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none`,n&&`bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:i(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs font-medium`,n?`border-primary bg-primary text-primary-foreground`:`text-muted-foreground`),children:t+1}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ce[t]})]})]})},e)})}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain border-t px-4 py-4 md:px-6`,children:[s===0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)($,{legend:`What does the workspace folder hold?`,value:A.source,autoFocus:!0,choices:re.map(e=>({value:e,label:W[e],description:Ae[e],problem:null})),onChange:e=>J({source:e})}),A.source!==`none`&&(0,I.jsx)($,{legend:`How does the repository get there?`,value:A.repository,choices:oe.map(e=>({value:e,label:se[e],description:je[e],problem:pe(A.source,e)})),onChange:e=>J({repository:e})})]}),s===1&&(0,I.jsx)($,{legend:`When is a task done?`,value:A.completion,autoFocus:!0,choices:ie.map(e=>({value:e,label:G[e],description:Me[e],problem:ue(A.source,e)})),onChange:e=>J({completion:e})}),s===2&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)($,{legend:`What does starting a task do?`,value:A.runner,autoFocus:!0,choices:ae.map(t=>({value:t,label:K[t],description:Pe[t],note:t===`herdr`?O:null,problem:fe(t,{kind:e===null?`local`:`ssh`,path:B})??de(A.source,A.completion,t)})),onChange:e=>J({runner:e})}),(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Which one fits?`,` `,(0,I.jsx)(`a`,{href:Ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline underline-offset-2 hover:no-underline`,children:`Compare the runners`})]})]}),V&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[j&&(0,I.jsx)(Z,{label:`Repository URL`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`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`,value:h,onChange:e=>g(e.target.value),required:!0,autoFocus:!0})}),(0,I.jsx)(Z,{label:j?`Parent folder`:`Folder`,help:le,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:E,className:`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`,describedBy:t,value:L,onChange:v,required:!0,autoFocus:!j})}),(0,I.jsx)(Z,{label:`Name`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`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`,value:z,onChange:e=>b(e.target.value),required:!0})}),j&&L.trim()&&z.trim()&&(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,title:B,children:[`Clones into `,B]}),A.repository===`init`&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The folder is created if it does not exist and becomes a git repository without a remote.`}),A.source!==`none`&&(0,I.jsx)(Z,{label:`Base branch`,help:A.repository===`init`?`Uses main if empty.`:`Detected from the repository if empty.`,children:({id:e,describedBy:t})=>(0,I.jsx)(`input`,{id:e,className:`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`,"aria-describedby":t,value:x,onChange:e=>C(e.target.value)})}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:r.error.message})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t px-4 py-3 md:px-6`,children:[s===0?(0,I.jsx)(p,{type:`button`,variant:`ghost`,disabled:U,onClick:X,children:`Cancel`}):(0,I.jsxs)(p,{type:`button`,variant:`ghost`,disabled:U,onClick:()=>Y(s-1),children:[(0,I.jsx)(w,{"data-icon":`inline-start`}),`Back`]}),(0,I.jsx)(p,{type:`submit`,className:`ml-auto`,changesData:V,disabled:U||V&&R,children:V?U?q.pending:q.submit:(0,I.jsxs)(I.Fragment,{children:[`Next`,(0,I.jsx)(S,{"data-icon":`inline-end`})]})})]})]})})]})}export{S as _,Y as a,J as c,B as d,ee as f,w as g,O as h,Te as i,ge as l,M as m,Le as n,X as o,P as p,ve as r,Q as s,De as t,R as u};
|
|
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,G as s,L as c,Pt as l,Vt as u,_t as d,d as f,nn as p,q as m,z as h}from"./status-styles-HqDkXABu.js";import{f as g,g as _,h as v}from"./event-CwtUqkXR.js";var y={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};y.node;var b=t(y),x={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};x.node;var S=t(x),C={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};C.node;var w=t(C),T={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};T.node;var E=t(T),D={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};D.node;var O=t(D),k={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};k.node;var A=t(k),j={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};j.node;var M=t(j),N={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};N.node;var P=t(N),F=r(e(),1),I=n();function ee(e,t){if(e===null)return;let n=[...e.querySelectorAll(`a[href], button, input, select, textarea, summary, [tabindex]`)].filter(e=>!e.matches(`:disabled, [tabindex='-1']`)&&e.getClientRects().length>0);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement,o=a instanceof Node&&e.contains(a);(t.shiftKey?!o||a===r:!o||a===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}function L(e){let t=/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)||e.includes(`\\`)&&!e.includes(`/`),n=t?`\\`:`/`,r=``,i=e,a=t?/^[\\/]{2}[^\\/]+[\\/]+[^\\/]+/.exec(e):null,o=t?/^[a-zA-Z]:([\\/]?)/.exec(e):null;a?(r=`${a[0].replace(/[\\/]+/g,`\\`).replace(/^\\/,`\\\\`)}\\`,i=e.slice(a[0].length)):o?(r=o[0].slice(0,2)+(o[1]?n:``),i=e.slice(o[0].length)):/^[\\/]/.test(e)&&(r=n,i=e.replace(/^[\\/]+/,``));let s=[];for(let e of i.split(t?/[\\/]+/:/\/+/))e!==``&&e!==`.`&&(e===`..`?s.length>0&&s[s.length-1]!==`..`?s.pop():r===``&&s.push(e):s.push(e));return{root:r,separator:n,segments:s}}function R(e){let{root:t,separator:n,segments:r}=L(e),i=t+r.join(n);return i===``?`.`:i}function z(e){return/^[a-zA-Z]:/.test(e)||e.startsWith(`\\\\`)}function B(e,t=2){let{separator:n,segments:r}=L(e);return r.length<=t?R(e):`…${n}${r.slice(-t).join(n)}`}var V=200;function H(e,t){let n=z(e)?`\\`:`/`;return/[\\/]$/.test(e)?`${e}${t}`:`${e}${n}${t}`}function te(e){return e.replace(/(?<=[^\\/:])[\\/]+$/,``)}function U(e,t){let[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function ne({id:e,machine:t,value:n,onChange:r,describedBy:a,required:s,autoFocus:c,className:l}){let[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(-1),m=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`)),h=m<0?null:n.slice(0,m+1),g=n.slice(m+1).toLowerCase(),_=U(h,V),v=o(t,u?_:null),y=u&&h!==null&&_===h,b=y&&v.data?v.data.directories.filter(e=>e.toLowerCase().startsWith(g)):[],x=b.length>0,S=`${e}-folders`,C=t.kind===`local`?`the server`:t.label;function w(e){r(e),p(-1),d(!0)}function T(e){h!==null&&w(`${H(h,e)}${z(h)?`\\`:`/`}`)}function E(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!x){d(!0);return}let t=b.length,n=e.key===`ArrowDown`;p(e=>e<0?n?0:t-1:(e+(n?1:t-1))%t)}else if(e.key===`Enter`){if(!x||f<0)return;e.preventDefault(),T(b[f])}else if(e.key===`Tab`){if(!x||e.shiftKey||f<0&&g===``)return;e.preventDefault(),e.stopPropagation(),T(b[Math.max(f,0)])}else if(e.key===`Escape`){if(!x)return;e.preventDefault(),e.stopPropagation(),d(!1)}}return(0,I.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(`input`,{id:e,role:`combobox`,"aria-expanded":x,"aria-controls":S,"aria-autocomplete":`list`,"aria-activedescendant":x&&f>=0?`${S}-${f}`:void 0,"aria-describedby":a,autoComplete:`off`,spellCheck:!1,className:l,value:n,onChange:e=>w(e.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:E,required:s,autoFocus:c}),x&&(0,I.jsx)(`ul`,{id:S,role:`listbox`,"aria-label":`Folders in ${h}`,className:`absolute top-full right-0 left-0 z-10 mt-1 flex max-h-56 flex-col overflow-y-auto rounded-lg border bg-popover p-1 font-mono text-xs text-popover-foreground shadow-md`,children:b.map((e,t)=>(0,I.jsxs)(`li`,{id:`${S}-${t}`,role:`option`,"aria-selected":t===f,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e),className:i(`cursor-pointer truncate rounded px-1.5 py-1 hover:bg-muted max-md:py-2`,t===f&&`bg-secondary hover:bg-secondary`),children:[e,z(h??``)?`\\`:`/`]},e))}),y&&v.isError&&(0,I.jsxs)(`p`,{role:`status`,className:`mt-1 text-xs break-words text-muted-foreground`,children:[`No suggestions: `,v.error.message,`. Type the path of a folder that exists on `,C,`, ending in a separator, to see its subfolders.`]})]})}var re=[`none`,`local_git`,`github`],ie=[`manual`,`local_merge`,`pr_merge`],ae=[`herdr`,`plain`,`tmux`,`none`],oe=[`open`,`init`,`clone`],W={none:`Plain folder`,local_git:`Local git`,github:`GitHub`},G={manual:`Manual`,local_merge:`Local merge`,pr_merge:`PR merge`},K={none:`No runner`,herdr:`herdr`,plain:`Plain`,tmux:`tmux`},se={open:`Open existing`,init:`New repository`,clone:`Clone URL`};function q(e){return e===`none`?`manual`:e===`local_git`?`local_merge`:`pr_merge`}function ce(e,t=!1){return e===`none`?`none`:t?`plain`:`herdr`}function le(e){return e===`none`?null:`open`}function ue(e,t){switch(t){case`manual`:return null;case`local_merge`:return e===`local_git`?null:e===`none`?`Needs a git repository; choose source Local git`:`GitHub tasks merge through pull requests; choose source Local git`;case`pr_merge`:return e===`github`?null:e===`none`?`Needs a git repository; choose source GitHub`:`Needs a GitHub origin remote; choose source GitHub`}}function de(e,t,n){return n!==`none`&&e===`none`?`Needs a git repository for task worktrees; choose source Local git or GitHub`:n===`none`&&t!==`manual`?`${G[t]} needs the task branch that herdr, ${K.plain}, or ${K.tmux} creates; choose completion Manual`:null}function fe(e,t){return e===`tmux`&&t.kind===`ssh`&&z(t.path)?`Needs a POSIX host; choose ${K.plain} or ${K.herdr} for a Windows SSH workspace, or choose a POSIX path for ${K.tmux}`:null}function pe(e,t){return e===`none`?`A plain folder has no repository; choose source Local git or GitHub`:e===`github`&&t===`init`?`A new repository has no GitHub origin; choose source Local git`:null}function me(e,t=!1){let{source:n}=e,r=e.repository!==null&&pe(n,e.repository)===null?e.repository:le(n),i=e.completion!==null&&ue(n,e.completion)===null?e.completion:q(n);return{source:n,repository:r,completion:i,runner:e.runner!==null&&de(n,i,e.runner)===null?e.runner:ce(n,t)}}function he(e,t,n=!1){let r={...e,...t},i=me(r,n);return{source:r.source,repository:r.repository===i.repository?r.repository:null,completion:r.completion===i.completion?r.completion:null,runner:r.runner===i.runner?r.runner:null}}var J=`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`,Y=`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`;function X(e){let t=R(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}function ge(e){let t=B(e.path);return e.kind===`local`?t:`${e.machine}:${t}`}var _e={foreign:`Windows path, not on this server`,missing:`Folder not found on the server`};function ve({problem:e,className:t}){return(0,I.jsxs)(`span`,{className:i(`flex min-w-0 items-start gap-1 text-xs text-destructive`,t),title:`Toodo cannot run git in this repository until its path is corrected`,children:[(0,I.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,I.jsx)(`span`,{children:_e[e]})]})}function ye({workspace:e}){let t=W[e.source],n=G[e.completion],r=K[e.runner];return(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:`Source ${t}, completion ${n}, runner ${r}; set when the workspace was added`,children:[(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:t}),` · `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:n}),` `,`· `,(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:r})]})}function be(e){return e.kind===`local`?null:e.machine}function xe(e,t){let n=t.filter(t=>t.target===e);return n.length===0?`Not saved in herdr`:n.some(e=>e.enabled)?null:`Disabled in herdr`}function Se(e){return/[\\/]$/.test(e)?e:H(e,``)}function Z({label:e,help:t,children:n}){let r=(0,F.useId)(),i=`${r}-help`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`label`,{htmlFor:r,className:`text-xs text-muted-foreground`,children:e}),n({id:r,describedBy:t?i:void 0}),t&&(0,I.jsx)(`p`,{id:i,className:`text-xs text-muted-foreground`,children:t})]})}function Ce(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()??``}function we(e){return Ce(e.trim().replace(/\.git$/,``)).split(`:`).pop()??``}function Te({selectedId:e,onSelect:t}){let n=u(),r=(0,F.useSyncExternalStore)(v,g),i=r===`unreachable`||r===`retrying`,a=s(),o=d().data?.herdr.installed===!1,[c,l]=(0,F.useState)(null),f=(0,F.useRef)(null),m=()=>{l(null),f.current?.focus()},[h,y]=(0,F.useState)(!1),b=a.data??[],x=[null,...new Set([...b.map(e=>e.target),...(n.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])];return(0,I.jsxs)(`section`,{"aria-labelledby":`workspaces-heading`,className:`flex shrink-0 flex-col gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{id:`workspaces-heading`,className:`text-xs font-medium uppercase text-muted-foreground`,children:`Workspaces`}),(0,I.jsxs)(p,{variant:`ghost`,size:`xs`,onClick:()=>y(e=>!e),children:[!h&&(0,I.jsx)(O,{}),h?`Cancel`:`Add machine`]})]}),h&&(0,I.jsx)(Oe,{herdrMissing:o,onClose:()=>y(!1)}),a.isError&&(o?(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`herdr is not installed on this server, so there are no SSH machines; workspaces on Local can use runner`,` `,K.plain,`.`]}):(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to list herdr machines: `,a.error.message]})),n.isPending&&!i&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces...`}),(n.isError||n.isPending&&i)&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[(0,I.jsxs)(`p`,{children:[`Failed to load workspaces:`,` `,n.error?.message??(_()||`The Toodo server does not answer.`)]}),(0,I.jsx)(p,{size:`xs`,variant:`outline`,onClick:()=>void n.refetch(),children:`Retry now`})]}),n.data?.length===0&&c===null&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workspaces yet.`}),(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.data&&x.map(r=>{let i=r??`Local`,o=n.data.filter(e=>be(e.location)===r),s=r!==null&&a.isSuccess?xe(r,b):null;return(0,I.jsxs)(`section`,{"aria-label":`Machine ${i}`,className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsxs)(`h3`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-1 text-xs font-semibold`,children:[r===null?(0,I.jsx)(E,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(A,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate`,children:i}),s&&(0,I.jsx)(`span`,{className:`ml-1.5 font-normal text-destructive`,children:s})]}),(0,I.jsxs)(p,{size:`xs`,variant:`outline`,"aria-label":`Add workspace on ${i}`,title:`Add a workspace on this machine`,"aria-haspopup":`dialog`,"aria-expanded":c!==null&&c.machine===r,onClick:e=>{f.current=e.currentTarget,l({machine:r})},children:[(0,I.jsx)(O,{}),`Add`]})]}),o.length>0&&(0,I.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(n=>(0,I.jsx)(Ee,{workspace:n,selected:n.id===e,onSelect:t},n.id))})]},i)})}),c&&(0,I.jsx)(Le,{machine:c.machine,onCreated:e=>{m(),t(e.id)},onClose:m})]})}function Ee({workspace:e,selected:t,onSelect:n}){let r=h(),[a,o]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:i(`group flex items-center rounded-lg hover:bg-sidebar-accent`,t&&`bg-sidebar-accent`),children:[(0,I.jsxs)(`button`,{type:`button`,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:`flex min-w-0 flex-1 flex-col px-2.5 py-1.5 text-left`,children:[(0,I.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:X(e.location),children:B(e.location.path)}),(0,I.jsx)(ye,{workspace:e}),e.pathProblem&&(0,I.jsx)(ve,{problem:e.pathProblem})]}),!a&&(0,I.jsx)(p,{size:`icon-xs`,variant:`ghost`,"aria-label":`Remove ${e.name}`,title:`Move the workspace and its tasks to the archive`,className:`mr-1 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,onClick:()=>{r.reset(),o(!0)},children:(0,I.jsx)(P,{})})]}),a&&(0,I.jsxs)(`div`,{role:`group`,"aria-label":`Remove ${e.name}`,className:`flex flex-col gap-1.5 rounded-lg border p-2`,onKeyDown:e=>{e.key===`Escape`&&!r.isPending&&(e.preventDefault(),o(!1))},children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Remove `,e.name,` and its tasks from Toodo? They move to Settings > Archive, where they can be restored. The repository, worktrees, and herdr workspaces are kept.`]}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(p,{changesData:!0,size:`xs`,variant:`destructive`,"aria-label":`Confirm remove ${e.name}`,disabled:r.isPending,onClick:()=>r.mutate(e.id),children:r.isPending?`Removing...`:`Remove`}),(0,I.jsx)(p,{size:`xs`,variant:`ghost`,autoFocus:!0,onClick:()=>o(!1),children:`Back`})]})]})]})}function Q(e,t=!1){return n=>{n.key===`Escape`&&!t&&!n.defaultPrevented&&(n.preventDefault(),e())}}function De({workspace:e,onClose:t}){let n=a(),r=s(),i=u(),[o,c]=(0,F.useState)(be(e.location)),[l,d]=(0,F.useState)(e.location.path),f=[...new Set([...(r.data??[]).map(e=>e.target),...(i.data??[]).flatMap(e=>e.location.kind===`ssh`?[e.location.machine]:[])])],m=te(l.trim());function h(r){r.preventDefault();let i=o===null?{kind:`local`,path:m}:{kind:`ssh`,machine:o,path:m};n.mutate({id:e.id,location:i},{onSuccess:t})}return(0,I.jsxs)(`form`,{onSubmit:h,"aria-label":`Move ${e.name}`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t,n.isPending),children:[(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Point the workspace at the same repository on another machine or in another folder. Its tasks stay. A repository on a Windows host takes a Windows path such as D:\\dev\\repo.`}),(0,I.jsx)(Z,{label:`Machine`,children:({id:e})=>(0,I.jsxs)(`select`,{id:e,className:J,value:o??``,onChange:e=>c(e.target.value===``?null:e.target.value),autoFocus:!0,children:[(0,I.jsx)(`option`,{value:``,children:`Local (this server)`}),f.map(e=>(0,I.jsx)(`option`,{value:e,children:e},e))]})}),(0,I.jsx)(Z,{label:`Folder`,help:`The repository's own folder on that machine.`,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:o===null?{kind:`local`}:{kind:`ssh`,label:o},className:J,describedBy:t,value:l,onChange:d,required:!0})}),n.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:n.error.message}),(0,I.jsxs)(`div`,{className:`flex gap-1`,children:[(0,I.jsx)(p,{type:`submit`,size:`sm`,disabled:n.isPending||m===``,children:n.isPending?`Moving...`:`Move workspace`}),(0,I.jsx)(p,{type:`button`,size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:t,children:`Cancel`})]})]})}function Oe({herdrMissing:e,onClose:t}){let[n,r]=(0,F.useState)(null),[i,a]=(0,F.useState)(``),o=l(),s=(0,F.useId)(),c=`herdr machine add ${i.trim()||`<host>`}`;function u(e){e.preventDefault(),i.trim()!==``&&o.mutate(i.trim())}async function d(){try{await navigator.clipboard.writeText(c),r(`Copied the command.`)}catch(e){r(`Could not copy: ${String(e)}`)}}return(0,I.jsxs)(`section`,{"aria-label":`Add machine`,className:`flex flex-col gap-2 rounded-lg border p-2`,onKeyDown:Q(t),children:[(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e&&`Install herdr on the server first; SSH machines need it. `,`Enter an SSH host from the server's ~/.ssh/config and test the connection. herdr asks questions in a terminal, which the Toodo server cannot open, so then run the command below in a terminal on the server and reload the machine list here.`]}),(0,I.jsxs)(`form`,{"aria-label":`Test SSH connection`,className:`flex flex-col gap-1`,onSubmit:u,children:[(0,I.jsx)(`label`,{htmlFor:s,className:`text-xs font-medium`,children:`SSH host`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`input`,{id:s,className:J,value:i,placeholder:`devbox`,autoComplete:`off`,spellCheck:!1,onChange:e=>{a(e.target.value),o.reset()}}),(0,I.jsx)(p,{type:`submit`,size:`sm`,variant:`outline`,disabled:i.trim()===``||o.isPending,children:o.isPending?`Testing...`:`Test connection`})]})]}),o.isError&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Could not test the connection: `,o.error.message]}),o.data?.problem&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.data.problem}),o.data?.gitVersion&&(0,I.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Connected to `,o.variables,` without a prompt and found `,o.data.gitVersion,`. Run the command below to save it in herdr.`]}),(0,I.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,I.jsx)(`code`,{className:`max-w-full rounded bg-muted px-1.5 py-1 text-xs`,"aria-label":`Add machine command`,children:c}),(0,I.jsx)(p,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void d(),children:`Copy command`})]}),n&&(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:n})]})}var ke=[`Source`,`Completion`,`Runner`,`Details`],Ae={none:`A folder without git. Tasks get no branch, worktree, or pull request.`,local_git:`A git repository without GitHub. Task branches merge locally.`,github:`A git repository with a GitHub origin. Tasks ship as pull requests.`},je={open:`The folder already holds the repository.`,init:`Make a folder a new git repository without a remote.`,clone:`Clone a repository URL into a new folder.`},Me={manual:`When its criteria are met; nothing is merged.`,local_merge:`Once its branch is merged into the base branch locally.`,pr_merge:`Once its pull request is merged into the base branch.`},Ne=`https://github.com/dev-bokdong/toodo/blob/main/docs/runners.md`,Pe={herdr:`Opens agents in herdr on a worktree and branch of the task.`,plain:`Runs Claude or Codex in the background in a worktree and branch of the task, without herdr.`,tmux:`Runs Claude or Codex in a tmux session in a worktree and branch of the task, without herdr.`,none:`Only marks the task in progress.`};function Fe(e){return e?`herdr is not running on this server; start it there before starting tasks, or choose ${K.plain}.`:`herdr is not running on this server since it is not installed there; install and start herdr before starting tasks, or choose ${K.plain}.`}var Ie={clone:{submit:`Clone workspace`,pending:`Cloning...`},open:{submit:`Open workspace`,pending:`Opening...`},init:{submit:`Init workspace`,pending:`Initializing...`},none:{submit:`Add workspace`,pending:`Adding...`}};function $({legend:e,value:t,choices:n,onChange:r,autoFocus:a=!1}){let o=(0,F.useId)();return(0,I.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,I.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:e}),n.map(e=>{let n=e.value===t,s=e.problem!==null,c=s?null:e.note??null,l=`${o}-${e.value}`;return(0,I.jsxs)(`label`,{className:i(`flex items-start gap-2.5 rounded-lg border px-3 py-2 transition-colors has-focus-visible:border-ring has-focus-visible:ring-3 has-focus-visible:ring-ring/50`,s?`cursor-not-allowed border-dashed`:`cursor-pointer hover:bg-muted`,n&&`border-ring bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:s,autoFocus:a&&n,"aria-labelledby":l,"aria-describedby":c===null?`${l}-about`:`${l}-about ${l}-note`,onChange:()=>!s&&r(e.value),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{id:l,className:i(`text-sm font-medium`,s&&`text-muted-foreground`),children:e.label}),(0,I.jsxs)(`span`,{id:`${l}-about`,className:`flex items-start gap-1 text-xs text-muted-foreground`,children:[s&&(0,I.jsx)(b,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),e.problem??e.description]}),c!==null&&(0,I.jsxs)(`span`,{id:`${l}-note`,className:i(`flex items-start gap-1 text-xs`,f.attention),children:[(0,I.jsx)(M,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}),c]})]})]},e.value)})]})}function Le({machine:e,onCreated:t,onClose:n}){let r=c(),a=(0,F.useRef)(null),o=(0,F.useId)(),[s,l]=(0,F.useState)(0),[u,f]=(0,F.useState)({source:`github`,repository:null,completion:null,runner:null}),[h,g]=(0,F.useState)(``),[_,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(null),[x,C]=(0,F.useState)(``),T=e??`Local`,E=e===null?{kind:`local`}:{kind:`ssh`,label:e},D=d().data?.herdr,O=e===null&&D!==void 0&&!D.running?Fe(D.installed):null,k=O!==null,A=me(u,k),j=A.repository===`clone`,M=m(E).data,N=M===void 0?``:j?M:Se(M),L=_??N,R=!j&&_===null,z=y??(j?we(h):R?``:Ce(L)),B=j&&L.trim()&&z.trim()?H(L.trim(),z.trim()):te(L.trim()),V=s===ke.length-1,U=r.isPending,q=Ie[A.repository??`none`],ce=[W[A.source],G[A.completion],K[A.runner],T],le=j?void 0:A.source===`none`?`The folder the tasks are about. Toodo runs no git or herdr there.`:`The repository's own folder.`;function J(e){let t=he(u,e,k);me(t,k).repository===`clone`!==j&&v(null),f(t)}function Y(e){l(e)}function X(){U||n()}function ge(n){if(n.preventDefault(),!V){Y(s+1);return}let i={name:z,location:e===null?{kind:`local`,path:B}:{kind:`ssh`,machine:e,path:B},repository:A.repository===null?null:A.repository===`clone`?{kind:`clone`,url:h}:{kind:A.repository},source:A.source,completion:A.completion,runner:A.runner,defaultBaseBranch:A.source===`none`?null:x.trim()||null};r.mutate(i,{onSuccess:t})}return(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-0 bg-black/40 max-md:hidden`,onClick:X}),(0,I.jsx)(`div`,{ref:a,role:`dialog`,"aria-modal":!0,"aria-labelledby":o,onKeyDown:e=>{e.key===`Tab`?ee(a.current,e.nativeEvent):Q(n,U)(e)},className:i(`relative flex flex-col overflow-hidden bg-background text-foreground`,`max-md:h-full max-md:pt-[env(safe-area-inset-top)] max-md:pb-[env(safe-area-inset-bottom)]`,`md:absolute md:top-1/2 md:left-1/2 md:h-[min(40rem,calc(100dvh-4rem))] md:w-[min(36rem,calc(100vw-4rem))] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl md:border md:shadow-xl`),children:(0,I.jsxs)(`form`,{onSubmit:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pt-3 pb-2 md:px-6 md:pt-4`,children:[(0,I.jsxs)(`h2`,{id:o,className:`min-w-0 flex-1 truncate text-base font-semibold`,children:[`New workspace on `,T]}),(0,I.jsx)(p,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close new workspace`,title:`Close (Esc)`,disabled:U,onClick:X,children:(0,I.jsx)(P,{})})]}),(0,I.jsx)(`ol`,{"aria-label":`Steps`,className:`grid shrink-0 grid-cols-2 gap-1 px-4 pb-3 md:grid-cols-4 md:px-6`,children:ke.map((e,t)=>{let n=t===s;return(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsxs)(`button`,{type:`button`,"aria-current":n?`step`:void 0,disabled:U,onClick:()=>Y(t),className:i(`flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none`,n&&`bg-secondary hover:bg-secondary`),children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:i(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs font-medium`,n?`border-primary bg-primary text-primary-foreground`:`text-muted-foreground`),children:t+1}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ce[t]})]})]})},e)})}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain border-t px-4 py-4 md:px-6`,children:[s===0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)($,{legend:`What does the workspace folder hold?`,value:A.source,autoFocus:!0,choices:re.map(e=>({value:e,label:W[e],description:Ae[e],problem:null})),onChange:e=>J({source:e})}),A.source!==`none`&&(0,I.jsx)($,{legend:`How does the repository get there?`,value:A.repository,choices:oe.map(e=>({value:e,label:se[e],description:je[e],problem:pe(A.source,e)})),onChange:e=>J({repository:e})})]}),s===1&&(0,I.jsx)($,{legend:`When is a task done?`,value:A.completion,autoFocus:!0,choices:ie.map(e=>({value:e,label:G[e],description:Me[e],problem:ue(A.source,e)})),onChange:e=>J({completion:e})}),s===2&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)($,{legend:`What does starting a task do?`,value:A.runner,autoFocus:!0,choices:ae.map(t=>({value:t,label:K[t],description:Pe[t],note:t===`herdr`?O:null,problem:fe(t,{kind:e===null?`local`:`ssh`,path:B})??de(A.source,A.completion,t)})),onChange:e=>J({runner:e})}),(0,I.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Which one fits?`,` `,(0,I.jsx)(`a`,{href:Ne,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline underline-offset-2 hover:no-underline`,children:`Compare the runners`})]})]}),V&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[j&&(0,I.jsx)(Z,{label:`Repository URL`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`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`,value:h,onChange:e=>g(e.target.value),required:!0,autoFocus:!0})}),(0,I.jsx)(Z,{label:j?`Parent folder`:`Folder`,help:le,children:({id:e,describedBy:t})=>(0,I.jsx)(ne,{id:e,machine:E,className:`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`,describedBy:t,value:L,onChange:v,required:!0,autoFocus:!j})}),(0,I.jsx)(Z,{label:`Name`,children:({id:e})=>(0,I.jsx)(`input`,{id:e,className:`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`,value:z,onChange:e=>b(e.target.value),required:!0})}),j&&L.trim()&&z.trim()&&(0,I.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,title:B,children:[`Clones into `,B]}),A.repository===`init`&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The folder is created if it does not exist and becomes a git repository without a remote.`}),A.source!==`none`&&(0,I.jsx)(Z,{label:`Base branch`,help:A.repository===`init`?`Uses main if empty.`:`Detected from the repository if empty.`,children:({id:e,describedBy:t})=>(0,I.jsx)(`input`,{id:e,className:`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`,"aria-describedby":t,value:x,onChange:e=>C(e.target.value)})}),r.isError&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs break-words text-destructive`,children:r.error.message})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t px-4 py-3 md:px-6`,children:[s===0?(0,I.jsx)(p,{type:`button`,variant:`ghost`,disabled:U,onClick:X,children:`Cancel`}):(0,I.jsxs)(p,{type:`button`,variant:`ghost`,disabled:U,onClick:()=>Y(s-1),children:[(0,I.jsx)(w,{"data-icon":`inline-start`}),`Back`]}),(0,I.jsx)(p,{type:`submit`,className:`ml-auto`,changesData:V,disabled:U||V&&R,children:V?U?q.pending:q.submit:(0,I.jsxs)(I.Fragment,{children:[`Next`,(0,I.jsx)(S,{"data-icon":`inline-end`})]})})]})]})})]})}export{S as _,Y as a,J as c,B as d,ee as f,w as g,O as h,Te as i,ge as l,M as m,Le as n,X as o,P as p,ve as r,Q as s,De as t,R as u};
|
package/web/index.html
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
|
|
9
9
|
<meta name="theme-color" content="#0a0a0a" media="(prefers-color-scheme: dark)" />
|
|
10
10
|
<title>Toodo</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-CA6XfQF_.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/dist-ZmB2kPfR.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/event-CwtUqkXR.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/status-styles-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/workspace-list-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/status-styles-HqDkXABu.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/workspace-list-BKokJOU3.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-BGPTeYT3.css">
|
|
17
17
|
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials">
|
|
18
18
|
<link rel="apple-touch-icon" href="/pwa/apple-touch-icon.png">
|
package/web/sw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by vite-pwa.ts for this build.
|
|
2
|
-
const CACHE = "toodo-shell-
|
|
3
|
-
const SHELL = ["/","/assets/details-sheet-
|
|
2
|
+
const CACHE = "toodo-shell-4072ec85b2f54344";
|
|
3
|
+
const SHELL = ["/","/assets/details-sheet-C66cuNM0.js","/assets/dist-ZmB2kPfR.js","/assets/event-CwtUqkXR.js","/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2","/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2","/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2","/assets/geist-latin-wght-normal-BgDaEnEv.woff2","/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2","/assets/index-BGPTeYT3.css","/assets/index-CA6XfQF_.js","/assets/markdown-D0-9L3kk.js","/assets/offline-screen-But1V_BX.js","/assets/opener-DWhHPoCL.js","/assets/review-Cr_Fn4ZM.js","/assets/server-access-CGxnevaj.js","/assets/status-styles-HqDkXABu.js","/assets/task-details-DIx92WqK.js","/assets/task-graph-CawZ2SR-.js","/assets/task-graph-DLioOiRN.css","/assets/workspace-list-BKokJOU3.js","/favicon.svg","/manifest.webmanifest","/pwa/apple-touch-icon.png","/pwa/icon-192.png","/pwa/icon-512.png","/pwa/icon-maskable-192.png","/pwa/icon-maskable-512.png"];
|
|
4
4
|
const SERVER_PATHS = ["/api","/mcp"];
|
|
5
5
|
const NOTIFICATION_ICON = "/pwa/icon-192.png";
|
|
6
6
|
// The message that asks an open page to show a task; see listenForOpenTask in src/web/push.ts.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,s as r,t as i}from"./dist-ZmB2kPfR.js";import{C as a,S as o,Vt as ee,d as s,ht as c,nn as l,o as u,s as d}from"./status-styles-DLZB0S-A.js";import{_ as te,c as f,g as p}from"./workspace-list-CbAQLx7f.js";import{A as m,At as h,B as g,C as _,D as v,E as ne,F as re,I as ie,L as y,M as b,N as x,O as S,P as ae,R as C,S as w,St as T,T as E,U as D,V as O,Y as k,_ as A,b as j,bt as M,g as oe,h as N,j as P,k as se,m as F,p as I,s as L,v as R,w as z,x as B,y as V,z as H}from"./index-CEjVLKaZ.js";import{t as U}from"./opener-DWhHPoCL.js";var W={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`}]]};W.node;var G=t(W),K=r(e(),1),q=n(),ce={completed:s.success,opened_for_review:s.review,started:s.progress,worked_on:s.progress,planned:s.neutral},J=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,u.neutral),le=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function ue(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 de({disabled:e,children:t}){let[n,r]=(0,K.useState)(!1),i=(0,K.useRef)(null);return(0,K.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,q.jsxs)(`div`,{ref:i,className:`relative`,children:[(0,q.jsxs)(l,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":n,disabled:e,onClick:()=>r(!n),children:[(0,q.jsx)(h,{}),(0,q.jsx)(`span`,{className:`max-md:sr-only`,children:`Export`})]}),n&&(0,q.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 Y(e,t){return`${e} ${t}${e===1?``:`s`}`}function fe(e,t){let n=e.skipped>0?` Left out ${Y(e.skipped,`pull request`)} a task already records.`:``;return e.imported===0?`Found no new pull requests you merged in this ${t}.${n}`:`Imported ${Y(e.imported,`merged pull request`)} as done tasks.${n}`}function X({onSelect:e,children:t}){return(0,q.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 Z({onShowTask:e}){let[t,n]=(0,K.useState)(()=>v(`week`,T(Date.now()/1e3))),[r,s]=(0,K.useState)(null),[d,h]=(0,K.useState)(z),{start:_,end:b}=ne(t),x=c(_,b),O=ee(),A=o(),j=a(),[N,P]=(0,K.useState)([]),F=O.data?.some(e=>e.source===`github`)??!1,R=[...O.data??[],...A.data?.workspaces??[]],B=new Map(R.map(e=>[e.id,e.name])),V=x.data&&oe(x.data,d),H=ie(x.data??[]);d.label!==null&&!H.includes(d.label)&&H.push(d.label);let U=[d.workspaceId===null?`across all workspaces`:`in ${B.get(d.workspaceId)??`workspace ${d.workspaceId}`}`,d.label!==null&&`labelled ${d.label}`].filter(Boolean).join(`, `),W=se[t.kind];function Y(e){s(null),P([]),n(e)}async function Z(){s(null),P([]);try{let e=await j.mutateAsync({start:_,end:b});s(fe(e,W)),P(e.failures)}catch(e){s(`Could not import pull requests: ${e instanceof Error?e.message:String(e)}`)}}function ge(e){e!==t.kind&&Y(e===`custom`?{...t,kind:e}:v(e,t.from))}async function _e(e){try{await navigator.clipboard.writeText(y(t,e,R,Date.now()/1e3)),s(`Copied as Markdown.`)}catch(e){s(`Could not copy: ${String(e)}`)}}function $(e,n){let r=e===`csv`?ae(n,R,Date.now()/1e3):y(t,n,R,Date.now()/1e3),i=re(t,e);ue(i,r,e===`csv`?`text/csv`:`text/markdown`),s(`Downloaded ${i}`)}return(0,q.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:m[t.kind]}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,t.from,` to `,t.to,` `,U,`.`]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsx)(`div`,{role:`group`,"aria-label":`Review period`,className:`flex rounded-md border p-0.5 max-md:w-full`,children:le.map(({kind:e,label:n})=>(0,q.jsx)(l,{size:`sm`,variant:t.kind===e?`default`:`ghost`,"aria-pressed":t.kind===e,onClick:()=>ge(e),children:n},e))}),t.kind===`week`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`label`,{htmlFor:`week-start`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`Week starting`}),(0,q.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&&Y(g(e.target.value))})]}),t.kind===`custom`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`label`,{htmlFor:`review-from`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`From`}),(0,q.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&&Y({...t,from:e.target.value})}),(0,q.jsx)(`label`,{htmlFor:`review-to`,className:`text-xs text-muted-foreground max-md:sr-only`,children:`To`}),(0,q.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&&Y({...t,to:e.target.value})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,q.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:S(t)}),(0,q.jsx)(l,{size:`icon-sm`,variant:`outline`,"aria-label":`Previous ${W}`,title:`Previous ${W}`,onClick:()=>Y(C(t,-1)),children:(0,q.jsx)(p,{})}),(0,q.jsx)(l,{size:`icon-sm`,variant:`outline`,"aria-label":`Next ${W}`,title:`Next ${W}`,onClick:()=>Y(C(t,1)),children:(0,q.jsx)(te,{})}),t.kind!==`custom`&&(0,q.jsxs)(l,{size:`sm`,variant:`ghost`,onClick:()=>Y(v(t.kind,T(Date.now()/1e3))),children:[(0,q.jsx)(G,{className:`md:hidden`,"aria-hidden":!0}),(0,q.jsxs)(`span`,{className:`max-md:sr-only`,children:[`This `,W]})]}),(0,q.jsx)(`div`,{className:`ml-auto`,children:(0,q.jsx)(de,{disabled:!V,children:e=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(X,{onSelect:()=>{e(),V&&_e(V)},children:`Copy as Markdown`}),(0,q.jsx)(X,{onSelect:()=>{e(),V&&$(`md`,V)},children:`Save as Markdown`}),(0,q.jsx)(X,{onSelect:()=>{e(),V&&$(`csv`,V)},children:`Save as CSV`}),(0,q.jsx)(X,{onSelect:()=>{e(),window.print()},children:`Print or save as PDF`})]})})})]}),(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsxs)(`select`,{"aria-label":`Workspace`,className:i(f,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.workspaceId??``,onChange:e=>h({...d,workspaceId:e.target.value===``?null:Number(e.target.value)}),children:[(0,q.jsx)(`option`,{value:``,children:`All workspaces`}),R.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,q.jsxs)(`select`,{"aria-label":`Label`,className:i(f,`w-auto max-md:min-w-0 max-md:flex-1`),value:d.label??``,onChange:e=>h({...d,label:e.target.value===``?null:e.target.value}),children:[(0,q.jsx)(`option`,{value:``,children:H.length===0?`No labels in this period`:`Any label`}),H.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))]}),(d.workspaceId!==null||d.label!==null)&&(0,q.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>h(z),children:`Clear filters`})]}),r&&(0,q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:r}),N.length>0&&(0,q.jsx)(`ul`,{role:`alert`,"aria-label":`Pull requests not imported`,className:`text-xs text-destructive print:hidden`,children:N.map(e=>(0,q.jsx)(`li`,{children:e},e))}),(0,q.jsx)(`p`,{role:`status`,className:i(`text-sm text-muted-foreground`,!x.isPending&&`sr-only`),children:x.isPending?`Loading the review...`:V?`Showing ${V.length} ${V.length===1?`task`:`tasks`} with activity in this ${W}.`:``}),x.isError&&(0,q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,x.error.message]}),V?.length===0&&(0,q.jsx)(L,{title:x.data?.length===0?`No recorded activity in this ${W}.`:`No recorded activity in this ${W} matches the filters.`,hint:x.data?.length===0?`Toodo records each task as it is planned, started, opened for review, and completed, with the commits of its branch, so reviews fill up as you work. Work merged before Toodo tracked it is not here: ${F?`import the pull requests you merged in this ${W} to add it.`:`add a workspace with a GitHub repository to import the pull requests you merged.`}`:`Pick another period or change the filters to look at other work.`,action:(0,q.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:[x.data?.length===0&&F&&(0,q.jsx)(l,{size:`sm`,disabled:j.isPending,onClick:()=>void Z(),children:j.isPending?`Importing...`:`Import merged pull requests`}),(0,q.jsxs)(l,{size:`sm`,variant:`outline`,onClick:()=>Y(C(t,-1)),children:[`Show the `,W,` before`]})]})}),V&&V.length>0&&(0,q.jsx)(he,{period:t,entries:V,workspaces:R}),V&&(0,q.jsx)(me,{period:t,entries:V}),t.kind===`year`&&V&&(0,q.jsx)(pe,{entries:V}),V&&w(V).map(t=>(0,q.jsxs)(`section`,{"aria-label":E[t.outcome],className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`h3`,{className:i(`text-sm font-semibold`,ce[t.outcome]),children:[E[t.outcome],` `,(0,q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,q.jsx)(`ul`,{className:`flex flex-col divide-y rounded-lg border`,children:t.entries.map(({task:t,at:n,commits:r,archived:a})=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(D,{type:t.taskType}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,q.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,q.jsx)(`span`,{className:J,children:`Not adopted`}),a&&(0,q.jsx)(`span`,{className:J,children:`Archived`}),t.resolution===`completed`&&(0,q.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,u.success),children:`Completed`}),t.pullRequestUrl&&(0,q.jsx)(Q,{url:t.pullRequestUrl,stats:t.pullRequest}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[B.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,q.jsx)(M,{at:n})]})]}),(0,q.jsx)(k,{task:t}),t.completionNote&&(0,q.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),r.length>0&&(0,q.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${W}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,q.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,q.jsx)(`span`,{className:`truncate`,children:I(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function Q({url:e,stats:t}){let n=b(e),r=t=>{t.preventDefault(),U(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,q.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${x(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 pe({entries:e}){let t=O(e);return t===null?null:(0,q.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,q.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,q.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,title:B(t.pullRequests),children:[t.pullRequests.reviews,(0,q.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,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,q.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(D,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:x(t)})]},e.id))})]}),t.research.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,q.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,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,n?u.success:u.neutral),children:n?`Adopted`:`Not adopted`}),(0,q.jsx)(M,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,q.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,q.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(D,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,V(t),`, `,V(n),` active`]})]},e.id))})]})]})}function me({period:e,entries:t}){let n=P(e,t,Date.now()/1e3);return n===null?null:(0,q.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,q.jsx)(`dd`,{children:n.time?j(n.time):`No completed task had an estimate`})]}),(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,q.jsx)(`dd`,{children:n.dueDates?R(n.dueDates):`No completed task had a due date`})]})]}),n.late.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,q.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:n.late.map(e=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,q.jsx)(D,{type:e.task.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,q.jsx)(`span`,{className:i(`ml-auto shrink-0 text-xs`,s.danger),children:_(e)})]},e.task.id))})]})]})}function he({period:e,entries:t,workspaces:n}){let r=H(e,t,n),a=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,q.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:E[e]}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[F.map(e=>{let t=r[e];return(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:N[e]}),(0,q.jsx)(`dd`,{children:t===null?`No data`:`${V(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,q.jsx)(`dd`,{children:A(r.changes)})]}),r.completedByType.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,q.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,q.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,q.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,q.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,q.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:i(`h-2 rounded-sm`,d.success),style:{width:`${t/a*60}%`,minWidth:t>0?4:0}}),(0,q.jsx)(`span`,{children:t})]},e))})]})]})}export{Z as Review};
|
|
@@ -1,4 +0,0 @@
|
|
|
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,D as o,O as s,b as c,d as l,jt as u,kt as d,lt as f,nn as p,o as m,y as h}from"./status-styles-DLZB0S-A.js";import{p as g}from"./workspace-list-CbAQLx7f.js";import{Ct as _,Dt as v,J as y,K as b,M as x,Mt as S,Nt as C,Ot as ee,Tt as te,X as w,Y as T,Z as E,_t as D,bt as O,c as ne,d as re,f as ie,it as k,kt as A,l as j,nt as M,q as N,u as P,wt as F}from"./index-CEjVLKaZ.js";import{t as I}from"./opener-DWhHPoCL.js";import{t as L}from"./details-sheet-BHRfmUm7.js";var R={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`]};R.node;var z=t(R),B={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};B.node;var V=t(B),H=r(e(),1),U=n();function W({onClose:e,children:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)(!1);function a(){n.current?.querySelector(`form[data-dirty]`)?i(!0):e()}return(0,H.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,U.jsx)(L,{ref:n,width:`min(480px, max(360px, 40vw), calc(100vw - 32px))`,onClose:a,banner:r&&(0,U.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,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Discard your unsaved changes?`}),(0,U.jsx)(p,{size:`xs`,variant:`outline`,autoFocus:!0,onClick:()=>i(!1),children:`Keep editing`}),(0,U.jsx)(p,{size:`xs`,variant:`destructive`,onClick:e,children:`Discard changes`})]}),children:t})}function G({task:e,detailed:t}){let n=te(e.milestones);return n.length===0?null:t?(0,U.jsx)(b,{label:`Timeline`,children:(0,U.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,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(O,{at:t})})]},e))})}):(0,U.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,U.jsx)(O,{at:t,prefix:`${e} `},e))})}function K({taskId:e}){let t=o(e,!0),n=`Base freshness of #${e}`,r=(0,U.jsxs)(p,{type:`button`,variant:`ghost`,size:`xs`,className:`ml-1.5 h-5 px-1.5 align-middle`,"aria-label":`Recheck base freshness of #${e}`,title:`Check again whether the branch is behind its base`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:[(0,U.jsx)(v,{className:i(`size-3`,t.isFetching&&`animate-spin`)}),`Recheck`]});if(t.error)return(0,U.jsxs)(`p`,{role:`note`,"aria-label":n,className:`text-xs text-muted-foreground`,title:t.error.message,children:[`Could not check whether the branch is behind its base`,r]});let a=t.data,s=a?M(a):null;if(!a||s===null)return null;let c=a.mergeable===`conflicting`;return(0,U.jsxs)(`p`,{role:`note`,"aria-label":n,"data-conflicting":c||void 0,className:i(`text-xs`,c?l.danger:l.attention),title:[a.fetchError&&`Fetching origin failed: ${a.fetchError}`,a.mergeableError].filter(Boolean).join(`
|
|
2
|
-
`)||void 0,children:[s,a.fetchError&&` (not up to date: fetching origin failed)`,r]})}function ae({task:e,mergedWith:t,through:n,detailed:r}){let i=t.pullRequestUrl;if(i===null){let t=`Shipped with task of #${e.id}`;return r?(0,U.jsx)(b,{label:`Shipped with`,children:(0,U.jsx)(`span`,{"aria-label":t,children:n??`A deleted task`})}):(0,U.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1 text-xs`,children:[(0,U.jsx)(A,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Shipped with`}),(0,U.jsx)(`span`,{"aria-label":t,children:n??`a deleted task`})]})}let a=`Shipped with pull request of #${e.id}`;return r?(0,U.jsxs)(b,{label:`Shipped with`,children:[(0,U.jsx)(`span`,{"aria-label":a,className:`break-all font-mono select-all`,children:i}),n&&(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Pull request of `,n]})]}):(0,U.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1 text-xs`,children:[(0,U.jsx)(A,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Shipped with`}),(0,U.jsx)(`span`,{"aria-label":a,className:`truncate select-all font-mono`,children:i}),n&&(0,U.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`of `,n]})]})}function q({task:e,tasks:t,context:n,navigation:r}){let a=u(),o=h(),s=f(),c=(a.data??[]).flatMap(({taskId:t,relatedId:n})=>t===e.id?[n]:n===e.id?[t]:[]).filter(e=>n.byId.has(e)),l=t.filter(t=>t.id!==e.id&&!c.includes(t.id)),d=[...new Set([e.workspaceId,...l.map(e=>e.workspaceId)])].map(e=>({workspaceId:e,tasks:l.filter(t=>t.workspaceId===e)})).filter(e=>e.tasks.length>0),p=E(),m=o.isPending||s.isPending||p,_=o.error??s.error;if(c.length===0&&d.length===0)return null;let v=d.length>0&&(0,U.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:m,onChange:t=>{t.target.value&&o.mutate({taskId:e.id,relatedId:Number(t.target.value)})},children:[(0,U.jsx)(`option`,{value:``,children:`Add related task...`}),d.map(e=>(0,U.jsx)(`optgroup`,{label:n.workspaceName(e.workspaceId),children:e.tasks.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[`#`,e.id,` `,e.title]},e.id))},e.workspaceId))]}),y=_&&(0,U.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:_.message});return c.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs`,children:[v,y]}):(0,U.jsxs)(b,{label:`Related`,children:[(0,U.jsxs)(`ul`,{"aria-label":`Related tasks of #${e.id}`,className:`flex flex-wrap items-center gap-1 max-md:gap-2`,children:[c.map(t=>{let i=n.byId.get(t),a=w(t,e.workspaceId,n);return(0,U.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,U.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,U.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:m,onClick:()=>s.mutate({taskId:e.id,relatedId:t}),children:(0,U.jsx)(g,{className:`size-3`})})]},t)}),v]}),y]})}function J({task:e,detailed:t}){let n=e.status!==`planned`||k(e),r=a(e.id,n);if(r.isError)return(0,U.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to load commits: `,r.error.message]});if(!r.data||r.data.length===0)return null;let o=(0,U.jsx)(`ul`,{"aria-label":`Commits of #${e.id}`,className:i(`flex flex-col gap-0.5`,!t&&`mt-1`),children:r.data.map(e=>(0,U.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,U.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,U.jsx)(`span`,{className:t?`min-w-0 break-words-keep`:`truncate`,children:e.message.split(`
|
|
3
|
-
`,1)[0]})]},e.sha))});return t?(0,U.jsx)(b,{label:`Commits (${r.data.length})`,children:o}):o}function oe({task:e}){return(0,U.jsxs)(U.Fragment,{children:[(e.estimate!==null||e.dueDate!==null)&&(0,U.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,U.jsxs)(`span`,{children:[`Estimate `,D(e.estimate)]}),e.dueDate!==null&&(0,U.jsx)(N,{task:e})]}),(0,U.jsx)(T,{task:e})]})}var se={commit:{label:`Commit`,icon:V,tone:`neutral`},pr_opened:{label:`Pull request opened`,icon:ee,tone:`review`},checks_passed:{label:`CI passed`,icon:C,tone:`success`},checks_failed:{label:`CI failed`,icon:z,tone:`danger`},pr_merged:{label:`Merged`,icon:A,tone:`success`}};function ce({url:e}){let t=x(e),n=t=>{t.preventDefault(),I(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,U.jsx)(`a`,{href:e,title:e,"aria-label":t?`Pull request #${t}`:`Pull request`,onClick:n,onAuxClick:n,className:`shrink-0 text-primary underline underline-offset-2 hover:no-underline`,children:t?`#${t}`:`PR`})}function le({task:e,capabilities:t}){let n=t.git&&t.merge,r=d(e.id,n&&(e.status!==`planned`||k(e)));return n?r.isError?(0,U.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to load git activity: `,r.error.message]}):!r.data||r.data.length===0?null:(0,U.jsx)(b,{label:`Git activity`,children:(0,U.jsx)(`ol`,{"aria-label":`Git activity of #${e.id}`,className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 max-md:gap-y-1.5`,children:r.data.map(({kind:e,externalRef:t,title:n,author:r,occurredAt:a})=>{let{label:o,icon:s,tone:c}=se[e];return(0,U.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-baseline`,title:r??void 0,children:[(0,U.jsx)(O,{className:`text-muted-foreground`,at:a}),(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2 max-md:flex-wrap max-md:gap-y-0`,children:[(0,U.jsxs)(`span`,{className:i(`inline-flex shrink-0 items-baseline gap-1`,l[c]),children:[(0,U.jsx)(s,{"aria-hidden":!0,className:`size-3 self-center`}),o]}),e===`pr_opened`||e===`pr_merged`?(0,U.jsx)(ce,{url:t}):(0,U.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:t.slice(0,7)}),(0,U.jsx)(`span`,{className:`min-w-0 break-words-keep max-md:basis-full`,children:n})]})]},`${e}:${t}`)})})}):null}var Y={idle:{label:`Idle`,tone:`neutral`},working:{label:`Working`,tone:`info`},blocked:{label:`Needs input`,tone:`attention`},done:{label:`Done`,tone:`success`}};function ue(e,t){return e.reduce((n,{status:r,at:i},a)=>{if(r!==`working`)return n;let o=e[a+1]?.at??t;return n+Math.max(0,o-i)},0)}function de(e){let t=Math.floor(e/60);return t<1?`<1m`:t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function fe({task:e,capabilities:t}){let n=t.herdr,r=c(e.id,n&&(e.status!==`planned`||k(e)));if(!n)return null;if(r.isError)return(0,U.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to load the agent's history: `,r.error.message]});let i=r.data??[];if(i.length===0)return null;let a=i.slice(-20),o=de(ue(i,Date.now()/1e3));return(0,U.jsxs)(b,{label:`Agent activity`,children:[(0,U.jsxs)(`p`,{"aria-label":`Time the agent of #${e.id} worked`,className:`text-muted-foreground`,children:[`Worked `,o,i.length>a.length&&`; the last ${a.length} of ${i.length} changes:`]}),(0,U.jsx)(`ol`,{"aria-label":`Agent activity of #${e.id}`,className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 max-md:gap-y-1.5`,children:a.map(({status:e,at:t},n)=>(0,U.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid items-baseline`,children:[(0,U.jsx)(O,{className:`text-muted-foreground`,at:t}),e===null?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`No agent`}):(0,U.jsx)(`span`,{className:l[Y[e].tone],children:Y[e].label})]},n))})]})}var pe={progress:`Progress`,blocker:`Blocker`};function X({kind:e}){return(0,U.jsx)(`span`,{"data-note-kind":e,className:i(`shrink-0 rounded-md px-1.5 font-medium`,e===`blocker`?m.attention:m.neutral),children:pe[e]})}function me({task:e,detailed:t}){let n=e.notes;if(n.length===0)return null;if(!t){let t=n[n.length-1];return(0,U.jsxs)(`p`,{"aria-label":`Latest note of #${e.id}`,className:`flex min-w-0 items-center gap-1.5 text-xs`,title:_(t.at),children:[(0,U.jsx)(X,{kind:t.kind}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:ie(t.body)}),n.length>1&&(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`+${n.length-1} more`})]})}return(0,U.jsx)(b,{label:`Notes (${n.length})`,children:(0,U.jsx)(`ol`,{"aria-label":`Notes of #${e.id}`,className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(X,{kind:e.kind}),(0,U.jsx)(O,{className:`text-muted-foreground`,at:e.at})]}),(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`p`,{className:`whitespace-pre-line break-words-keep`,children:e.body}),children:(0,U.jsx)(y,{source:e.body})})]},t))})})}var he={pending:`Pending`,met:`Met`,failed:`Failed`},Z={pending:l.neutral,met:l.success,failed:l.danger},Q={user:`you`,agent:`an agent`,toodo:`Toodo`};function $({state:e}){let t=e===`met`?C:e===`failed`?z:S;return(0,U.jsx)(`span`,{role:`img`,"aria-label":he[e],className:i(`flex size-4 shrink-0 items-center justify-center`,Z[e]),children:(0,U.jsx)(t,{"aria-hidden":!0,className:`size-3.5`})})}function ge(e){if(e.checkedBy===null)return null;let t=e.checkedAt===null?``:` ${F(e.checkedAt)}`;return`Checked by ${Q[e.checkedBy]}${t}`}function _e({task:e,detailed:t}){let n=e.criteria;if(n.length===0)return null;let r=(0,U.jsx)(`ul`,{"aria-label":`Criteria of #${e.id}`,className:`flex flex-col gap-0.5`,children:n.map(n=>(0,U.jsx)(ve,{task:e,criterion:n,detailed:t},n.id))});if(!t)return r;let i=n.filter(e=>e.state===`met`).length;return(0,U.jsx)(b,{label:`Criteria (${i} of ${n.length} met)`,children:r})}function ve({task:e,criterion:t,detailed:n}){let r=s(),a=E(),[o,c]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=t.kind===`manual`&&e.status!==`done`,m=ge(t),h=j(t.kind)?t.target:null;function g(){c(!1),d(``)}let _=re(u.trim()!==``,g,r.isPending);function v(n){o?g():n?(r.reset(),c(!0)):r.mutate({taskId:e.id,criterionId:t.id,met:!1,evidence:null})}function y(n){n.preventDefault(),r.mutate({taskId:e.id,criterionId:t.id,met:!0,evidence:u.trim()||null},{onSuccess:g})}return(0,U.jsxs)(`li`,{"data-criterion-state":t.state,className:`flex min-w-0 flex-col gap-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,title:n?void 0:[m,t.evidence,h].filter(Boolean).join(`
|
|
4
|
-
`)||void 0,children:[f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`label`,{className:`flex size-4 shrink-0 items-center justify-center max-md:-mx-3.5 max-md:size-11`,children:(0,U.jsx)(`input`,{type:`checkbox`,"aria-label":`Check criterion ${t.id} of #${e.id}`,checked:t.state===`met`||o,disabled:r.isPending||a,onChange:e=>v(e.target.checked)})}),t.state===`failed`&&(0,U.jsx)($,{state:`failed`})]}):(0,U.jsx)($,{state:t.state}),(0,U.jsx)(`span`,{className:i(`min-w-0`,n?`break-words-keep`:`truncate`,t.state===`failed`&&l.danger),children:t.text}),t.kind!==`manual`&&(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-1.5 text-muted-foreground`,children:ne[t.kind]}),!n&&t.evidence&&(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.evidence})]}),n&&h&&(0,U.jsx)(`code`,{className:`ml-5.5 break-all text-muted-foreground`,children:h}),n&&(t.evidence||m)&&(0,U.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,U.jsxs)(U.Fragment,{children:[`Checked by `,Q[t.checkedBy],t.checkedAt!==null&&(0,U.jsxs)(U.Fragment,{children:[` `,(0,U.jsx)(O,{at:t.checkedAt})]})]})]}),o&&(0,U.jsxs)(`form`,{onSubmit:y,className:`ml-5.5 flex flex-wrap items-center gap-1`,onKeyDown:_.onKeyDown,children:[(0,U.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:u,onChange:e=>d(e.target.value),autoFocus:!0}),_.asking?(0,U.jsx)(P,{label:`Discard evidence for criterion ${t.id}`,question:`Discard the evidence?`,onKeep:_.keep,onDiscard:_.discard}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p,{type:`submit`,size:`xs`,disabled:r.isPending,children:r.isPending?`Saving...`:`Save`}),(0,U.jsx)(p,{type:`button`,size:`xs`,variant:`ghost`,onClick:_.request,children:`Cancel`})]})]}),r.isError&&(0,U.jsx)(`p`,{role:`alert`,className:`ml-5.5 text-destructive`,children:r.error.message})]})}export{fe as AgentActivity,K as BranchFreshnessNote,J as CommitList,q as RelatedTasks,ae as ShippedWith,le as TaskActivity,_e as TaskCriteria,W as TaskDetailsSheet,me as TaskNotes,oe as TaskPlan,G as TaskTimeline};
|