forge-openclaw-plugin 0.2.102 → 0.2.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/activity-page-Dv6X5ZCV.js +1 -0
- package/dist/assets/{ai-surface-workspace-xtB5RFQu.js → ai-surface-workspace-CutiG6uS.js} +1 -1
- package/dist/assets/{atlas-panel-B3dPHCmZ.js → atlas-panel-jgMRyaHn.js} +1 -1
- package/dist/assets/{board-DqHzdCPQ.js → board-dIX6etHh.js} +1 -1
- package/dist/assets/calendar-page-q7Nm5E2U.js +1 -0
- package/dist/assets/calendar-rules-DPFsfiRl.js +1 -0
- package/dist/assets/{calendar-week-toolbar-BZ_-X3Wb.js → calendar-week-toolbar-nVhgB-0s.js} +1 -1
- package/dist/assets/{charts-FcU0F3XV.js → charts-DFnEuIMB.js} +1 -1
- package/dist/assets/companion-sync-lab-page-CJ8UTij8.js +1 -0
- package/dist/assets/{daily-metrics-dashboard-BMyL0Qr4.js → daily-metrics-dashboard-CiJkkkd1.js} +1 -1
- package/dist/assets/entity-note-count-link-RzBB6ujx.js +1 -0
- package/dist/assets/{entity-notes-surface-CBylYDwy.js → entity-notes-surface-Djz50HvD.js} +1 -1
- package/dist/assets/execution-board-CtPhI-58.js +1 -0
- package/dist/assets/{faceted-token-search-D7xPWfOl.js → faceted-token-search-DEC6ANa9.js} +1 -1
- package/dist/assets/{flagship-signal-deck-BEFKOhvx.js → flagship-signal-deck-CtHC3mql.js} +1 -1
- package/dist/assets/floating-action-menu-CKQRhff9.js +1 -0
- package/dist/assets/{forms-CmLAyGqz.js → forms-hB0SqEh-.js} +1 -1
- package/dist/assets/goal-detail-page-CF5fNQeR.js +1 -0
- package/dist/assets/goals-page-fsY8NzGB.js +1 -0
- package/dist/assets/{graph-BTa79qum.js → graph-DDUZNRsO.js} +1 -1
- package/dist/assets/habits-page-COoGz4kj.js +1 -0
- package/dist/assets/index-BAXYM89v.css +1 -0
- package/dist/assets/index-EqQsXoat.js +19 -0
- package/dist/assets/{insight-flow-dialog-BtIQXXsS.js → insight-flow-dialog-DtX_5W7g.js} +1 -1
- package/dist/assets/insights-page-cBd74ObU.js +8 -0
- package/dist/assets/kanban-page-CYav9THw.js +1 -0
- package/dist/assets/knowledge-graph-page-D2A-W1jE.js +1 -0
- package/dist/assets/{life-force-page-BGDkKfbJ.js → life-force-page-CACGlNhq.js} +1 -1
- package/dist/assets/life-force-workspace-BJ4N1I78.js +1 -0
- package/dist/assets/{maps-CF1RagUX.js → maps-C-yOWiDN.js} +1 -1
- package/dist/assets/{metric-tile-4iMd_WnJ.js → metric-tile-CMadwnGz.js} +1 -1
- package/dist/assets/{motion-CfdU2F35.js → motion-Lt5B1XuE.js} +1 -1
- package/dist/assets/movement-page-D5VqFd2q.js +1 -0
- package/dist/assets/{note-markdown-CsGQhQXF.js → note-markdown-BzK2Qlgr.js} +1 -1
- package/dist/assets/{note-tags-input-DdZi93tj.js → note-tags-input-CZzqJMLc.js} +1 -1
- package/dist/assets/notes-page-D3Hsh90C.js +1 -0
- package/dist/assets/{open-in-graph-button-C0TGev7c.js → open-in-graph-button-BFPKfyK3.js} +1 -1
- package/dist/assets/{orbit-map-DVXkfQdd.js → orbit-map-CnyfSmOG.js} +1 -1
- package/dist/assets/{overview-page-BwMlFQKX.js → overview-page-CXdWrOV1.js} +1 -1
- package/dist/assets/{page-hero-oFHaAjtL.js → page-hero-ffKzgyW3.js} +1 -1
- package/dist/assets/pill-cluster-C2D0h3lx.js +1 -0
- package/dist/assets/{preference-entity-handoff-button-DOKV9bZc.js → preference-entity-handoff-button-Dj3V6VxL.js} +1 -1
- package/dist/assets/preferences-page-Jo8Gw386.js +1 -0
- package/dist/assets/project-collections-qSqp90HN.js +1 -0
- package/dist/assets/{project-detail-page-DogvVNEn.js → project-detail-page-BifhiLQX.js} +1 -1
- package/dist/assets/project-management-hierarchy-page-DZ_9klIc.js +1 -0
- package/dist/assets/project-management-section-nav-BImLCVvf.js +1 -0
- package/dist/assets/projects-page-ptcx6H38.js +1 -0
- package/dist/assets/{psyche-behaviors-page-BeVlXvbj.js → psyche-behaviors-page-BDwXyDta.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-CqAWCO4E.js → psyche-flashcards-page-DL1BP1jX.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-IyNnbk_W.js → psyche-goal-map-page-ovcpisx1.js} +1 -1
- package/dist/assets/{psyche-graph-IkUQRaDK.js → psyche-graph-EP5GL612.js} +1 -1
- package/dist/assets/{psyche-metrics-page-uai0a7Lx.js → psyche-metrics-page-Bcu813Rg.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-C7p-ABiF.js → psyche-mode-guide-page-C0g27Xpt.js} +1 -1
- package/dist/assets/{psyche-modes-page-CLQ5V3w0.js → psyche-modes-page-BjKjX5MR.js} +1 -1
- package/dist/assets/{psyche-page-NQBHkkpU.js → psyche-page-F4tF2W70.js} +1 -1
- package/dist/assets/{psyche-patterns-page-BkRiNpI_.js → psyche-patterns-page-B-14hukK.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-Du-7HwPC.js → psyche-questionnaire-builder-page-BdXmoHvK.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-C5-yf8MF.js → psyche-questionnaire-detail-page-Cu5uwlJu.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-CoSH5O6R.js → psyche-questionnaire-run-detail-page-C3R4PClg.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-ChI7c1wy.js → psyche-questionnaire-run-page-Div3iDdt.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-xUcJJzbI.js → psyche-questionnaires-page-DpqAPQCp.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-BPrZCFZS.js → psyche-report-detail-page-BvWVDKP3.js} +1 -1
- package/dist/assets/{psyche-reports-page-D2EXJmm6.js → psyche-reports-page-BrbWUlAq.js} +1 -1
- package/dist/assets/{psyche-schemas-RcZYaokx.js → psyche-schemas-Dxj554nU.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-h0ooZ1lp.js → psyche-schemas-beliefs-page-DYKvAtSD.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-_3-4LikV.js → psyche-screen-time-page-CAOKCyQw.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-BdbCsgR5.js → psyche-self-observation-page-F0MVA0UH.js} +1 -1
- package/dist/assets/{psyche-values-page-DuUVki5e.js → psyche-values-page-DyvX-d0o.js} +1 -1
- package/dist/assets/{report-chain-fields-BBMz0sGI.js → report-chain-fields-CeC1cJFS.js} +1 -1
- package/dist/assets/rewards-page-C2loyODo.js +1 -0
- package/dist/assets/scheduling-rules-editor-D40AC2jR.js +1 -0
- package/dist/assets/{schema-badge-D93RcG36.js → schema-badge-FY7818qB.js} +1 -1
- package/dist/assets/{select-menu-Cdq7foRu.js → select-menu-DJsCG6rM.js} +1 -1
- package/dist/assets/settings-agents-page-BFkJ5AAD.js +6 -0
- package/dist/assets/settings-bin-page-D3-Ab-iA.js +1 -0
- package/dist/assets/settings-calendar-page-ly_mSTAD.js +5 -0
- package/dist/assets/settings-data-page-D7QOqNf-.js +1 -0
- package/dist/assets/settings-logs-page-Ca87HEUx.js +1 -0
- package/dist/assets/settings-mobile-page-D0jejZot.js +1 -0
- package/dist/assets/settings-models-page-DPDsZjSc.js +1 -0
- package/dist/assets/settings-page-1cArlSPM.js +1 -0
- package/dist/assets/settings-rewards-page-Db4BV1DC.js +1 -0
- package/dist/assets/{settings-section-nav-Dc4IeVBt.js → settings-section-nav-DP9o4peU.js} +1 -1
- package/dist/assets/settings-users-page-BHFyDSsd.js +1 -0
- package/dist/assets/settings-wiki-page-BNaiupBm.js +1 -0
- package/dist/assets/sleep-page-BmOPF0yD.js +1 -0
- package/dist/assets/sports-page-BldIiclr.js +1 -0
- package/dist/assets/{state-VYvD1QVP.js → state-vCcAT5Hq.js} +1 -1
- package/dist/assets/strategies-page-CaTN99qj.js +1 -0
- package/dist/assets/strategy-detail-page-DsgFTd-U.js +1 -0
- package/dist/assets/{strategy-dialog-DMyRKrWf.js → strategy-dialog-7X7peRzu.js} +1 -1
- package/dist/assets/{surface-Bfz_sLX6.js → surface-CJI17F3n.js} +1 -1
- package/dist/assets/{table-C0VTeqw0.js → table-BNqMG3_S.js} +1 -1
- package/dist/assets/task-detail-page-M1sIIPA8.js +1 -0
- package/dist/assets/timebox-planning-dialog-ByojN0AN.js +1 -0
- package/dist/assets/today-page-BjDijtn8.js +1 -0
- package/dist/assets/training-load-page-BPRmaWmF.js +1 -0
- package/dist/assets/{ui-CsEkP2V8.js → ui-C1iwpj2-.js} +1 -1
- package/dist/assets/{use-psyche-focus-target-qxT5Oy_z.js → use-psyche-focus-target-Ct-acS9G.js} +1 -1
- package/dist/assets/{vendor-kIz9EZnX.js → vendor-Dnkkx2co.js} +3 -3
- package/dist/assets/{vitals-page-Dz1Jt5H8.js → vitals-page-CE9zdGLF.js} +1 -1
- package/dist/assets/weekly-review-page-CzhTv90n.js +1 -0
- package/dist/assets/weight-loss-page-Bp_cIk78.js +5 -0
- package/dist/assets/wiki-article-markdown-Dok2uy2p.js +4 -0
- package/dist/assets/wiki-editor-page-BuW32Y3f.js +26 -0
- package/dist/assets/wiki-ingest-history-page-DZKSBNHV.js +1 -0
- package/dist/assets/wiki-ingest-modal-DyqBEZcC.js +1 -0
- package/dist/assets/wiki-page-DqxlbLKG.js +1 -0
- package/dist/assets/workbench-flow-page-C4nc9jUg.js +5 -0
- package/dist/assets/workbench-page-BnyR7SL0.js +1 -0
- package/dist/assets/{workout-detail-page-DD9IGN6l.js → workout-detail-page-DT-c5cHL.js} +2 -2
- package/dist/index.html +9 -9
- package/dist/server/server/src/app.js +22 -3
- package/dist/server/server/src/health-weight-loss.js +114 -39
- package/dist/server/server/src/repositories/model-settings.js +9 -3
- package/dist/server/src/components/workbench-boxes/shared/generic-node-view.js +13 -5
- package/dist/server/src/lib/api.js +10 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/assets/activity-page-CgF7K2ww.js +0 -1
- package/dist/assets/calendar-page-C1Wfd2Fy.js +0 -1
- package/dist/assets/calendar-rules-CaZXtlxt.js +0 -1
- package/dist/assets/companion-sync-lab-page-NgeK-O-P.js +0 -1
- package/dist/assets/entity-note-count-link-BrS1-O0o.js +0 -1
- package/dist/assets/execution-board-CpO2ch6v.js +0 -1
- package/dist/assets/floating-action-menu-zzC2r0Ob.js +0 -1
- package/dist/assets/goal-detail-page-JK_Nva8e.js +0 -1
- package/dist/assets/goals-page-yeoJ06Vw.js +0 -1
- package/dist/assets/habits-page-Dx5EhkJi.js +0 -1
- package/dist/assets/index-BHIKoiZ6.js +0 -19
- package/dist/assets/index-H8R-ABM3.css +0 -1
- package/dist/assets/insights-page-CujrosD_.js +0 -8
- package/dist/assets/kanban-page-Q9NuIz5w.js +0 -1
- package/dist/assets/knowledge-graph-page-DaJmlvvM.js +0 -1
- package/dist/assets/life-force-workspace-CLVexVnb.js +0 -1
- package/dist/assets/movement-page-ClaoTNuX.js +0 -1
- package/dist/assets/notes-page-DYI8s3NN.js +0 -1
- package/dist/assets/pill-cluster-7UZd_lHp.js +0 -1
- package/dist/assets/preferences-page-BrKEkmfD.js +0 -1
- package/dist/assets/project-collections-CZagCmeH.js +0 -1
- package/dist/assets/project-management-hierarchy-page-Dr7hW9PW.js +0 -1
- package/dist/assets/project-management-section-nav-BLdAgTge.js +0 -1
- package/dist/assets/projects-page-UKrby_5-.js +0 -1
- package/dist/assets/rewards-page-PZFPa6rR.js +0 -1
- package/dist/assets/scheduling-rules-editor-B9KNKsQz.js +0 -1
- package/dist/assets/settings-agents-page-DPx2F6wf.js +0 -6
- package/dist/assets/settings-bin-page-COwP3gjo.js +0 -1
- package/dist/assets/settings-calendar-page-C-ghE0YT.js +0 -5
- package/dist/assets/settings-data-page-CBubzKBw.js +0 -1
- package/dist/assets/settings-logs-page-uOuXMeBm.js +0 -1
- package/dist/assets/settings-mobile-page-C5rfj8_r.js +0 -1
- package/dist/assets/settings-models-page-DijmUWdU.js +0 -1
- package/dist/assets/settings-page-B4u5TR5g.js +0 -1
- package/dist/assets/settings-rewards-page-COiTwkMH.js +0 -1
- package/dist/assets/settings-users-page-DEGa5DNn.js +0 -1
- package/dist/assets/settings-wiki-page-Cvsiz5_e.js +0 -1
- package/dist/assets/sleep-page-BnSOwkEU.js +0 -1
- package/dist/assets/sports-page-l1RqXzA_.js +0 -1
- package/dist/assets/strategies-page-DEnPlpAs.js +0 -1
- package/dist/assets/strategy-detail-page-Ls8bxKeH.js +0 -1
- package/dist/assets/task-detail-page-CgrYgQLD.js +0 -1
- package/dist/assets/timebox-planning-dialog-Ww0NGLLo.js +0 -1
- package/dist/assets/today-page-CIuFHMi1.js +0 -1
- package/dist/assets/training-load-page-BIwc648i.js +0 -1
- package/dist/assets/weekly-review-page-BFpBe1kI.js +0 -1
- package/dist/assets/weight-loss-page-BgMoBpBt.js +0 -5
- package/dist/assets/wiki-article-markdown-gsPTXTg1.js +0 -4
- package/dist/assets/wiki-editor-page-BpAZHooY.js +0 -26
- package/dist/assets/wiki-ingest-history-page-C-ig8O22.js +0 -1
- package/dist/assets/wiki-ingest-modal-BK4eQgqs.js +0 -1
- package/dist/assets/wiki-page-CMTZ60Zt.js +0 -1
- package/dist/assets/workbench-flow-page-BIpWUcLJ.js +0 -5
- package/dist/assets/workbench-page-CtCjYSRe.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as g,j as a}from"./vendor-kIz9EZnX.js";import{i as D}from"./state-VYvD1QVP.js";import{Q as K,cV as C,F as y,j as I,I as B,B as R,T as S,cW as W}from"./index-BHIKoiZ6.js";const $=[10,15,30,45,60];function A(){return{mode:"add",minutes:15,note:""}}function U({open:s,onOpenChange:t,entityType:p,entityId:u,targetLabel:r,currentCreditedSeconds:m,pending:w=!1,onSubmit:h}){const[c,b]=g.useState(A),[v,k]=g.useState(null);g.useEffect(()=>{s&&(b(A()),k(null))},[s]);const e=D({queryKey:["forge-xp-metrics"],queryFn:W,enabled:s}),d=g.useMemo(()=>{var x;const o=(x=e.data)==null?void 0:x.metrics.rules.find(f=>f.code==="task_run_progress"),l=Math.max(1,Number((o==null?void 0:o.config.intervalMinutes)??10)),n=Number((o==null?void 0:o.config.fixedXp)??4);return{intervalMinutes:l,fixedXp:n,intervalSeconds:l*60}},[e.data]),i=g.useMemo(()=>{const o=Math.max(0,Math.trunc(c.minutes||0)),l=c.mode==="add"?o:-o,n=Math.max(0,Math.floor(m/60)),x=l>=0?l:-Math.min(Math.abs(l),n),f=Math.max(0,m+x*60),T=Math.floor(Math.max(0,m)/d.intervalSeconds),M=Math.floor(f/d.intervalSeconds)-T;return{requestedDeltaMinutes:l,appliedDeltaMinutes:x,nextCreditedSeconds:f,bucketDelta:M,xpDelta:M*d.fixedXp,maxRemovableMinutes:n}},[d.fixedXp,d.intervalSeconds,m,c.minutes,c.mode]),N=[{id:"adjustment",eyebrow:p==="task"?"Task work":"Project work",title:`Adjust tracked work for ${r}`,description:"Use this for retrospective minute corrections. Forge will add or remove tracked minutes and adjust progress XP automatically when a reward bucket is crossed.",render:(o,l)=>a.jsxs(a.Fragment,{children:[a.jsx(y,{label:"Mode",labelHelp:"Add minutes when work happened off-timer. Remove minutes when the tracked total needs a correction.",children:a.jsx(I,{value:o.mode,onChange:n=>l({mode:n}),options:[{value:"add",label:"Add minutes",description:"Record extra work that already happened."},{value:"remove",label:"Remove minutes",description:"Correct tracked time without deleting the work history."}]})}),a.jsx(y,{label:"Minutes",description:`Currently tracked: ${Math.floor(m/60)} minutes.`,hint:o.mode==="remove"?`You can remove up to ${i.maxRemovableMinutes} whole minutes from the current credited total.`:void 0,children:a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(B,{type:"number",min:1,className:"w-36",value:o.minutes,onChange:n=>l({minutes:Number(n.target.value)||0})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(n=>a.jsxs(R,{type:"button",variant:o.minutes===n?"primary":"secondary",onClick:()=>l({minutes:n}),children:[n," min"]},n))})]})}),a.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[a.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Preview"}),a.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-3",children:[a.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Applied minutes"}),a.jsxs("div",{className:"mt-2 text-lg text-white",children:[i.appliedDeltaMinutes>0?"+":"",i.appliedDeltaMinutes]})]}),a.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"XP delta"}),a.jsxs("div",{className:"mt-2 text-lg text-white",children:[i.xpDelta>0?"+":"",i.xpDelta]})]}),a.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"New tracked total"}),a.jsxs("div",{className:"mt-2 text-lg text-white",children:[Math.floor(i.nextCreditedSeconds/60)," min"]})]})]}),a.jsxs("div",{className:"mt-3 text-sm leading-6 text-white/58",children:["Reward cadence: ",d.fixedXp," XP every"," ",d.intervalMinutes," credited minutes."," ",i.bucketDelta===0?"This change does not cross a reward bucket.":`This change crosses ${Math.abs(i.bucketDelta)} reward bucket${Math.abs(i.bucketDelta)===1?"":"s"}.`]})]}),a.jsx(y,{label:"Note",description:"Optional context for why this correction is being added. The note stays attached to the adjustment metadata.",children:a.jsx(S,{className:"min-h-28",value:o.note,onChange:n=>l({note:n.target.value}),placeholder:"Captured the review session that happened away from the live timer."})})]})}];return a.jsx(K,{open:s,onOpenChange:t,eyebrow:p==="task"?"Adjust task work":"Adjust project work",title:`Adjust work for ${r}`,description:"Add or remove tracked minutes without creating a live task run.",value:c,onChange:b,draftPersistenceKey:`work-adjustment.${p}.${u}`,steps:N,submitLabel:"Save adjustment",pending:w,pendingLabel:"Saving adjustment...",error:v,onSubmit:async()=>{var x;k(null);const o=Math.max(0,Math.trunc(c.minutes||0)),l=c.mode==="add"?o:-o,n=C.safeParse({entityType:p,entityId:u,deltaMinutes:l,note:c.note});if(!n.success){k(((x=n.error.issues[0])==null?void 0:x.message)??"Enter a valid minute adjustment.");return}try{await h({entityType:p,entityId:u,deltaMinutes:n.data.deltaMinutes,note:n.data.note||void 0}),t(!1)}catch(f){k(f instanceof Error?f.message:"Could not save the work adjustment right now.")}}})}const E={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function X(s){return s.map(t=>t.trim().toLowerCase()).filter(Boolean)}function j(s,t){const p=X(s);if(p.length===0)return!1;const u=t.join(" ").toLowerCase();return p.some(r=>u.includes(r))}function F(s){return s.allowWorkBlockKinds.length>0||s.allowCalendarIds.length>0||s.allowEventTypes.length>0||s.allowEventKeywords.length>0||s.allowAvailability.length>0}function P(s,t){return s??t??E}function z(s){const t=s.rules??E,u=(s.at??new Date).getTime(),r=s.overview,m=(r==null?void 0:r.workBlockInstances.filter(e=>{const d=new Date(e.startAt).getTime(),i=new Date(e.endAt).getTime();return d<=u&&u<i}))??[],w=(r==null?void 0:r.events.filter(e=>{if(e.deletedAt)return!1;const d=new Date(e.startAt).getTime(),i=new Date(e.endAt).getTime();return d<=u&&u<i}))??[],h=[],c=m.some(e=>t.blockWorkBlockKinds.includes(e.kind))||w.some(e=>(e.calendarId?t.blockCalendarIds.includes(e.calendarId):!1)||t.blockEventTypes.includes(e.eventType)||t.blockAvailability.includes(e.availability)||j(t.blockEventKeywords,[e.title,e.description,e.location,...e.categories]));c&&(m.some(e=>t.blockWorkBlockKinds.includes(e.kind))&&h.push("The current work block is marked as blocked."),w.some(e=>e.calendarId?t.blockCalendarIds.includes(e.calendarId):!1)&&h.push("The active calendar belongs to a blocked calendar source."),w.some(e=>t.blockEventTypes.includes(e.eventType))&&h.push("The active calendar event type is blocked."),w.some(e=>t.blockAvailability.includes(e.availability))&&h.push("The active calendar availability is blocked."),w.some(e=>j(t.blockEventKeywords,[e.title,e.description,e.location,...e.categories]))&&h.push("The active calendar event matches a blocked keyword."));const b=F(t),v=m.some(e=>t.allowWorkBlockKinds.includes(e.kind))||w.some(e=>(e.calendarId?t.allowCalendarIds.includes(e.calendarId):!1)||t.allowEventTypes.includes(e.eventType)||t.allowAvailability.includes(e.availability)||j(t.allowEventKeywords,[e.title,e.description,e.location,...e.categories]));!c&&b&&!v&&h.push("The current calendar context does not match the allowed rules yet.");const k=[...m.map(e=>`${e.title} (${e.kind.replaceAll("_"," ")})`),...w.map(e=>e.title)];return h.length>0?{blocked:!0,label:"Blocked right now",tone:"blocked",conflicts:h,context:k}:k.length>0?{blocked:!1,label:"Allowed right now",tone:"allowed",conflicts:[],context:k}:{blocked:!1,label:b?"Waiting for an allowed calendar context":"No live calendar conflict right now",tone:b?"waiting":"allowed",conflicts:[],context:[]}}function Y(s,t){return P(s.schedulingRules,t)}export{U as W,z as e,Y as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-kIz9EZnX.js";import{C as g,c as s}from"./index-BHIKoiZ6.js";import{P as y}from"./page-hero-oFHaAjtL.js";import"./state-VYvD1QVP.js";import"./motion-CfdU2F35.js";import"./ui-CsEkP2V8.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";const N=[{id:"health-ready",title:"Health ready",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"approved",syncEligible:!0,lastObservedAt:"2026-04-12T09:00:00.000Z"},{id:"movement-pending-phone",title:"Movement pending on phone",desiredEnabled:!0,appliedEnabled:!1,authorizationStatus:"pending",syncEligible:!1,lastObservedAt:"2026-04-12T09:04:00.000Z"},{id:"screen-time-denied",title:"Screen Time denied",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"denied",syncEligible:!1,lastObservedAt:"2026-04-12T08:54:00.000Z"},{id:"health-off",title:"Health off",desiredEnabled:!1,appliedEnabled:!1,authorizationStatus:"disabled",syncEligible:!1,lastObservedAt:null}],f=[{id:"gap-stay",title:"Quiet short gap",gapSeconds:1080,displacementMeters:42,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-short-jump",title:"Suppressed short jump",gapSeconds:240,displacementMeters:260,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-trip",title:"Repaired move",gapSeconds:1320,displacementMeters:1850,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-long",title:"Long missing gap",gapSeconds:7200,displacementMeters:320,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-boundary",title:"Missing boundary anchor",gapSeconds:960,displacementMeters:null,hasStartBoundary:!1,hasEndBoundary:!0}],k=[{id:"overnight-gap-before-move",title:"Exact overnight stay-gap-move bug",rangeStart:"2026-04-05T21:15:00.000Z",rangeEnd:"2026-04-06T02:40:00.000Z",segments:[{id:"stay-home-evening",kind:"stay",startedAt:"2026-04-05T21:15:00.000Z",endedAt:"2026-04-05T21:30:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"trip-night-move",kind:"trip",startedAt:"2026-04-06T02:34:00.000Z",endedAt:"2026-04-06T02:40:00.000Z",placeLabel:"Night move",placeExternalUid:null,startCoordinate:{latitude:46.5216,longitude:6.6404},endCoordinate:{latitude:46.5226,longitude:6.6424}}]},{id:"repeated-home-stays",title:"Repeated home stays coalesce",rangeStart:"2026-04-05T07:00:00.000Z",rangeEnd:"2026-04-05T08:44:00.000Z",segments:[{id:"stay-home-1",kind:"stay",startedAt:"2026-04-05T07:00:00.000Z",endedAt:"2026-04-05T08:00:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"stay-home-2",kind:"stay",startedAt:"2026-04-05T08:20:00.000Z",endedAt:"2026-04-05T08:40:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.51912,longitude:6.63231},endCoordinate:{latitude:46.51912,longitude:6.63231}},{id:"trip-start-anchor",kind:"trip",startedAt:"2026-04-05T08:44:00.000Z",endedAt:"2026-04-05T08:49:00.000Z",placeLabel:"Walk out",placeExternalUid:null,startCoordinate:{latitude:46.5217,longitude:6.6405},endCoordinate:{latitude:46.5221,longitude:6.6412}}]}],E=[{id:"user-override-home-window",title:"User-defined missing box overrides one automatic home stay",rawMeasurements:[{id:"raw-stay-home",label:"Raw stay · Home",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z"}],automaticBoxes:[{id:"auto-stay-home",kind:"stay",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home"}],userBoxes:[{id:"user-missing-home-window",kind:"missing",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1}],projectedBoxes:[{id:"projected-home-early",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T08:30:00.000Z",title:"Home",overrideCount:0},{id:"projected-home-user-missing",kind:"missing",sourceKind:"user_defined",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1},{id:"projected-home-late",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T09:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home",overrideCount:0}]}],w=3600,T=300,_=100;function x(t,i){return Math.max(0,Math.round((Date.parse(i)-Date.parse(t))/1e3))}function S(t,i){if(!t||!i)return null;const a=6371e3,m=(i.latitude-t.latitude)*Math.PI/180,l=(i.longitude-t.longitude)*Math.PI/180,h=t.latitude*Math.PI/180,c=i.latitude*Math.PI/180,p=Math.sin(m/2)**2+Math.cos(h)*Math.cos(c)*Math.sin(l/2)**2,r=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return a*r}function M(t,i){if(t.placeExternalUid&&i.placeExternalUid&&t.placeExternalUid===i.placeExternalUid)return!0;const a=S(t.endCoordinate,i.startCoordinate);return a!==null&&a<=_}function C(t){return t.gapSeconds>3600?{kind:"missing",origin:"missing",reason:"Gap exceeded one hour, so Forge keeps it as explicit missing data.",suppressedShortJump:!1}:!t.hasStartBoundary||!t.hasEndBoundary||t.displacementMeters===null?{kind:"missing",origin:"missing",reason:"One or both boundary anchors were missing, so the gap stays missing instead of inventing movement.",suppressedShortJump:!1}:t.displacementMeters<=100?{kind:"stay",origin:"repaired_gap",reason:"Boundary displacement stayed within 100 m, so the gap repairs into one stay.",suppressedShortJump:!1}:t.gapSeconds<300?{kind:"stay",origin:"repaired_gap",reason:"The jump crossed 100 m but stayed under five minutes, so Forge suppresses it into stay continuity.",suppressedShortJump:!0}:{kind:"trip",origin:"repaired_gap",reason:"The gap stayed under one hour, crossed 100 m, and lasted at least five minutes, so Forge repairs it into a move.",suppressedShortJump:!1}}function L(t){var b,v,j,A;const i=[...t.segments].sort((d,o)=>d.startedAt.localeCompare(o.startedAt)),a=[];if(i.length===0)return{segments:[],uncoveredIntervals:[]};const m=i[0];x(t.rangeStart,m.startedAt)>0&&a.push({id:`missing_${t.rangeStart}_${m.startedAt}`,kind:"missing",origin:"missing",startedAt:t.rangeStart,endedAt:m.startedAt,title:"Missing data"}),i.forEach((d,o)=>{if(o>0){const n=i[o-1],u=x(n.endedAt,d.startedAt);u>0&&(u>w?a.push({id:`missing_${n.id}_${d.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:d.startedAt,title:"Missing data"}):M(n,d)?a.push({id:`repaired_stay_${n.id}_${d.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:n.placeLabel??d.placeLabel??"Repaired stay"}):S(n.endCoordinate,d.startCoordinate)===null?a.push({id:`missing_${n.id}_${d.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:d.startedAt,title:"Missing data"}):u<T?a.push({id:`repaired_short_jump_${n.id}_${d.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:n.placeLabel??d.placeLabel??"Repaired stay"}):a.push({id:`repaired_trip_${n.id}_${d.id}`,kind:"trip",origin:"repaired_gap",startedAt:n.endedAt,endedAt:d.startedAt,title:"Repaired move"}))}a.push({id:d.id,kind:d.kind,origin:"recorded",startedAt:d.startedAt,endedAt:d.endedAt,title:d.placeLabel??d.kind})});const l=i[i.length-1],h=x(l.endedAt,t.rangeEnd);h>0&&(l.kind==="stay"&&h<=w?a.push({id:`continued_${l.id}_${t.rangeEnd}`,kind:"stay",origin:"continued_stay",startedAt:l.endedAt,endedAt:t.rangeEnd,title:l.placeLabel??"Continued stay"}):a.push({id:`missing_${l.endedAt}_${t.rangeEnd}`,kind:"missing",origin:"missing",startedAt:l.endedAt,endedAt:t.rangeEnd,title:"Missing data"}));const c=[];for(const d of a){const o=c[c.length-1];if(o&&o.kind==="stay"&&d.kind==="stay"&&(o.origin!=="recorded"||d.origin!=="recorded")&&o.endedAt===d.startedAt){c[c.length-1]={...o,id:`${o.id}_${d.id}`,origin:o.origin==="continued_stay"||d.origin==="continued_stay"?"continued_stay":"repaired_gap",endedAt:d.endedAt};continue}c.push(d)}const p=[],r=[...c].sort((d,o)=>d.startedAt.localeCompare(o.startedAt));((b=r[0])==null?void 0:b.startedAt)!==t.rangeStart&&p.push({startedAt:t.rangeStart,endedAt:((v=r[0])==null?void 0:v.startedAt)??t.rangeEnd});for(let d=1;d<r.length;d+=1)r[d-1].endedAt!==r[d].startedAt&&p.push({startedAt:r[d-1].endedAt,endedAt:r[d].startedAt});return((j=r[r.length-1])==null?void 0:j.endedAt)!==t.rangeEnd&&p.push({startedAt:((A=r[r.length-1])==null?void 0:A.endedAt)??t.rangeStart,endedAt:t.rangeEnd}),{segments:r,uncoveredIntervals:p}}function Z(t){return t?new Date(t).toLocaleString():"Waiting for device update"}function F(){return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1180px] gap-5",children:[e.jsx(y,{title:"Companion Sync Lab",description:"Deterministic fixtures for source-state reconciliation and movement gap repair. This route is dev-only and exists to make QA faster than recreating every phone state by hand.",badge:"Dev only"}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[1.05fr_0.95fr]",children:[e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Source matrix"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"These rows mirror the pairing source-state contract that the web and phone now share."})]}),e.jsx("div",{className:"grid gap-3",children:N.map(t=>e.jsxs("div",{className:"grid gap-2 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{tone:t.desiredEnabled?"signal":"meta",children:t.desiredEnabled?"Enabled":"Off"}),e.jsx(s,{tone:"meta",children:t.desiredEnabled===t.appliedEnabled?"Applied":"Pending on phone"})]}),e.jsxs("div",{className:"grid gap-1 text-xs text-white/56 sm:grid-cols-2",children:[e.jsxs("div",{children:["Authorization: ",t.authorizationStatus]}),e.jsxs("div",{children:["Sync eligible: ",t.syncEligible?"Yes":"No"]}),e.jsxs("div",{children:["Desired: ",t.desiredEnabled?"On":"Off"]}),e.jsxs("div",{children:["Applied: ",t.appliedEnabled?"On":"Off"]}),e.jsxs("div",{className:"sm:col-span-2",children:["Last observed: ",Z(t.lastObservedAt)]})]})]},t.id))})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Gap classifier"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-white/58",children:["Every gap resolves to exactly one of ",e.jsx("code",{children:"stay"}),","," ",e.jsx("code",{children:"trip"}),", or ",e.jsx("code",{children:"missing"}),"."]})]}),e.jsx("div",{className:"grid gap-3",children:f.map(t=>{const i=C(t);return e.jsxs("div",{className:"grid gap-2 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{tone:i.kind==="missing"?"meta":i.kind==="trip"?"signal":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.origin}),i.suppressedShortJump?e.jsx(s,{className:"bg-amber-400/10 text-amber-100",children:"Suppressed short jump"}):null]}),e.jsxs("div",{className:"grid gap-1 text-xs text-white/56 sm:grid-cols-2",children:[e.jsxs("div",{children:["Gap: ",Math.round(t.gapSeconds/60)," min"]}),e.jsxs("div",{children:["Displacement:"," ",t.displacementMeters===null?"unknown":`${Math.round(t.displacementMeters)} m`]}),e.jsxs("div",{children:["Start boundary: ",t.hasStartBoundary?"present":"missing"]}),e.jsxs("div",{children:["End boundary: ",t.hasEndBoundary?"present":"missing"]})]}),e.jsx("div",{className:"text-sm leading-6 text-white/72",children:i.reason})]},t.id)})})]})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Coverage preview"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"These fixtures normalize a full window and highlight whether any interval would still be left uncovered."})]}),e.jsx("div",{className:"grid gap-3",children:k.map(t=>{const i=L(t);return e.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx(s,{className:i.uncoveredIntervals.length===0?"bg-emerald-400/10 text-emerald-100":"bg-rose-400/10 text-rose-100",children:i.uncoveredIntervals.length===0?"Coverage locked":"Coverage broken"}),e.jsxs(s,{tone:"meta",children:[i.segments.length," normalized segment",i.segments.length===1?"":"s"]})]}),e.jsx("div",{className:"grid gap-2",children:i.segments.map(a=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[16px] border border-white/6 bg-white/[0.02] px-3 py-2 text-xs text-white/68",children:[e.jsx(s,{tone:a.kind==="trip"?"signal":a.kind==="missing"?"meta":"default",children:a.kind}),e.jsx(s,{tone:"meta",children:a.origin}),e.jsxs("span",{children:[new Date(a.startedAt).toLocaleTimeString()," → ",new Date(a.endedAt).toLocaleTimeString()]}),e.jsx("span",{className:"text-white/48",children:a.title})]},a.id))}),i.uncoveredIntervals.length>0?e.jsx("div",{className:"grid gap-2",children:i.uncoveredIntervals.map(a=>e.jsxs("div",{className:"rounded-[14px] border border-rose-400/18 bg-rose-500/10 px-3 py-2 text-xs text-rose-100",children:["Uncovered: ",new Date(a.startedAt).toLocaleTimeString()," →"," ",new Date(a.endedAt).toLocaleTimeString()]},`${a.startedAt}-${a.endedAt}`))}):null]},t.id)})})]}),e.jsxs(g,{className:"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(10,17,31,0.96),rgba(8,13,24,0.92))] p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Canonical box layers"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Raw phone measurements stay immutable. Forge generates automatic boxes from them, user-defined boxes override them, and the final projected boxes are what both the web and iPhone should render."})]}),e.jsx("div",{className:"grid gap-4",children:E.map(t=>e.jsxs("div",{className:"grid gap-4 rounded-[20px] border border-white/8 bg-white/[0.03] px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsxs(s,{tone:"meta",children:["Raw: ",t.rawMeasurements.length]}),e.jsxs(s,{tone:"meta",children:["Automatic: ",t.automaticBoxes.length]}),e.jsxs(s,{tone:"meta",children:["User: ",t.userBoxes.length]}),e.jsxs(s,{tone:"signal",children:["Projected: ",t.projectedBoxes.length]})]}),e.jsxs("div",{className:"grid gap-3 xl:grid-cols-4",children:[e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Raw measurements"}),t.rawMeasurements.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsx("div",{className:"font-medium text-white",children:i.label}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Automatic boxes"}),t.automaticBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"User-defined boxes"}),t.userBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{className:"bg-pink-400/10 text-pink-100",children:i.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:"mt-1 text-white/52",children:["Overrides ",i.overrideCount," automatic box",i.overrideCount===1?"":"es"]})]},i.id))]}),e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/6 bg-black/10 p-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Projected visible boxes"}),t.projectedBoxes.map(i=>e.jsxs("div",{className:"rounded-[14px] border border-white/6 bg-white/[0.03] px-3 py-2 text-xs text-white/68",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(s,{tone:"meta",children:i.sourceKind})]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:i.title}),e.jsxs("div",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:"mt-1 text-white/52",children:[i.origin,i.overrideCount>0?` · overrides ${i.overrideCount}`:""]})]},i.id))]})]})]},t.id))})]})]})}export{F as CompanionSyncLabPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b5 as l,j as i,aS as x}from"./vendor-kIz9EZnX.js";import{ap as f,cN as h}from"./index-BHIKoiZ6.js";function g({entityType:s,entityId:a,count:r,compact:o=!1,className:p=""}){const n=l(),e=f(s,a);return e?i.jsxs("span",{role:"link",tabIndex:0,className:`inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] text-white/72 transition hover:bg-white/[0.09] hover:text-white ${o?"min-h-5 gap-1 px-2 py-0.5 text-[10px]":"min-h-10 gap-2 px-3 py-2 text-xs"} ${p}`,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),n(e))},children:[i.jsx(x,{className:o?"size-3":"size-3.5"}),h(r)]}):null}export{g as E};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as N,bg as Ke,ce as Qe,cb as Xe,cv as be,j as t,c7 as ve,b2 as pt,ca as Ze,cw as Fe,cx as Ye,bM as ht,br as ft,c9 as gt,aO as bt,aP as we,bo as Ue,cy as wt}from"./vendor-kIz9EZnX.js";import{u as jt,a as vt,D as yt,S as Pe,v as Ve,e as Nt,p as kt,f as St,P as _t,g as Te,b as et,C as tt}from"./board-DqHzdCPQ.js";import{P as ye,C as it,B as qe,Z as W,_ as It,aS as at,b as le,c as S,V as nt,U as je}from"./index-BHIKoiZ6.js";import{E as Ct}from"./entity-note-count-link-BrS1-O0o.js";import{F as zt}from"./floating-action-menu-zzC2r0Ob.js";function Dt(e){if(typeof e=="number"&&Number.isInteger(e)&&e>0)return e;if(typeof e=="string"){const a=e.match(/(\d+)/);if(a){const l=Number.parseInt(a[1]??"",10);return Number.isInteger(l)&&l>0?l:null}}return null}function Ge(e){return e.split(/\r?\n/).map(a=>a.trim()).reduce((a,l)=>{const o=l.match(/^[-*+]\s+\[([ xX])\]\s+(.+)$/);if(o)return a.push({label:o[2].trim(),completed:o[1].toLowerCase()==="x"}),a;const c=l.match(/^(?:[-*+]|\d+\.)\s+(.+)$/);return c&&a.push({label:c[1].trim(),completed:null}),a},[]).filter(a=>a.label.length>0)}function $t(e){if(e.acceptanceCriteria.length>0)return{total:e.acceptanceCriteria.length,completed:e.status==="done"?e.acceptanceCriteria.length:0,source:"acceptance_criteria",items:e.acceptanceCriteria};const a=Ge(e.aiInstructions);if(a.length>0){const o=e.status==="done"?a.length:a.filter(c=>c.completed===!0).length;return{total:a.length,completed:o,source:"ai_instructions",items:a.map(c=>c.label)}}const l=Ge(e.description);if(l.length>0){const o=e.status==="done"?l.length:l.filter(c=>c.completed===!0).length;return{total:l.length,completed:o,source:"description",items:l.map(c=>c.label)}}return null}function He(e,a){return e.find(l=>l.refType===a)??null}function st(e,a=null){var x,h,j,D,k,I,$,U,B,M,R;const l=new Set(((x=e.completionReport)==null?void 0:x.linkedGitRefIds)??[]),o=He(e.gitRefs,"branch"),c=He(e.gitRefs,"pull_request"),u=(a==null?void 0:a.gitContext)??null,m=(u==null?void 0:u.pullRequestNumber)??Dt((c==null?void 0:c.refValue)??(c==null?void 0:c.displayTitle)??null);return{actor:(a==null?void 0:a.actor)??null,activeRun:a,stepSummary:$t(e),changedFileCount:((h=e.completionReport)==null?void 0:h.modifiedFiles.length)??0,changedFilesPreview:(((j=e.completionReport)==null?void 0:j.modifiedFiles)??[]).slice(0,2),git:{provider:((D=u==null?void 0:u.provider)==null?void 0:D.trim())||((k=o==null?void 0:o.provider)==null?void 0:k.trim())||((I=c==null?void 0:c.provider)==null?void 0:I.trim())||null,repository:(($=u==null?void 0:u.repository)==null?void 0:$.trim())||((U=o==null?void 0:o.repository)==null?void 0:U.trim())||((B=c==null?void 0:c.repository)==null?void 0:B.trim())||null,branch:((M=u==null?void 0:u.branch)==null?void 0:M.trim())||((R=o==null?void 0:o.refValue)==null?void 0:R.trim())||null,branchUrl:(u==null?void 0:u.branchUrl)??(o==null?void 0:o.url)??null,pullRequestNumber:m,pullRequestUrl:(u==null?void 0:u.pullRequestUrl)??(c==null?void 0:c.url)??null,compareUrl:(u==null?void 0:u.compareUrl)??null,linkedRefCount:l.size}}}const _=["backlog","focus","in_progress","blocked","done"];function Bt({task:e,onOpenTask:a,onEditTask:l,onLinkTask:o,onCreateTaskForIssue:c,onCreateSubtaskForTask:u,onMove:m,onDeleteTask:x,deletePendingTaskId:h,onRequestDelete:j}){const D=e.level==="issue"?{id:"create-task",label:"Create task",description:"Add a focused execution task under this issue.",icon:be,onSelect:()=>c==null?void 0:c(e.id)}:e.level==="task"?{id:"create-subtask",label:"Create subtask",description:"Add a granular child step under this task.",icon:be,onSelect:()=>u==null?void 0:u(e.id)}:null;return[{id:"open-task",label:"Open",description:"Jump to the work-item detail view.",icon:Ke,onSelect:()=>a==null?void 0:a(e.id)},{id:"edit-task",label:"Edit",description:"Open the guided work-item editor.",icon:Qe,onSelect:()=>l==null?void 0:l(e.id)},{id:"link-task",label:"Link",description:"Open the placement step to relink this work item.",icon:Xe,onSelect:()=>o==null?void 0:o(e.id)},...D?[D]:[],{id:"delete-task",label:e.level==="issue"?"Delete issue":e.level==="subtask"?"Delete subtask":"Delete task",description:"Remove this work item directly from the board menu.",icon:ve,tone:"danger",disabled:!x||h===e.id,onSelect:()=>j(e)},..._.filter(k=>k!==e.status).map(k=>({id:`move-task-${k}`,label:`Move to ${k.replaceAll("_"," ")}`,description:"Update the workflow lane for this work item.",onSelect:()=>void m(e.id,k)}))]}function rt(e){return e.startsWith("lane:")||e.includes(":lane:")}function Mt(e){var a,l;return((l=(a=e.data)==null?void 0:a.current)==null?void 0:l.type)==="lane"||rt(String(e.id))}function At(e){var a,l;return((l=(a=e.data)==null?void 0:a.current)==null?void 0:l.type)==="trash"}function Lt(e,a){const l=Math.max(0,Math.min(e.right,a.right)-Math.max(e.left,a.left)),o=Math.max(0,Math.min(e.bottom,a.bottom)-Math.max(e.top,a.top));return l*o}const Et=e=>{const a=kt(e),l=a.find(m=>{const x=e.droppableContainers.find(h=>h.id===m.id);return x?At(x):!1});if(l)return[l];const o=a.find(m=>rt(String(m.id)));if(o)return[o];const u=e.droppableContainers.filter(m=>Mt(m)).map(m=>{const x=e.droppableRects.get(m.id);if(!x)return null;const h=Lt(e.collisionRect,x);return h<=0?null:{id:m.id,data:{droppableContainer:m,value:h}}}).filter(Boolean).sort((m,x)=>{var h,j;return(((h=x==null?void 0:x.data)==null?void 0:h.value)??0)-(((j=m==null?void 0:m.data)==null?void 0:j.value)??0)});return u.length>0?u:a.length>0?a:St(e)};function Rt(e,a){return a&&a.trim().length>0?a:e!=null&&e.actor?`${e.actor} session`:"Active work"}function Ot(e,a){return[(e==null?void 0:e.actor)??null,a].filter(Boolean).join(" · ")}function We(e){e.preventDefault(),e.stopPropagation()}function lt({task:e,goal:a,tags:l,activeRun:o,isSelected:c,isDragging:u=!1,isOverlay:m=!1,style:x,setNodeRef:h,dragAttributes:j,dragListeners:D,isMobile:k=!1,onSelect:I,onStartTask:$,onStopTask:U,onQuickReopen:B,onStepTask:M,onSplitTask:R,onOpenMenu:G,notesSummaryByEntity:C}){var X;const{t:ee,formatDate:ne}=ye(),v=st(e,o??null),z=v.stepSummary,b=_[_.indexOf(e.status)-1]??null,A=_[_.indexOf(e.status)+1]??null,oe=It(C,"task",e.id).count,L=e.level==="issue"?"issue":"task",ce=at(L),te=e.level==="subtask"?"136,146,255":ce.colorToken.rgb.join(", "),P=e.dueDate&&!Number.isNaN(Date.parse(e.dueDate))?ne(e.dueDate):"No due date",J=z&&z.total>0?Math.max(8,Math.round(z.completed/z.total*100)):null,g=v.git.branch,K=v.git.branchUrl,V=v.git.pullRequestNumber?`PR #${v.git.pullRequestNumber}`:null,Q=v.git.pullRequestUrl;return t.jsxs("article",{ref:h,style:{...x,"--board-card-accent":te},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",k&&"touch-none select-none",m&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[0_28px_80px_rgba(8,12,24,0.42),inset_0_0_0_1px_rgba(var(--board-card-accent),0.28)]",u&&!m&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",c?"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.18),rgba(var(--board-card-accent),0.06))] shadow-[0_16px_40px_rgba(8,12,24,0.32),inset_0_0_0_1px_rgba(var(--board-card-accent),0.26)]":"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),rgba(255,255,255,0.03))]"),"data-dragging":u?"true":"false","data-testid":`task-card-${e.id}`,onClick:()=>I(e.id),...j,...D,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${te}, 0.96), rgba(${te}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:L,label:e.level,compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 text-[10px] text-[var(--tertiary)]",children:e.priority}),v.actor?t.jsxs(S,{size:"xs",className:"shrink-0 bg-cyan-400/12 text-cyan-100",children:[t.jsx(pt,{className:"mr-1 size-3"}),v.actor]}):null]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[G?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white",onClick:f=>{f.preventDefault(),f.stopPropagation(),G(f,e)},children:t.jsx(Ze,{className:"size-3.5"})}):null,k?t.jsxs("div",{className:"flex items-center gap-1",onClick:f=>f.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!b,onClick:()=>{b&&(M==null||M(e.id,"previous"))},children:t.jsx(Fe,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!A,onClick:()=>{A&&(M==null||M(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null,o?t.jsx("button",{type:"button","aria-label":`Stop work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-rose-500/16 text-rose-200 transition hover:bg-rose-500/24",onClick:f=>{f.preventDefault(),f.stopPropagation(),U==null||U(o)},children:t.jsx(ht,{className:"size-3.5 fill-current"})}):e.status!=="done"?t.jsx("button",{type:"button","aria-label":`Start work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--primary)]/16 text-[var(--primary)] transition hover:bg-[var(--primary)]/24",onClick:f=>{f.preventDefault(),f.stopPropagation(),$==null||$(e.id)},children:t.jsx(ft,{className:"size-4 fill-current"})}):null,(X=e.splitSuggestion)!=null&&X.shouldSplit&&R?t.jsxs("button",{type:"button","aria-label":`Split ${e.title}`,className:"inline-flex items-center gap-1 rounded-full bg-amber-400/12 px-2.5 py-1 text-[10px] font-medium tracking-[0.14em] text-amber-100 transition hover:bg-amber-400/18",onClick:f=>{f.preventDefault(),f.stopPropagation(),R(e.id)},children:[t.jsx(gt,{className:"size-3.5"}),"Split it"]}):null,t.jsxs("span",{className:"shrink-0 text-[11px] text-white/44",children:[e.points," xp"]})]})]}),t.jsx(nt,{kind:L,label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-white/62",children:e.description||ee("common.executionBoard.noExecutionNote")}),z?t.jsxs("div",{className:"mt-3 rounded-[16px] border border-white/8 bg-white/[0.045] p-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] text-white/58",children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(bt,{className:"size-3.5 text-sky-200"}),z.total," step",z.total===1?"":"s"]}),t.jsxs("span",{className:"tabular-nums text-white/72",children:[z.completed,"/",z.total]})]}),t.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:t.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,rgba(56,189,248,0.96),rgba(125,211,252,0.62))]",style:{width:`${J??0}%`}})}),t.jsx("div",{className:"mt-2 grid gap-1.5",children:z.items.slice(0,2).map(f=>t.jsx("div",{className:"truncate text-[11px] text-white/55",children:f},`${e.id}-${f}`))})]}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[g?K?t.jsxs("a",{href:K,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-sky-300/18 bg-sky-400/12 px-2.5 py-1 text-[11px] text-sky-50 transition hover:bg-sky-400/18",onClick:We,children:[t.jsx(we,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:g})]}):t.jsxs(S,{size:"xs",className:"min-w-0 max-w-full bg-sky-400/12 text-sky-50",children:[t.jsx(we,{className:"mr-1 size-3"}),t.jsx("span",{className:"truncate",children:g})]}):null,V?Q?t.jsxs("a",{href:Q,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-fuchsia-300/18 bg-fuchsia-400/12 px-2.5 py-1 text-[11px] text-fuchsia-50 transition hover:bg-fuchsia-400/18",onClick:We,children:[t.jsx(Ue,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:V})]}):t.jsxs(S,{size:"xs",className:"bg-fuchsia-400/12 text-fuchsia-50",children:[t.jsx(Ue,{className:"mr-1 size-3"}),V]}):null,v.changedFileCount>0?t.jsxs(S,{size:"xs",className:"bg-amber-400/12 text-amber-50",children:[t.jsx(wt,{className:"mr-1 size-3"}),v.changedFileCount," file",v.changedFileCount===1?"":"s"]}):null,v.git.repository?t.jsx(S,{size:"xs",className:"bg-white/8 text-white/70",children:v.git.repository}):null]}),v.changedFilesPreview.length>0?t.jsx("div",{className:"mt-2 flex min-w-0 flex-wrap gap-1.5",children:v.changedFilesPreview.map(f=>t.jsx(S,{size:"xs",wrap:!0,className:"min-w-0 max-w-full bg-white/[0.06] font-mono text-[10px] text-white/65",children:f},f))}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[a?t.jsx(le,{kind:"goal",label:a.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(je,{user:e.user,compact:!0,size:"xs"}),t.jsx(Ct,{entityType:"task",entityId:e.id,count:oe,compact:!0}),e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[Math.round(e.actionPointSummary.totalCostAp)," AP"]}):null,e.actionPointSummary?t.jsx(S,{size:"xs",className:"bg-white/8 text-white/72",children:e.actionPointSummary.costBand}):null,e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[Math.round(e.actionPointSummary.expectedDurationSeconds/3600)," h target"]}):null,e.time.totalCreditedSeconds>0?t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[Math.floor(e.time.totalCreditedSeconds/60)," min"]}):null,e.time.activeRunCount>0?t.jsxs(S,{size:"xs",className:"bg-emerald-500/12 text-emerald-200",children:[e.time.activeRunCount," live"]}):null,l.slice(0,2).map(f=>t.jsx(S,{size:"xs",className:"bg-white/8",style:{color:f.color},children:f.name},f.id))]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-white/45",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[e.effort," / ",e.energy]}),t.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-2 text-right",children:[e.status==="done"&&B?t.jsx("button",{type:"button",className:"rounded-full bg-white/8 px-3 py-1 text-[10px] tracking-[0.16em] text-white transition hover:bg-white/12",onClick:f=>{f.preventDefault(),f.stopPropagation(),B(e.id)},children:ee("common.executionBoard.reopen")}):null,t.jsx("span",{children:P})]})]})]})}function fe(e){const{task:a,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:x,isDragging:h}=et({id:l,data:{type:"task",taskId:a.id,status:a.status}});return t.jsx(lt,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:h,isMobile:e.isMobile,onStartTask:e.onStartTask,onStopTask:e.onStopTask,onStepTask:e.onStepTask,onSplitTask:e.onSplitTask,notesSummaryByEntity:e.notesSummaryByEntity,style:{transform:tt.Transform.toString(m),transition:x}})}function ot({project:e,goal:a,isDragging:l=!1,isOverlay:o=!1,style:c,setNodeRef:u,dragAttributes:m,dragListeners:x,isMobile:h=!1,onStepProject:j,onOpenMenu:D}){const{formatDate:k}=ye(),I=_[_.indexOf(e.workflowStatus)-1]??null,$=_[_.indexOf(e.workflowStatus)+1]??null,B=at("project").colorToken.rgb.join(", "),M=e.workflowStatus.replaceAll("_"," "),R=e.status.replaceAll("_"," "),G=e.updatedAt&&!Number.isNaN(Date.parse(e.updatedAt))?k(e.updatedAt):"No recent update";return t.jsxs("article",{ref:u,style:{...c,"--board-card-accent":B},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",h&&"touch-none select-none",o&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[0_28px_80px_rgba(8,12,24,0.42),inset_0_0_0_1px_rgba(var(--board-card-accent),0.28)]",l&&!o&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",!l&&!o&&"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),rgba(255,255,255,0.03))]"),"data-testid":`project-card-${e.id}`,...m,...x,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${B}, 0.96), rgba(${B}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:"project",label:"project",compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--primary)]/12 text-[var(--primary)]",children:M}),t.jsx(S,{size:"xs",className:"shrink-0 bg-white/8 text-white/72",children:R})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[D?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white",onClick:C=>{C.preventDefault(),C.stopPropagation(),D(C,e)},children:t.jsx(Ze,{className:"size-3.5"})}):null,h?t.jsxs("div",{className:"flex items-center gap-1",onClick:C=>C.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!I,onClick:()=>{I&&(j==null||j(e.id,"previous"))},children:t.jsx(Fe,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white disabled:opacity-35",disabled:!$,onClick:()=>{$&&(j==null||j(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null]})]}),t.jsx(nt,{kind:"project",label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-white/62",children:e.description||"PRD-backed initiative spanning multiple work items."}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[a?t.jsx(le,{kind:"goal",label:a.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(je,{user:e.user,compact:!0,size:"xs"}),(e.assignees??[]).slice(0,2).map(C=>t.jsx(je,{user:C,compact:!0,size:"xs"},C.id)),t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[e.progress,"% progress"]}),t.jsxs(S,{size:"xs",className:"bg-white/8 text-white/72",children:[e.totalTasks," linked tasks"]})]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-white/45",children:[t.jsx("span",{className:"min-w-0 truncate",children:e.goalTitle}),t.jsx("span",{children:G})]})]})}function ge(e){const{project:a,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:x,isDragging:h}=et({id:l,data:{type:"project",projectId:a.id,status:a.workflowStatus}});return t.jsx(ot,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:h,style:{transform:tt.Transform.toString(m),transition:x}})}function Je({droppableId:e,status:a,title:l,detail:o,count:c,dragging:u,children:m}){const{setNodeRef:x,isOver:h}=Te({id:e,data:{type:"lane",status:a}});return t.jsx("div",{ref:x,className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[24px] transition",h&&"scale-[1.005]"),"data-lane-id":a,"data-testid":`kanban-lane-${a}`,"data-lane-hover":h?"true":"false",children:t.jsxs(it,{className:W("h-full w-full max-w-full min-w-0 overflow-hidden p-3 transition-[background-color,box-shadow,border-color,transform]",u&&"border border-white/8",h?"border border-[rgba(125,211,252,0.38)] bg-[linear-gradient(180deg,rgba(125,211,252,0.12),rgba(125,211,252,0.05))] shadow-[0_18px_54px_rgba(14,165,233,0.12)]":"border border-transparent"),children:[t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"type-label text-white/45",children:o}),t.jsx("h3",{className:"mt-1 break-words text-[1.45rem] leading-[1] text-white",children:l})]}),t.jsx("div",{className:"shrink-0 font-display text-[1.45rem] text-[var(--primary)]",children:c})]}),t.jsx("div",{className:W("grid w-full max-w-full min-w-0 min-h-48 content-start gap-2 rounded-[18px] p-2 transition",h?"bg-[rgba(125,211,252,0.08)]":"bg-white/[0.02]"),children:m})]})})}function Ut({title:e,detail:a,children:l}){return t.jsxs("div",{className:"rounded-[20px] border border-cyan-300/20 bg-[linear-gradient(180deg,rgba(34,211,238,0.11),rgba(11,23,34,0.34))] p-2.5 shadow-[inset_0_0_0_1px_rgba(34,211,238,0.08)]",children:[t.jsx("div",{className:"mb-2 flex items-start justify-between gap-3 px-1",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-cyan-100/86",children:[t.jsx(we,{className:"size-3.5"}),t.jsx("span",{className:"truncate",children:e})]}),a?t.jsx("div",{className:"mt-1 text-[11px] text-white/45",children:a}):null]})}),t.jsx("div",{className:"grid gap-2",children:l})]})}function Pt({droppableId:e,title:a,detail:l}){const{setNodeRef:o,isOver:c}=Te({id:e,data:{type:"trash"}});return t.jsx("div",{ref:o,className:W("pointer-events-auto fixed right-4 top-4 z-50 w-[min(18rem,calc(100vw-2rem))] rounded-[28px] border px-5 py-4 shadow-[0_24px_80px_rgba(6,10,20,0.48)] backdrop-blur-2xl transition lg:right-6 lg:top-6",c?"border-rose-300/38 bg-[linear-gradient(180deg,rgba(244,63,94,0.28),rgba(120,24,42,0.46))] text-white scale-[1.02]":"border-white/10 bg-[linear-gradient(180deg,rgba(18,24,38,0.96),rgba(10,14,24,0.94))] text-white/84"),"data-testid":"kanban-trash-dropzone","data-trash-hover":c?"true":"false",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:W("flex size-12 items-center justify-center rounded-full border transition",c?"border-white/28 bg-white/12":"border-white/12 bg-white/6"),children:t.jsx(ve,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/55",children:"Bin"}),t.jsx("div",{className:"mt-1 text-base font-medium text-white",children:a}),t.jsx("div",{className:"mt-1 text-sm leading-5 text-white/62",children:l})]})]})})}function Jt({tasks:e,projects:a=[],activeRuns:l=[],goals:o,tags:c,selectedTaskId:u,onMove:m,onMoveProject:x,onSelectTask:h,onStartTask:j,onStopTask:D,onQuickReopenTask:k,onDeleteTask:I,onOpenProject:$,onOpenTask:U,onEditProject:B,onEditTask:M,onLinkProject:R,onLinkTask:G,onCreateIssueForProject:C,onCreateTaskForIssue:ee,onCreateSubtaskForTask:ne,onSplitTask:v,notesSummaryByEntity:z}){var $e,Be;const{t:b}=ye(),A=N.useId(),oe=`${A}:trash`,[L,ce]=N.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 1023px)").matches),te=jt(vt(_t,{activationConstraint:{distance:6}})),[P,J]=N.useState(null),[g,K]=N.useState(null),[V,Q]=N.useState(null),[X,f]=N.useState(null),[Ne,ct]=N.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("forge.kanban-skip-delete-confirmation")==="true"),[ke,se]=N.useState(!1),[Se,Z]=N.useState({}),[_e,ie]=N.useState({}),re={backlog:{title:b("common.executionBoard.laneBacklogTitle"),detail:b("common.executionBoard.laneBacklogDetail")},focus:{title:b("common.executionBoard.laneFocusTitle"),detail:b("common.executionBoard.laneFocusDetail")},in_progress:{title:b("common.executionBoard.laneProgressTitle"),detail:b("common.executionBoard.laneProgressDetail")},blocked:{title:b("common.executionBoard.laneBlockedTitle"),detail:b("common.executionBoard.laneBlockedDetail")},done:{title:b("common.executionBoard.laneDoneTitle"),detail:b("common.executionBoard.laneDoneDetail")}},F=N.useMemo(()=>e.map(i=>{const n=Se[i.id];return n?{...i,status:n}:i}),[Se,e]),Y=N.useMemo(()=>a.map(i=>{const n=_e[i.id];return n?{...i,workflowStatus:n}:i}),[_e,a]),Ie=N.useMemo(()=>{const i=new Map;for(const n of l){if(n.status!=="active")continue;const s=i.get(n.taskId);(!s||n.isCurrent||n.updatedAt>s.updatedAt)&&i.set(n.taskId,n)}return i},[l]),H=N.useMemo(()=>[...Y.map(i=>({kind:"project",id:i.id,status:i.workflowStatus,project:i,goal:o.find(n=>n.id===i.goalId)})),...F.map(i=>({kind:"task",id:i.id,status:i.status,task:i,goal:o.find(n=>n.id===i.goalId),tags:i.tagIds.map(n=>c.find(s=>s.id===n)).filter(Boolean),activeRun:Ie.get(i.id)??null}))],[Ie,Y,F,o,c]),O=P?H.find(i=>i.id===P)??null:null,dt=N.useMemo(()=>{if(!g)return[];if(g.kind==="project"){const n=Y.find(s=>s.id===g.entityId);return n?[{id:"open-project",label:"Open",description:"Jump to the project detail view.",icon:Ke,onSelect:()=>$==null?void 0:$(n.id)},{id:"edit-project",label:"Edit",description:"Open the guided project editor.",icon:Qe,onSelect:()=>B==null?void 0:B(n.id)},{id:"link-project",label:"Link",description:"Open the anchor step to relink the project to its goal.",icon:Xe,onSelect:()=>R==null?void 0:R(n.id)},{id:"create-issue",label:"Create issue",description:"Break this project into a new vertical slice issue.",icon:be,onSelect:()=>C==null?void 0:C(n.id)},..._.filter(s=>s!==n.workflowStatus).map(s=>({id:`move-project-${s}`,label:`Move to ${s.replaceAll("_"," ")}`,description:"Update the project workflow lane without leaving the board.",onSelect:()=>void(x==null?void 0:x(n.id,s))}))]:[]}const i=F.find(n=>n.id===g.entityId);return i?Bt({task:i,onOpenTask:U,onEditTask:M,onLinkTask:G,onCreateTaskForIssue:ee,onCreateSubtaskForTask:ne,onMove:m,onDeleteTask:I,deletePendingTaskId:X,onRequestDelete:De}):[]},[Y,F,g,C,ne,ee,B,M,R,G,m,x,I,$,U,X,Ne]);function Ce(i){var s;if(i.length===0)return t.jsx("div",{className:"w-full max-w-full rounded-[18px] border border-dashed border-white/8 px-4 py-8 text-center text-sm text-white/35",children:b("common.executionBoard.emptyLane")});if(((s=i[0])==null?void 0:s.status)!=="in_progress")return i.map(d=>d.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${d.task.id}`,task:d.task,goal:d.goal,tags:d.tags,activeRun:d.activeRun,isSelected:u===d.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},d.task.id):t.jsx(ge,{sortableId:`${A}:project:${d.project.id}`,project:d.project,goal:d.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},d.project.id));const n=new Map;for(const d of i){if(d.kind!=="task"||!d.activeRun){const E=n.get("ungrouped");E?E.items.push(d):n.set("ungrouped",{title:"Active work",detail:"Tasks in progress without a tracked branch",items:[d]});continue}const p=st(d.task,d.activeRun),r=[d.activeRun.actor,p.git.repository??"",p.git.branch??""].join("::"),w=n.get(r);if(w){w.items.push(d);continue}n.set(r,{title:Rt(d.activeRun,p.git.branch),detail:Ot(d.activeRun,p.git.repository),items:[d]})}return Array.from(n.entries()).map(([d,p])=>d==="ungrouped"?p.items.map(r=>r.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${r.task.id}`,task:r.task,goal:r.goal,tags:r.tags,activeRun:r.activeRun,isSelected:u===r.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},r.task.id):t.jsx(ge,{sortableId:`${A}:project:${r.project.id}`,project:r.project,goal:r.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},r.project.id)):t.jsx(Ut,{title:p.title,detail:p.detail,children:p.items.map(r=>r.kind==="task"?t.jsx(fe,{sortableId:`${A}:task:${r.task.id}`,task:r.task,goal:r.goal,tags:r.tags,activeRun:r.activeRun,isSelected:u===r.task.id,isMobile:L,onSelect:h,onStartTask:j,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:v,notesSummaryByEntity:z},r.task.id):t.jsx(ge,{sortableId:`${A}:project:${r.project.id}`,project:r.project,goal:r.goal,isMobile:L,onStepProject:ue,onOpenMenu:xe},r.project.id))},d))}N.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 1023px)"),n=s=>{ce(s?s.matches:i.matches)};return n(),typeof i.addEventListener=="function"?(i.addEventListener("change",n),()=>i.removeEventListener("change",n)):(i.addListener(n),()=>i.removeListener(n))},[]),N.useEffect(()=>{if(!P){document.body.style.cursor="";return}return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[P]),N.useEffect(()=>{Z(i=>{const n=new Set(e.map(p=>p.id));let s=!1;const d={};for(const[p,r]of Object.entries(i)){const w=e.find(E=>E.id===p);if(!n.has(p)||!w||w.status===r){s=!0;continue}d[p]=r}return s?d:i})},[e]),N.useEffect(()=>{ie(i=>{const n=new Set(a.map(p=>p.id));let s=!1;const d={};for(const[p,r]of Object.entries(i)){const w=a.find(E=>E.id===p);if(!n.has(p)||!w||w.workflowStatus===r){s=!0;continue}d[p]=r}return s?d:i})},[a]);function ut(i){var d,p;const n=(d=i.active.data.current)==null?void 0:d.taskId,s=(p=i.active.data.current)==null?void 0:p.projectId;typeof n=="string"?J(n):typeof s=="string"&&J(s)}const mt=i=>{ct(i),typeof window<"u"&&window.localStorage.setItem("forge.kanban-skip-delete-confirmation","true")},ze=async(i,n)=>{if(I){f(i.id);try{n&&mt(!0),await I(i.id),Q(null),se(!1),Z(s=>{const d={...s};return delete d[i.id],d})}finally{f(null)}}};function De(i){if(I){if(Ne){ze(i,!1);return}se(!1),Q(i)}}async function xt(i){var Me,Ae,Le,Ee,Re,Oe;const{active:n,over:s}=i;if(J(null),!s||n.id===s.id)return;const d=typeof((Me=n.data.current)==null?void 0:Me.taskId)=="string"?n.data.current.taskId:null,p=typeof((Ae=n.data.current)==null?void 0:Ae.projectId)=="string"?n.data.current.projectId:null,r=(d?H.find(y=>y.kind==="task"&&y.id===d):null)??(p?H.find(y=>y.kind==="project"&&y.id===p):null);if(!r)return;if(((Le=s.data.current)==null?void 0:Le.type)==="trash"){if(r.kind!=="task"||!I)return;De(r.task);return}const w=typeof((Ee=s.data.current)==null?void 0:Ee.status)=="string"?s.data.current.status:null,E=typeof((Re=s.data.current)==null?void 0:Re.taskId)=="string"?s.data.current.taskId:null,q=typeof((Oe=s.data.current)==null?void 0:Oe.projectId)=="string"?s.data.current.projectId:null,pe=(E?H.find(y=>y.kind==="task"&&y.id===E):null)??(q?H.find(y=>y.kind==="project"&&y.id===q):null),T=w??(pe==null?void 0:pe.status)??r.status;if(!(T===r.status||!_.includes(T))){if(r.kind==="task"){Z(y=>({...y,[r.task.id]:T}));try{await m(r.task.id,T)}catch(y){throw Z(he=>{const ae={...he};return delete ae[r.task.id],ae}),y}return}if(x){ie(y=>({...y,[r.project.id]:T}));try{await x(r.project.id,T)}catch(y){throw ie(he=>{const ae={...he};return delete ae[r.project.id],ae}),y}}}}async function de(i,n){const s=F.find(w=>w.id===i);if(!s)return;const d=_.indexOf(s.status),p=n==="previous"?d-1:d+1,r=_[p]??null;if(!(!r||r===s.status)){Z(w=>({...w,[s.id]:r}));try{await m(s.id,r)}catch(w){throw Z(E=>{const q={...E};return delete q[s.id],q}),w}}}async function ue(i,n){const s=Y.find(w=>w.id===i);if(!s||!x)return;const d=_.indexOf(s.workflowStatus),p=n==="previous"?d-1:d+1,r=_[p]??null;if(!(!r||r===s.workflowStatus)){ie(w=>({...w,[s.id]:r}));try{await x(s.id,r)}catch(w){throw ie(E=>{const q={...E};return delete q[s.id],q}),w}}}function me(i,n){const s=i.currentTarget.getBoundingClientRect();K({kind:"task",entityId:n.id,position:{x:s.right-8,y:s.bottom+8}})}function xe(i,n){const s=i.currentTarget.getBoundingClientRect();K({kind:"project",entityId:n.id,position:{x:s.right-8,y:s.bottom+8}})}return t.jsxs(yt,{sensors:te,collisionDetection:Et,onDragStart:ut,onDragCancel:()=>J(null),onDragEnd:i=>void xt(i),children:[(O==null?void 0:O.kind)==="task"&&I?t.jsx(Pt,{droppableId:oe,title:b("common.executionBoard.deleteDropTitle"),detail:b("common.executionBoard.deleteDropDetail")}):null,t.jsx("div",{className:"w-full max-w-full min-w-0 pb-2",children:L?t.jsx("div",{className:"grid w-full max-w-full min-w-0 gap-2",children:_.map(i=>{const n=H.filter(s=>s.status===i);return t.jsx(Pe,{items:n.map(s=>`${A}:${s.kind}:${s.id}`),strategy:Ve,children:t.jsx(Je,{droppableId:`${A}:lane:${i}`,status:i,title:re[i].title,detail:re[i].detail,count:n.length,dragging:P!==null,children:Ce(n)})},i)})}):t.jsx("div",{className:"grid w-full min-w-0 gap-0.5 xl:grid-cols-[repeat(5,minmax(0,1fr))]",children:_.map(i=>{const n=H.filter(s=>s.status===i);return t.jsx(Pe,{items:n.map(s=>`${A}:${s.kind}:${s.id}`),strategy:Ve,children:t.jsx(Je,{droppableId:`${A}:lane:${i}`,status:i,title:re[i].title,detail:re[i].detail,count:n.length,dragging:P!==null,children:Ce(n)})},i)})})}),t.jsx(Nt,{adjustScale:!1,dropAnimation:null,children:O?t.jsx("div",{className:"w-[20rem] max-w-[calc(100vw-2rem)]",children:O.kind==="task"?t.jsx(lt,{task:O.task,goal:O.goal,tags:O.tags,activeRun:O.activeRun,isSelected:u===O.task.id,isDragging:!0,isOverlay:!0,isMobile:L,onSelect:()=>{},onStartTask:j,onSplitTask:v,notesSummaryByEntity:z}):t.jsx(ot,{project:O.project,goal:O.goal,isDragging:!0,isOverlay:!0,isMobile:L})}):null}),t.jsx(zt,{open:g!==null,title:(g==null?void 0:g.kind)==="project"?(($e=Y.find(i=>i.id===g.entityId))==null?void 0:$e.title)??"Project actions":((Be=F.find(i=>i.id===(g==null?void 0:g.entityId)))==null?void 0:Be.title)??"Work item actions",subtitle:(g==null?void 0:g.kind)==="project"?"Edit, relink, move, or break this project into issues.":"Edit, relink, move, or create the next child work item.",items:dt,position:(g==null?void 0:g.position)??null,onClose:()=>K(null)}),V?t.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-[rgba(5,8,18,0.74)] p-4 backdrop-blur-xl",children:t.jsxs(it,{className:"w-full max-w-md border border-white/10 bg-[linear-gradient(180deg,rgba(16,22,36,0.96),rgba(9,13,22,0.98))] shadow-[0_32px_90px_rgba(5,8,18,0.58)]",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"mt-1 flex size-11 shrink-0 items-center justify-center rounded-full bg-rose-500/14 text-rose-100",children:t.jsx(ve,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-display text-[1.35rem] leading-tight text-white",children:b("common.executionBoard.deleteConfirmTitle")}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-white/64",children:b("common.executionBoard.deleteConfirmDescription",{title:V.title})})]})]}),t.jsxs("label",{className:"mt-5 flex items-center gap-3 rounded-[18px] bg-white/[0.05] px-4 py-3 text-sm text-white/76",children:[t.jsx("input",{type:"checkbox",checked:ke,onChange:i=>se(i.target.checked),className:"size-4 rounded border-white/20 bg-transparent text-[var(--primary)]"}),t.jsx("span",{children:b("common.executionBoard.deleteConfirmCheckbox")})]}),t.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[t.jsx(qe,{variant:"secondary",onClick:()=>{Q(null),se(!1)},children:b("common.executionBoard.deleteConfirmCancel")}),t.jsx(qe,{className:"bg-[linear-gradient(135deg,rgba(251,113,133,0.3),rgba(190,24,93,0.26))] text-white shadow-[0_16px_36px_rgba(190,24,93,0.18)]",pending:X===V.id,pendingLabel:b("common.executionBoard.deletingTask"),onClick:()=>void ze(V,ke),children:b("common.executionBoard.deleteConfirmSubmit")})]})]})}):null]})}export{Jt as E};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as h,F as m,j as t,aK as p}from"./vendor-kIz9EZnX.js";import{Z as l}from"./index-BHIKoiZ6.js";function f({open:s,title:c,subtitle:a,items:x,position:i,onClose:n}){return h.useEffect(()=>{if(!s)return;let e=!1;const r=window.setTimeout(()=>{e=!0},0),o=w=>{w.key==="Escape"&&n()},d=()=>{e&&n()};return window.addEventListener("keydown",o),window.addEventListener("pointerdown",d),()=>{window.clearTimeout(r),window.removeEventListener("keydown",o),window.removeEventListener("pointerdown",d)}},[n,s]),!s||!i||typeof document>"u"?null:m.createPortal(t.jsx("div",{className:"fixed inset-0 z-[70]","aria-hidden":"true",children:t.jsxs("div",{className:"fixed z-[71] flex max-h-[min(34rem,calc(100dvh-1.5rem))] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[26px] border border-white/10 bg-[rgba(10,15,27,0.97)] p-2 shadow-[0_28px_80px_rgba(4,8,18,0.4)] backdrop-blur-xl",style:{left:Math.min(i.x,window.innerWidth-24-352),top:Math.min(i.y,window.innerHeight-24-544)},onPointerDown:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[20px] bg-white/[0.03] px-4 py-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-white",children:c}),a?t.jsx("div",{className:"mt-1 text-xs leading-5 text-white/50",children:a}):null]}),t.jsx("button",{type:"button",className:"rounded-full bg-white/[0.04] p-2 text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:n,children:t.jsx(p,{className:"size-4"})})]}),t.jsx("div",{className:"mt-2 min-h-0 overflow-y-auto overscroll-contain pr-1",children:t.jsx("div",{className:"grid gap-1",children:x.map(e=>{const r=e.icon;return t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),n())},className:l("flex w-full items-start gap-3 rounded-[20px] px-4 py-3 text-left transition",e.disabled?"cursor-not-allowed bg-white/[0.02] text-white/28":e.tone==="danger"?"bg-rose-400/[0.05] text-rose-100 hover:bg-rose-400/[0.12]":"bg-white/[0.03] text-white/76 hover:bg-white/[0.08] hover:text-white"),children:[r?t.jsx("span",{className:l("mt-0.5 rounded-[14px] p-2",e.disabled?"bg-white/[0.03] text-white/28":e.tone==="danger"?"bg-rose-400/[0.12] text-rose-100":"bg-[var(--primary)]/12 text-[var(--primary)]"),children:t.jsx(r,{className:"size-4"})}):null,t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-medium",children:e.label}),e.description?t.jsx("span",{className:"mt-1 block text-xs leading-5 text-white/48",children:e.description}):null]})]},e.id)})})})]})}),document.body)}export{f as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cc as F,b5 as q,r as o,j as e,aC as p}from"./vendor-kIz9EZnX.js";import{j as A,k as H}from"./state-VYvD1QVP.js";import{P as L,u as z,s as K,i as Q,R as $,a as X,V as T,U as C,B as g,C as v,b as w,c as h,W as _,X as V,Y as W}from"./index-BHIKoiZ6.js";import{O as Y}from"./open-in-graph-button-C0TGev7c.js";import{N as J}from"./note-markdown-CsGQhQXF.js";import{E as Z}from"./entity-notes-surface-CBylYDwy.js";import{P as ee}from"./preference-entity-handoff-button-DOKV9bZc.js";import{b as te,f as se,P as ae}from"./project-collections-CZagCmeH.js";import{P as ie}from"./page-hero-oFHaAjtL.js";import{g as le,a as ne}from"./activity-copy-Bj4h9OcF.js";import{g as oe}from"./entity-links-DwpxhW2H.js";import"./motion-CfdU2F35.js";import"./ui-CsEkP2V8.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";import"./note-tags-input-DdZi93tj.js";function ke(){const{t:s}=L(),i=z(),d=F(),G=q(),u=A(),[O,N]=o.useState(!1),[S,y]=o.useState(!1),[m,B]=o.useState("active"),j=K(i.selectedUserIds),[E,b]=o.useState(null),D=H({mutationFn:()=>$(d.goalId),onSuccess:async()=>{await Promise.all([Q(u),u.invalidateQueries({queryKey:["project-board"]}),u.invalidateQueries({queryKey:["task-context"]})]),G("/goals")}}),a=i.snapshot.dashboard.goals.find(t=>t.id===d.goalId)??null,x=o.useMemo(()=>i.snapshot.dashboard.projects.filter(t=>t.goalId===d.goalId),[d.goalId,i.snapshot.dashboard.projects]),R=o.useMemo(()=>te(x),[x]),n=o.useMemo(()=>se(x,m),[x,m]),k=new Set(x.map(t=>t.id)),I=new Set(i.snapshot.tasks.filter(t=>k.has(t.projectId??"")).map(t=>t.id)),f=i.snapshot.activity.filter(t=>t.entityId===d.goalId||k.has(t.entityId)||I.has(t.entityId)||t.entityType==="task_run"&&typeof t.metadata.taskId=="string"&&I.has(t.metadata.taskId));if(!a)return e.jsx(X,{eyebrow:s("common.goalDetail.eyebrow"),title:s("common.goalDetail.missingTitle"),description:s("common.goalDetail.missingDescription"),action:e.jsx(p,{to:"/goals",className:"inline-flex min-h-10 min-w-0 max-w-full items-center justify-center whitespace-nowrap rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-medium text-slate-950 transition hover:opacity-90",children:s("common.goalDetail.backToGoals")})});const l=n.find(t=>t.nextTaskTitle)??n[0]??null,r=i.snapshot.overview.neglectedGoals.find(t=>t.goalId===a.id)??null,c=f[0]??null,M=async t=>{b(t);try{await i.patchProject(t,{status:"active"})}finally{b(null)}},U=async()=>{window.confirm(s("common.goalDetail.deleteGoalConfirm",{title:a.title}))&&await D.mutateAsync()};return e.jsxs("div",{className:"grid min-w-0 gap-5",children:[e.jsx(ie,{entityKind:"goal",title:e.jsx(T,{kind:"goal",label:a.title,variant:"heading",size:"lg"}),titleText:a.title,description:a.description?e.jsx(J,{markdown:a.description,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"}):"No strategic description yet.",badge:s(n.length===1?"common.goalDetail.heroBadgeOne":"common.goalDetail.heroBadgeOther",{count:n.length}),actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ee,{userId:j,domain:"projects",entityType:"goal",entityId:a.id,label:a.title,description:a.description}),e.jsx(Y,{entityType:"goal",entityId:a.id})]})}),a.user?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/62",children:[e.jsx("span",{className:"text-white/42",children:"Owned by"}),e.jsx(C,{user:a.user})]}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(g,{onClick:()=>N(!0),children:s("common.goalDetail.edit")}),e.jsx(g,{variant:"secondary",onClick:()=>y(!0),children:s("common.goalDetail.addProject")}),e.jsx(g,{variant:"ghost",className:"text-rose-200 hover:bg-rose-500/10",pending:D.isPending,pendingLabel:s("common.goalDetail.deleting"),onClick:()=>void U(),children:s("common.goalDetail.deleteGoal")})]}),e.jsxs("section",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsxs(v,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionProjects")}),e.jsx(ae,{value:m,counts:R,onChange:B,className:"justify-end"})]}),n.length===0?e.jsx("div",{className:"mt-4 rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:m==="active"?s("common.goalDetail.noProjects"):"No projects match this lifecycle filter yet. Switch filters or restart one to make it active again."}):e.jsx("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:n.map(t=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] p-5 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(w,{kind:"project",compact:!0,gradient:!1}),t.user?e.jsx(C,{user:t.user,compact:!0}):null]}),e.jsx(h,{children:t.status})]}),e.jsx("div",{className:"mt-4",children:e.jsx(p,{to:`/projects/${t.id}`,className:"transition hover:opacity-90",children:e.jsx(T,{kind:"project",label:t.title,variant:"heading",size:"lg"})})}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/58",children:t.description}),e.jsx("div",{className:"mt-4",children:e.jsx(_,{value:t.progress})}),e.jsx("div",{className:"mt-4 text-[11px] uppercase tracking-[0.16em] text-white/40",children:t.nextTaskTitle?s("common.goalDetail.nextMove",{value:t.nextTaskTitle}):s("common.goalDetail.addNextTask")}),e.jsxs("div",{className:"mt-4 flex flex-wrap justify-between gap-3",children:[e.jsx(p,{to:`/projects/${t.id}`,children:e.jsx(g,{variant:"ghost",children:"Open project"})}),m!=="active"&&t.status!=="active"?e.jsx(g,{variant:"secondary",size:"sm",pending:E===t.id,pendingLabel:"Restarting…",onClick:()=>void M(t.id),children:"Restart"}):null]})]},t.id))})]}),e.jsx("div",{className:"grid min-w-0 gap-5",children:e.jsxs(v,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionHealth")}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(w,{kind:"goal",compact:!0,gradient:!1}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s("common.goalDetail.progressTitle",{progress:a.progress,count:a.completedTasks})}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s("common.goalDetail.progressDetail",{xp:a.earnedPoints})}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s(n.length===1?"common.goalDetail.heroBadgeOne":"common.goalDetail.heroBadgeOther",{count:n.length})})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldProgress")}),e.jsxs("div",{className:"mt-2 font-display text-xl text-white",children:[a.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldCompletedTasks")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a.completedTasks})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:s("common.goalDetail.fieldXpBanked")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a.earnedPoints})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalNext")}),l?e.jsx(w,{kind:"project",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(l==null?void 0:l.title)??s("common.goalDetail.noProject")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:l!=null&&l.nextTaskTitle?s("common.goalDetail.nextMove",{value:l.nextTaskTitle}):(l==null?void 0:l.description)||s("common.goalDetail.noProjectDetail")})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalRisk")}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(r==null?void 0:r.title)??s("common.goalDetail.noRisk")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(r==null?void 0:r.summary)||s("common.goalDetail.noRiskDetail")})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:s("common.goalDetail.signalEvidence")}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(c==null?void 0:c.title)??s("common.goalDetail.noEvidence")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(c==null?void 0:c.description)||s("common.goalDetail.noEvidenceDetail")})]})]})]})]})})]}),e.jsx(Z,{entityType:"goal",entityId:a.id,title:"Goal notes",description:"Use notes to capture strategy changes, meaning shifts, and progress context that belongs at the goal level."}),e.jsxs(v,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s("common.goalDetail.sectionEvidence")}),f.length===0?e.jsx("div",{className:"mt-4 rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:s("common.goalDetail.noEvidenceLogged")}):e.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:f.slice(0,6).map(t=>e.jsxs(p,{to:oe(t)??`/activity?eventId=${t.id}`,className:"rounded-[18px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsx("div",{className:"font-medium text-white",children:le(t)}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:ne(t)})]},t.id))})]}),e.jsx(V,{open:O,editingGoal:a,tags:i.snapshot.tags,users:i.snapshot.users,defaultUserId:a.userId??j,onOpenChange:N,onSubmit:async(t,P)=>{P&&await i.patchGoal(P,t)}}),e.jsx(W,{open:S,goals:i.snapshot.goals,users:i.snapshot.users,editingProject:null,initialGoalId:a.id,defaultUserId:a.userId??j,onOpenChange:y,onSubmit:async t=>{await i.createProject(t)}})]})}export{ke as GoalDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as g,j as e,aC as b,c4 as P,b8 as C}from"./vendor-kIz9EZnX.js";import{P as S}from"./page-hero-oFHaAjtL.js";import{E as G}from"./entity-note-count-link-BrS1-O0o.js";import{C as N,B as y,b as k,V as p,c as l,X as E,Z as f,u as z,s as L,a as T,_ as B,U as I,W as R}from"./index-BHIKoiZ6.js";import{P as D}from"./pill-cluster-7UZd_lHp.js";import{b as F,f as U,P as M}from"./project-collections-CZagCmeH.js";import"./state-VYvD1QVP.js";import"./motion-CfdU2F35.js";import"./ui-CsEkP2V8.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";function O({goals:s,tags:n,users:c,defaultUserId:o=null,pending:d=!1,onCreate:r,onUpdate:j}){const[u,x]=g.useState(!1),[w,m]=g.useState(null),a=s.find(t=>t.id===w)??null;return e.jsxs(e.Fragment,{children:[e.jsxs(N,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Goal arcs"}),e.jsx("h3",{className:"mt-2 font-display text-3xl text-white",children:"Strategic arcs before tickets"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-7 text-white/60",children:"This is the long-horizon map. Each arc shows why it matters, how much ground has been covered, and which project should move next."})]}),e.jsx(y,{onClick:()=>{m(null),x(!0)},children:"Create goal"})]}),e.jsxs("div",{className:"mt-5 grid gap-3 xl:grid-cols-2",children:[s.length===0?e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] p-5 text-sm leading-7 text-white/60 xl:col-span-2",children:"Start with a life goal. Once the destination is clear, you can attach projects and then fill those projects with tasks."}):null,s.map(t=>{const h=`${Math.max(6,Math.min(100,t.progress))}%`;return e.jsxs(b,{to:`/goals/${t.id}`,className:"rounded-[24px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.09),rgba(255,255,255,0.04))]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(k,{kind:"goal",compact:!0,gradient:!1}),e.jsx("div",{className:"mt-2",children:e.jsx(p,{kind:"goal",label:t.title,variant:"heading",size:"lg",showKind:!1,lines:2})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/58",children:t.description||"No strategic note attached yet."})]}),e.jsx("button",{className:"rounded-full bg-white/6 p-2 text-white/60 transition hover:bg-white/10 hover:text-white",type:"button",onClick:i=>{i.preventDefault(),i.stopPropagation(),m(t.id),x(!0)},children:e.jsx(P,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(l,{className:"bg-white/[0.08] text-white/70",children:t.horizon}),e.jsx(l,{className:t.status==="active"?"text-emerald-300":t.status==="paused"?"text-amber-300":"text-[var(--tertiary)]",children:t.status}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.earnedPoints," / ",t.targetPoints," xp"]}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.totalTasks," tasks"]})]}),e.jsx("div",{className:"mt-4 h-1.5 rounded-full bg-white/[0.08]",children:e.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary)_0%,var(--secondary)_100%)]",style:{width:h}})}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.tags.map(i=>e.jsx(l,{className:"bg-white/[0.06] text-white/58",children:i.name},i.id))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.16em] text-white/42",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.momentumLabel}),e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",style:{color:t.themeColor},children:["Open arc",e.jsx(C,{className:"size-3.5"})]})]})]},t.id)})]})]}),e.jsx(E,{open:u,pending:d,editingGoal:a,tags:n,users:c,defaultUserId:o,onOpenChange:t=>{x(t),t||m(null)},onSubmit:async(t,h)=>{if(h){await j(h,t);return}await r(t)}})]})}function _({eyebrow:s,title:n,description:c,meta:o,actions:d,className:r}){return e.jsxs("div",{className:f("flex flex-wrap items-start justify-between gap-3",r),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[s?e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:s}):null,e.jsxs("div",{className:f("min-w-0",s&&"mt-2"),children:[e.jsx("div",{className:"min-w-0 text-lg text-[var(--ui-ink-strong)]",children:n}),c?e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:c}):null]})]}),o||d?e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[o,d]}):null]})}function ee(){const s=z(),[n,c]=g.useState("active"),[o,d]=g.useState(null),r=s.snapshot.dashboard.goals.length>0,j=F(s.snapshot.dashboard.projects),u=U(s.snapshot.dashboard.projects,n),x=L(s.selectedUserIds),w=new Map(s.snapshot.dashboard.goals.map(a=>[a.id,u.filter(t=>t.goalId===a.id)])),m=async a=>{d(a);try{await s.patchProject(a,{status:"active"})}finally{d(null)}};return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(S,{entityKind:"goal",title:e.jsx(p,{kind:"goal",label:"Life Goals",variant:"heading",size:"lg"}),titleText:"Life Goals",description:"Life goals are the destinations you care about over the long run. Each one can hold several projects, and those projects turn direction into real work.",badge:`${s.snapshot.dashboard.goals.length} active goals`,actions:r?e.jsxs("div",{className:"inline-flex min-h-10 items-center rounded-full border border-white/8 bg-white/[0.04] px-4 py-2 text-sm whitespace-nowrap text-white/68",children:[s.snapshot.dashboard.projects.length," live project",s.snapshot.dashboard.projects.length===1?"":"s"," ","attached"]}):null}),e.jsx(O,{goals:s.snapshot.dashboard.goals,tags:s.snapshot.tags,users:s.snapshot.users,defaultUserId:x,onCreate:s.createGoal,onUpdate:s.patchGoal}),r?e.jsx(M,{value:n,counts:j,onChange:c}):null,r?null:e.jsx(T,{eyebrow:"Life goals",title:"No life goals yet",description:"Define the first long-horizon direction above so Forge can attach projects, tasks, momentum, and evidence to something meaningful."}),r?e.jsx("div",{className:"grid gap-4",children:s.snapshot.dashboard.goals.map(a=>{const t=w.get(a.id)??[],h=B(s.snapshot.dashboard.notesSummaryByEntity,"goal",a.id);return e.jsx(b,{to:`/goals/${a.id}`,className:"min-w-0 overflow-hidden rounded-[28px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.04))] sm:p-5",children:e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)] xl:gap-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs(D,{children:[a.tags.slice(0,3).map(i=>e.jsx(l,{className:"bg-white/[0.08]",style:{color:i.color},children:i.name},i.id)),e.jsx(l,{className:"bg-white/[0.08] text-white/72",children:a.horizon}),e.jsx(I,{user:a.user,compact:!0})]}),e.jsx("div",{className:"mt-4",children:e.jsx(p,{kind:"goal",label:a.title,variant:"heading",size:"xl",lines:2})}),e.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-7 text-white/58",children:a.description}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Progress"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Tasks done"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.completedTasks,"/",Math.max(a.totalTasks,1)]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"XP banked"}),e.jsx("div",{className:"mt-2 text-xl text-white",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(R,{value:a.progress})}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{entityType:"goal",entityId:a.id,count:h.count})})]}),e.jsxs("div",{className:"min-w-0 rounded-[24px] bg-white/[0.04] p-4",children:[e.jsx(_,{title:"Projects carrying this direction",meta:e.jsx("div",{className:"shrink-0 text-sm text-white/48",children:t.length}),className:"gap-2"}),t.length===0?e.jsx("div",{className:"mt-4 text-sm leading-6 text-white/56",children:n==="active"?"No active project is attached yet. Create one so this direction starts producing visible work.":"No projects in this lifecycle view are attached yet. Switch filters or restart one to bring it back into active motion."}):e.jsx("div",{className:"mt-4 grid gap-3",children:t.slice(0,3).map(i=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.05] px-4 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx(k,{kind:"project",compact:!0,gradient:!1}),e.jsx(p,{kind:"project",label:i.title,className:"min-w-0",showIcon:!1,lines:2})]}),e.jsx(l,{className:"shrink-0",children:i.status})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:i.description}),e.jsxs("div",{className:"mt-3 text-sm text-white/42",children:["Next move:"," ",i.nextTaskTitle??"Define the first attached task"]}),n!=="active"&&i.status!=="active"?e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",pending:o===i.id,pendingLabel:"Restarting…",onClick:v=>{v.preventDefault(),v.stopPropagation(),m(i.id)},children:"Restart"})}):null]},i.id))})]})]})},a.id)})}):e.jsx(N,{children:e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:"Goal cards will appear here once the first long-horizon direction is created."})})]})}export{ee as GoalsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as y,j as e,c2 as $e,aG as qe,cd as We,aV as Ge,ce as Ue,c7 as Qe,c5 as ve,bO as ke,cf as Ne,cg as Ye,aK as Ce,ch as Ze,ci as Je,cj as Ve,ck as et}from"./vendor-kIz9EZnX.js";import{R as Ie,P as _e,O as Pe,C as De,T as Le,D as Se,a as Te}from"./ui-CsEkP2V8.js";import{j as tt,i as oe,k as ce}from"./state-VYvD1QVP.js";import{E as at}from"./entity-note-count-link-BrS1-O0o.js";import{N as st}from"./note-markdown-CsGQhQXF.js";import{Q as it,$ as rt,F as g,I as q,T as xe,a0 as nt,a1 as lt,j as ne,b as M,u as dt,a2 as ot,s as ct,a3 as ht,a4 as mt,a5 as xt,a6 as pt,a7 as he,a8 as ut,B as L,V as He,C as A,h as U,d as Ee,a as gt,_ as bt,Z as P,U as yt,c as b,a9 as wt,aa as ft,ab as Ae,ac as jt,ad as vt,O as kt}from"./index-BHIKoiZ6.js";import{u as Nt,p as Ct}from"./use-psyche-focus-target-qxT5Oy_z.js";import{P as It}from"./page-hero-oFHaAjtL.js";import{S as _t}from"./select-menu-Cdq7foRu.js";import{f as Pt}from"./date-keys-Cj1G3TOn.js";import"./motion-CfdU2F35.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";const me={title:"",description:"",status:"active",userId:null,polarity:"positive",frequency:"daily",targetCount:1,weekDays:[],linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],linkedValueIds:[],linkedPatternIds:[],linkedBehaviorIds:[],linkedBeliefIds:[],linkedModeIds:[],linkedReportIds:[],linkedBehaviorId:"",rewardXp:12,penaltyXp:8,generatedHealthEventTemplate:{enabled:!1,workoutType:"workout",title:"",durationMinutes:45,xpReward:0,tags:[],links:[],notesTemplate:""}},Dt=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}];function Lt(t){return{title:t.title,description:t.description,status:t.status,userId:t.userId??null,polarity:t.polarity,frequency:t.frequency,targetCount:t.targetCount,weekDays:t.weekDays,linkedGoalIds:t.linkedGoalIds,linkedProjectIds:t.linkedProjectIds,linkedTaskIds:t.linkedTaskIds,linkedValueIds:t.linkedValueIds,linkedPatternIds:t.linkedPatternIds,linkedBehaviorIds:t.linkedBehaviorIds,linkedBeliefIds:t.linkedBeliefIds,linkedModeIds:t.linkedModeIds,linkedReportIds:t.linkedReportIds,linkedBehaviorId:t.linkedBehaviorId??"",rewardXp:t.rewardXp,penaltyXp:t.penaltyXp,generatedHealthEventTemplate:t.generatedHealthEventTemplate}}function St({open:t,pending:d=!1,editingHabit:o,values:w,patterns:f,behaviors:T,beliefs:c,modes:j,reports:m,goals:v,projects:H,tasks:D,users:B,defaultUserId:k=null,onOpenChange:C,onSubmit:E}){const[R,S]=y.useState(me),[te,K]=y.useState(null),[I,Z]=y.useState({});y.useEffect(()=>{t&&(S(o?Lt(o):{...me,userId:k}),K(null),Z({}))},[k,o,t]);const O=B.find(i=>i.id===k)??null,z=y.useMemo(()=>T.slice().sort((i,r)=>i.title.localeCompare(r.title)),[T]),_=i=>({linkedBehaviorIds:i,linkedBehaviorId:i[0]??""}),N=(i,r)=>i.includes(r)?i.filter(s=>s!==r):[...i,r],G=[{id:"intent",eyebrow:"Habit",title:"Name the recurring move",description:"Use habits for recurring commitments and recurring slips. Keep the title concrete so the daily check-in never needs interpretation.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Title",error:I.title??null,children:e.jsx(q,{value:i.title,onChange:s=>r({title:s.target.value}),placeholder:"Train lower body"})}),e.jsx(g,{label:"Description",children:e.jsx(xe,{value:i.description,onChange:s=>r({description:s.target.value}),placeholder:"Write the habit description in Markdown. Define what counts, edge cases, and examples."})}),e.jsx(nt,{value:i.userId,users:B,onChange:s=>r({userId:s}),label:"Owner user",defaultLabel:lt(O),help:"Habits can be owned by humans or bots. When one scoped user is active, Forge uses that as the default."})]})},{id:"shape",eyebrow:"Shape",title:"Set direction and cadence",description:"Forge uses polarity to decide whether doing the habit is good or bad, and cadence to know when it should show up.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Polarity",children:e.jsx(ne,{value:i.polarity,onChange:s=>r({polarity:s}),options:[{value:"positive",label:"Positive",description:"Doing it is aligned and should award XP."},{value:"negative",label:"Negative",description:"Doing it is a slip and should cost XP."}],columns:2})}),e.jsx(g,{label:"Frequency",children:e.jsx(ne,{value:i.frequency,onChange:s=>r({frequency:s}),options:[{value:"daily",label:"Daily",description:"Track against each day."},{value:"weekly",label:"Weekly",description:"Track only on the selected weekdays."}],columns:2})}),i.frequency==="weekly"?e.jsx(g,{label:"Weekdays",error:I.weekDays??null,children:e.jsx("div",{className:"flex flex-wrap gap-2",children:Dt.map(s=>{const n=i.weekDays.includes(s.value);return e.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${n?"bg-white/16 text-white":"bg-white/6 text-white/58 hover:bg-white/10 hover:text-white"}`,onClick:()=>r({weekDays:n?i.weekDays.filter(J=>J!==s.value):[...i.weekDays,s.value].sort()}),children:s.label},s.value)})})}):null,e.jsx(g,{label:"Status",children:e.jsx(ne,{value:i.status,onChange:s=>r({status:s}),options:[{value:"active",label:"Active",description:"Show it in the daily operating flow."},{value:"paused",label:"Paused",description:"Keep it visible but not currently due."},{value:"archived",label:"Archived",description:"Keep the record but retire it from active work."}]})})]})},{id:"generation",eyebrow:"Generation",title:"Decide whether this habit should create a workout record",description:"Use this when a completed habit should generate a structured sports or recovery session in Forge, then reconcile with HealthKit later if the same session gets imported.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Generate workout record",children:e.jsx(ne,{value:i.generatedHealthEventTemplate.enabled?"enabled":"disabled",onChange:s=>r({generatedHealthEventTemplate:{...i.generatedHealthEventTemplate,enabled:s==="enabled"}}),options:[{value:"disabled",label:"Disabled",description:"This habit only affects the habit ledger."},{value:"enabled",label:"Enabled",description:"A completed check-in creates a workout or recovery session."}],columns:2})}),i.generatedHealthEventTemplate.enabled?e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Workout type",children:e.jsx(q,{value:i.generatedHealthEventTemplate.workoutType,onChange:s=>r({generatedHealthEventTemplate:{...i.generatedHealthEventTemplate,workoutType:s.target.value}}),placeholder:"mobility, walk, strength, recovery"})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{label:"Duration (minutes)",children:e.jsx(q,{type:"number",min:1,max:1440,value:i.generatedHealthEventTemplate.durationMinutes,onChange:s=>r({generatedHealthEventTemplate:{...i.generatedHealthEventTemplate,durationMinutes:Number(s.target.value)||45}})})}),e.jsx(g,{label:"Workout XP",children:e.jsx(q,{type:"number",min:0,max:500,value:i.generatedHealthEventTemplate.xpReward,onChange:s=>r({generatedHealthEventTemplate:{...i.generatedHealthEventTemplate,xpReward:Number(s.target.value)||0}})})})]}),e.jsx(g,{label:"Generated session note",children:e.jsx(xe,{value:i.generatedHealthEventTemplate.notesTemplate,onChange:s=>r({generatedHealthEventTemplate:{...i.generatedHealthEventTemplate,notesTemplate:s.target.value}}),placeholder:"Morning routine session generated from habit completion."})})]}):null]})},{id:"links",eyebrow:"Links",title:"Connect the habit to real Forge work",description:"Link habits to the goals, projects, and tasks they support so they stay anchored in the same operating graph as everything else.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Goals",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(s=>{const n=i.linkedGoalIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedGoalIds:N(i.linkedGoalIds,s.id)}),children:e.jsx(M,{kind:"goal",label:s.title,gradient:n,className:n?"":"opacity-75"})},s.id)})})}),e.jsx(g,{label:"Projects",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:H.map(s=>{const n=i.linkedProjectIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedProjectIds:N(i.linkedProjectIds,s.id)}),children:e.jsx(M,{kind:"project",label:s.title,gradient:n,className:n?"":"opacity-75"})},s.id)})})}),e.jsx(g,{label:"Tasks",children:e.jsx("div",{className:"flex max-h-48 flex-wrap gap-2 overflow-y-auto",children:D.map(s=>{const n=i.linkedTaskIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedTaskIds:N(i.linkedTaskIds,s.id)}),children:e.jsx(M,{kind:"task",label:s.title,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})}),e.jsx(g,{label:"Values",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(s=>{const n=i.linkedValueIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedValueIds:N(i.linkedValueIds,s.id)}),children:e.jsx(M,{kind:"value",label:s.title,gradient:n,className:n?"":"opacity-75"})},s.id)})})}),e.jsx(g,{label:"Patterns",children:e.jsx("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto",children:f.map(s=>{const n=i.linkedPatternIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedPatternIds:N(i.linkedPatternIds,s.id)}),children:e.jsx(M,{kind:"pattern",label:s.title,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})})]})},{id:"reward",eyebrow:"Reward",title:"Link the behavior and XP logic",description:"Habits can point back to a Psyche behavior. Reward XP is granted for aligned outcomes; penalty XP is applied for misaligned ones.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Linked behavior",children:e.jsx("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto",children:z.map(s=>{const n=i.linkedBehaviorIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r(_(N(i.linkedBehaviorIds,s.id))),children:e.jsx(M,{kind:"behavior",label:s.title,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})}),e.jsx(g,{label:"Beliefs",children:e.jsx("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto",children:c.map(s=>{const n=i.linkedBeliefIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedBeliefIds:N(i.linkedBeliefIds,s.id)}),children:e.jsx(M,{kind:"belief",label:s.statement,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})}),e.jsx(g,{label:"Modes",children:e.jsx("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto",children:j.map(s=>{const n=i.linkedModeIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedModeIds:N(i.linkedModeIds,s.id)}),children:e.jsx(M,{kind:"mode",label:s.title,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})}),e.jsx(g,{label:"Reports",children:e.jsx("div",{className:"flex max-h-44 flex-wrap gap-2 overflow-y-auto",children:m.map(s=>{const n=i.linkedReportIds.includes(s.id);return e.jsx("button",{type:"button",onClick:()=>r({linkedReportIds:N(i.linkedReportIds,s.id)}),children:e.jsx(M,{kind:"report",label:s.title,gradient:n,className:n?"":"opacity-75",wrap:!0})},s.id)})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(g,{label:"Target count",error:I.targetCount??null,children:e.jsx(q,{type:"number",value:i.targetCount,onChange:s=>r({targetCount:Number(s.target.value)||1})})}),e.jsx(g,{label:"Reward XP",error:I.rewardXp??null,children:e.jsx(q,{type:"number",value:i.rewardXp,onChange:s=>r({rewardXp:Number(s.target.value)||1})})}),e.jsx(g,{label:"Penalty XP",error:I.penaltyXp??null,children:e.jsx(q,{type:"number",value:i.penaltyXp,onChange:s=>r({penaltyXp:Number(s.target.value)||1})})})]})]})}];return e.jsx(it,{open:t,onOpenChange:C,eyebrow:"Habit",title:o?"Edit habit":"Create habit",description:"Habits are recurring commitments or recurring slips with explicit XP consequences.",value:R,onChange:S,draftPersistenceKey:o?`habit.${o.id}`:"habit.new",steps:G,pending:d,pendingLabel:o?"Save habit":"Create habit",submitLabel:o?"Save habit":"Create habit",error:te,onSubmit:async()=>{K(null);const i=rt.safeParse(R);if(!i.success){Z(Object.fromEntries(Object.entries(i.error.flatten().fieldErrors).map(([r,s])=>[r,s==null?void 0:s[0]]))),K("Some habit fields still need attention.");return}Z({});try{await E(i.data,o==null?void 0:o.id),S(me),C(!1)}catch(r){K(r instanceof Error?r.message:"Habit update failed.")}}})}const Tt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ht=["S","M","T","W","T","F","S"],Et=[{value:"name",label:"Name A-Z",description:"Keep the list stable alphabetically."},{value:"needs_attention",label:"Needs attention",description:"Bubble up habits still waiting on today."},{value:"streak",label:"Longest streak",description:"Put the strongest current streaks first."},{value:"created_at",label:"Newest created",description:"Show the most recently created habits first."},{value:"updated_at",label:"Recently updated",description:"Sort by the most recently changed habits."}];function At(t){return t.frequency==="daily"?`${t.targetCount}x daily`:`${t.targetCount}x weekly · ${t.weekDays.map(d=>Tt[d]).join(", ")}`}function W(t){return Pt(t)}function Me(t){const[d,o,w]=t.split("-").map(Number);return new Date(d,o-1,w)}function Be(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function le(t,d){const o=new Date(t);return o.setDate(o.getDate()+d),o}function Fe(t){const d=Be(t),o=(d.getDay()+6)%7;return d.setDate(d.getDate()-o),d}function ee(t){const d=typeof t=="string"?Me(t):t;return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(d)}function de(t,d){return t.polarity==="positive"&&d==="done"||t.polarity==="negative"&&d==="missed"}function pe(t,d){return t.polarity==="positive"?d==="done"?"Done":"Missed":d==="done"?"Performed":"Resisted"}function Ke(t){const d=W(new Date),o=t.checkIns.find(w=>w.dateKey===d)??null;return t.dueToday?{tone:"pending",label:t.frequency==="daily"?"Waiting for today":"Awaiting this week's check-in",cardClass:"border-amber-300/24 shadow-[0_0_0_1px_rgba(251,191,36,0.12)]",overlayClass:"bg-[radial-gradient(circle_at_top_right,rgba(251,191,36,0.18),transparent_44%)]",pillClass:"border border-amber-300/16 bg-amber-300/12 text-amber-100"}:o?de(t,o.status)?{tone:"aligned",label:`${pe(t,o.status)} today`,cardClass:"border-emerald-300/20 shadow-[0_0_0_1px_rgba(52,211,153,0.08)]",overlayClass:"bg-[radial-gradient(circle_at_top_right,rgba(52,211,153,0.16),transparent_44%)]",pillClass:"border border-emerald-300/16 bg-emerald-300/12 text-emerald-100"}:{tone:"unaligned",label:`${pe(t,o.status)} today`,cardClass:"border-rose-300/20 shadow-[0_0_0_1px_rgba(251,113,133,0.08)]",overlayClass:"bg-[radial-gradient(circle_at_top_right,rgba(251,113,133,0.16),transparent_44%)]",pillClass:"border border-rose-300/16 bg-rose-300/12 text-rose-100"}:t.polarity==="positive"?{tone:"neutral",label:"No update due right now",cardClass:"",overlayClass:"bg-[radial-gradient(circle_at_top_right,rgba(52,211,153,0.09),transparent_40%)]",pillClass:"border border-white/10 bg-white/[0.06] text-white/62"}:{tone:"neutral",label:"No update due right now",cardClass:"",overlayClass:"bg-[radial-gradient(circle_at_top_right,rgba(251,113,133,0.09),transparent_40%)]",pillClass:"border border-white/10 bg-white/[0.06] text-white/62"}}function Ft(t){return t>=10?{Icon:Ze,className:"border border-amber-300/20 bg-amber-300/10 text-amber-100 shadow-[0_16px_32px_rgba(251,191,36,0.14)]",iconClass:"text-amber-200",valueClass:"text-amber-50",label:"Celebration pace"}:t>=5?{Icon:Je,className:"border border-emerald-300/20 bg-emerald-300/10 text-emerald-100 shadow-[0_16px_32px_rgba(52,211,153,0.12)]",iconClass:"text-emerald-200",valueClass:"text-emerald-50",label:"Locked in"}:t>=1?{Icon:Ve,className:"border border-sky-300/18 bg-sky-300/10 text-sky-100 shadow-[0_16px_32px_rgba(125,211,252,0.1)]",iconClass:"text-sky-200",valueClass:"text-sky-50",label:"Building rhythm"}:{Icon:et,className:"border border-white/10 bg-white/[0.04] text-white/72 shadow-[0_16px_32px_rgba(15,23,42,0.16)]",iconClass:"text-white/55",valueClass:"text-white",label:"Cold start"}}function Mt(t){return t>=80?"bg-emerald-400/12 text-emerald-100":t>=50?"bg-amber-300/12 text-amber-100":"bg-rose-400/12 text-rose-100"}function Bt(t){var T;const d=new Date;if(t.frequency==="daily"){const c=Be(d),j=[];for(let m=-6;m<=0;m+=1){const v=le(c,m),H=W(v),D=t.checkIns.find(C=>C.dateKey===H)??null,B=Ht[v.getDay()],k=m===0;j.push({id:H,label:B,current:k,actionDateKey:H,actionLabel:ee(v),state:D?de(t,D.status)?"aligned":"unaligned":"unknown",title:`${ee(v)} · ${D?pe(t,D.status):"Not informed"}`})}return{caption:"7-day rhythm",rangeLabel:"Past 7 days",showLabels:!0,startLabel:"",endLabel:"",cells:j}}const o=Fe(d),w=new Map;for(const c of t.checkIns){const j=W(Fe(Me(c.dateKey))),m=w.get(j)??[];m.push(c),w.set(j,m)}const f=[];for(let c=-6;c<=0;c+=1){const j=le(o,c*7),m=W(j),v=w.get(m)??[],H=t.weekDays.length>0?[...t.weekDays].sort((E,R)=>R-E)[0]:0,D=W(le(j,H)),B=((T=v[0])==null?void 0:T.dateKey)??D,k=v.filter(E=>de(t,E.status)).length,C=v.length-k;f.push({id:m,label:"",current:c===0,actionDateKey:B,actionLabel:`Week of ${ee(j)}`,state:v.length===0?"unknown":k>=C?"aligned":"unaligned",title:`${ee(j)} week · ${v.length===0?"Not informed":k>=C?"Mostly aligned":"Mostly off track"}`})}return{caption:"7-week rhythm",rangeLabel:"Past 7 weeks",showLabels:!1,startLabel:ee(le(o,-42)),endLabel:"This week",cells:f}}function Kt(t,d){return P("h-8 w-full rounded-[10px] border transition",t==="aligned"&&"border-emerald-300/20 bg-emerald-300/75 shadow-[0_8px_18px_rgba(52,211,153,0.18)]",t==="unaligned"&&"border-rose-300/20 bg-rose-300/75 shadow-[0_8px_18px_rgba(251,113,133,0.18)]",t==="unknown"&&"border-white/8 bg-white/[0.08]",d&&"shadow-[0_0_0_1px_rgba(255,255,255,0.16)]")}function Xt({habit:t,onSelectCell:d}){const o=Bt(t),w=Ke(t);return e.jsxs("div",{className:"w-full rounded-[18px] border border-white/8 bg-black/10 px-3 py-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.16em] text-white/34",children:o.caption}),e.jsx("div",{className:"text-[11px] text-white/46",children:o.rangeLabel})]}),e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:o.cells.map(f=>e.jsxs("button",{type:"button",className:"group flex min-w-0 flex-1 items-center gap-1 rounded-[10px] transition hover:bg-white/[0.04]",onClick:()=>d(t,f),title:`Log check-in for ${f.actionLabel}`,"aria-label":`Log check-in for ${f.actionLabel}`,children:[e.jsx("div",{className:P(Kt(f.state,f.current),"h-6 min-w-0 flex-1 rounded-[8px] transition duration-150 group-hover:-translate-y-0.5 group-hover:shadow-[0_10px_22px_rgba(15,23,42,0.22)]")}),o.showLabels?e.jsx("span",{className:"hidden text-[9px] uppercase tracking-[0.14em] text-white/26 transition group-hover:text-white/48 sm:inline",children:f.label}):null]},f.id))}),e.jsx("div",{className:P("shrink-0 rounded-full px-2.5 py-1 text-[10px] font-medium",w.pillClass),children:w.label})]}),o.showLabels?null:e.jsxs("div",{className:"mt-1 text-right text-[10px] uppercase tracking-[0.14em] text-white/26",children:[o.startLabel," - ",o.endLabel]})]})}function Rt(t){return t.polarity==="positive"?{alignedLabel:"Done",alignedDescription:"Log that the intended habit happened.",unalignedLabel:"Missed",unalignedDescription:"Log that the habit did not happen."}:{alignedLabel:"Resisted",alignedDescription:"Log that the unwanted behavior was resisted.",unalignedLabel:"Performed",unalignedDescription:"Log that the unwanted behavior happened."}}function Q(t,d){return t.polarity==="positive"?d==="aligned"?"done":"missed":d==="aligned"?"missed":"done"}function Y(t,d){return de(t,d)?"aligned":"unaligned"}function aa(){var ge,be,ye,we,fe,je;const t=dt(),d=tt(),[o,w]=$e(),[f,T]=y.useState(null),[c,j]=y.useState(null),[m,v]=y.useState(null),[H,D]=y.useState(""),[B,k]=y.useState(!1),[C,E]=y.useState(null),[R,S]=y.useState(null),te=o.get("focus"),K=o.get("orderBy")??"name",I=ot(t.selectedUserIds),Z=ct(I),O=["forge-habits",K,...I];Nt(te);const z=oe({queryKey:O,queryFn:async()=>(await jt({userIds:I,orderBy:K})).habits}),_=oe({queryKey:["forge-psyche-overview",...I],queryFn:async()=>(await vt(I)).overview}),N=oe({queryKey:["forge-life-force",...I],queryFn:async()=>(await kt(I)).lifeForce});y.useEffect(()=>{o.get("create")==="1"&&(T(null),k(!0),w(a=>{const u=new URLSearchParams(a);return u.delete("create"),u},{replace:!0}))},[o,w]);const G=async()=>{await d.invalidateQueries({queryKey:["forge-habits"]}),await t.refresh()},i=ce({mutationFn:async({input:a,habitId:u})=>u?(await ht(u,a)).habit:(await mt(a)).habit,onSuccess:async()=>{S(null),await G()},onError:a=>{S(a instanceof Error?a.message:"Habit save failed.")}}),r=ce({mutationFn:async({habitId:a,status:u,dateKey:h,note:$})=>xt(a,{status:u,dateKey:h,note:$}),onSuccess:async()=>{S(null),await G()},onError:a=>{S(a instanceof Error?a.message:"Habit check-in failed.")}}),s=ce({mutationFn:async a=>pt(a),onMutate:async a=>{await d.cancelQueries({queryKey:O});const u=d.getQueryData(O);return d.setQueryData(O,h=>(h==null?void 0:h.filter($=>$.id!==a))??[]),{previousHabits:u}},onSuccess:async()=>{S(null),E(null),await G()},onError:(a,u,h)=>{h!=null&&h.previousHabits&&d.setQueryData(O,h.previousHabits),S(a instanceof Error?a.message:"Habit delete failed.")}}),n=y.useMemo(()=>(z.data??[]).filter(a=>a.status!=="archived"),[z.data]),J=y.useMemo(()=>n.filter(a=>a.dueToday),[n]),Xe=y.useMemo(()=>J.reduce((a,u)=>{var ae;const h=Ae().totalAp,$=((ae=he(u))==null?void 0:ae.totalAp)??0;return a+h+$},0),[J]),Re=y.useMemo(()=>n.reduce((a,u)=>{var h;return a+(((h=he(u))==null?void 0:h.totalAp)??0)},0),[n]),X=y.useMemo(()=>c?c.habit.checkIns.find(a=>a.dateKey===c.cell.actionDateKey)??null:null,[c]);if(y.useEffect(()=>{if(!c){v(null),D("");return}v((X==null?void 0:X.status)??null),D((X==null?void 0:X.note)??"")},[c,X]),z.error)throw z.error;const Oe=a=>{w(u=>{const h=new URLSearchParams(u);return a==="name"?h.delete("orderBy"):h.set("orderBy",a),h},{replace:!0})},V=c?Rt(c.habit):null,ue=m==="done"||m==="missed"||X!==null;return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(It,{entityKind:"habit",title:e.jsx(He,{kind:"habit",label:"Habits",variant:"heading",size:"lg"}),titleText:"Habits",description:"Habits track recurring commitments and recurring slips with explicit daily consequences, linked behaviors, and real XP movement.",badge:`${n.length} habits`,actions:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx(ut,{metrics:t.snapshot.metrics}),e.jsxs(L,{onClick:()=>{T(null),k(!0)},children:[e.jsx(qe,{className:"size-4"}),"New habit"]})]})}),R?e.jsx(A,{className:"border-rose-400/22 bg-rose-400/8 text-rose-100",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(We,{className:"mt-0.5 size-4 shrink-0"}),e.jsx("div",{children:R})]})}):null,e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(A,{className:"border-amber-300/16 shadow-[0_0_0_1px_rgba(251,191,36,0.08)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Due today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:J.length}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Habits that still need a check-in today."})]}),e.jsxs(A,{className:"border-[var(--primary)]/16 shadow-[0_0_0_1px_rgba(245,158,11,0.08)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Habit AP due"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:U(Xe)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Default Action Point load if every due habit is logged today."})]}),e.jsxs(A,{className:"border-emerald-300/16 shadow-[0_0_0_1px_rgba(52,211,153,0.08)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Best streak"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-emerald-50",children:Math.max(0,...n.map(a=>a.streakCount))}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Longest current aligned streak across active habits."})]}),e.jsxs(A,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Average alignment"}),e.jsxs("div",{className:"mt-3 font-display text-4xl text-white",children:[n.length>0?Math.round(n.reduce((a,u)=>a+u.completionRate,0)/n.length):0,"%"]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Share of recent habit check-ins that matched the intended direction."})]})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs(A,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Life Force sync"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-white",children:N.data?`${U(N.data.spentTodayAp)} / ${U(N.data.dailyBudgetAp)}`:"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Habit check-ins debit the same Action Point ledger as work, notes, movement, and workouts."})]}),e.jsxs(A,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Instant headroom"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-white",children:N.data?Ee(N.data.instantFreeApPerHour):"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Use this to tell whether now is a good moment for heavier habits or just a light check-in."})]}),e.jsxs(A,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Workout-linked load"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-white",children:U(Re)}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:"Habit-generated workout templates stay visible as Action Point cost instead of hiding behind the XP reward."})]})]}),z.isLoading?e.jsx(A,{children:"Loading habits..."}):n.length===0?e.jsx(gt,{eyebrow:"Habits",title:"No recurring habits yet",description:"Create the recurring commitments or recurring slips you want Forge to track explicitly. Positive habits pay out when completed. Negative habits invert that logic.",action:e.jsx(L,{onClick:()=>{T(null),k(!0)},children:"Create habit"})}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 rounded-[24px] border border-white/8 bg-white/[0.03] p-4 shadow-[0_18px_36px_rgba(15,23,42,0.16)] sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{className:"max-w-xl",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:"Habit list order"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Choose a stable ordering so the list does not reshuffle while you are logging check-ins."})]}),e.jsx(_t,{label:"Order by",value:K,options:Et,onChange:Oe,className:"w-full sm:w-[19rem]"})]}),e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:n.map(a=>{const u=Ke(a),h=Ft(a.streakCount),$=h.Icon,ae=Ae(),se=he(a),ze=bt(t.snapshot.dashboard.notesSummaryByEntity,"habit",a.id).count,ie=a.polarity==="positive"?{label:"Done",status:Q(a,"aligned"),Icon:ke,className:"border-emerald-300/18 bg-emerald-300/14 text-emerald-50 shadow-[0_14px_28px_rgba(52,211,153,0.14)] hover:bg-emerald-300/20"}:{label:"Resisted",status:Q(a,"aligned"),Icon:ve,className:"border-emerald-300/18 bg-emerald-300/14 text-emerald-50 shadow-[0_14px_28px_rgba(52,211,153,0.14)] hover:bg-emerald-300/20"},re=a.polarity==="positive"?{label:"Missed",status:Q(a,"unaligned"),Icon:Ne,className:"border-rose-300/18 bg-rose-300/14 text-rose-50 shadow-[0_14px_28px_rgba(251,113,133,0.14)] hover:bg-rose-300/20"}:{label:"Performed",status:Q(a,"unaligned"),Icon:Ye,className:"border-rose-300/18 bg-rose-300/14 text-rose-50 shadow-[0_14px_28px_rgba(251,113,133,0.14)] hover:bg-rose-300/20"};return e.jsxs(A,{className:P("relative flex h-full flex-col overflow-hidden",u.cardClass,Ct(te===a.id)),"data-psyche-focus-id":a.id,children:[e.jsx("div",{className:P("pointer-events-none absolute inset-0 opacity-100",u.overlayClass)}),e.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(He,{kind:"habit",label:a.title,variant:"heading",size:"sm"}),e.jsx(yt,{user:a.user,compact:!0}),e.jsx(b,{className:"bg-white/[0.08] text-white/72",children:a.status}),e.jsxs(b,{className:"bg-white/[0.08] text-white/72",children:[e.jsx(Ge,{className:"mr-1 size-3.5"}),At(a)]}),e.jsx(b,{className:a.polarity==="positive"?"bg-emerald-400/12 text-emerald-200":"bg-rose-400/12 text-rose-200",children:a.polarity==="positive"?"Positive":"Negative"}),a.dueToday?e.jsx(b,{className:"bg-amber-300/12 text-amber-100",children:"Needs check-in"}):null,a.linkedGoalIds.slice(0,1).map(x=>{const l=t.snapshot.goals.find(p=>p.id===x);return l?e.jsxs(b,{className:"bg-amber-400/12 text-amber-100",children:["Goal · ",l.title]},l.id):null}),a.linkedProjectIds.slice(0,1).map(x=>{const l=t.snapshot.dashboard.projects.find(p=>p.id===x);return l?e.jsxs(b,{className:"bg-sky-400/12 text-sky-100",children:["Project · ",l.title]},l.id):null}),a.linkedTaskIds.slice(0,1).map(x=>{const l=t.snapshot.tasks.find(p=>p.id===x);return l?e.jsxs(b,{className:"bg-indigo-400/12 text-indigo-100",children:["Task · ",l.title]},l.id):null})]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:a.description?e.jsx(st,{markdown:a.description,className:"[&>p]:text-sm [&>p]:leading-6 [&>blockquote]:text-sm [&>ul]:text-sm [&>ol]:text-sm"}):"No extra notes yet."})]}),e.jsxs("div",{className:"ml-auto inline-flex shrink-0 flex-col items-end gap-2 self-start text-right",children:[e.jsxs("div",{className:P("inline-flex flex-col self-end rounded-[20px] px-3 py-2.5 text-right",h.className),children:[e.jsxs("div",{className:"flex items-center justify-end gap-1.5 text-[10px] uppercase tracking-[0.16em]",children:[e.jsx("span",{children:"Streak"}),e.jsx($,{className:P("size-3.5 shrink-0",h.iconClass)})]}),e.jsx("div",{className:P("mt-1.5 font-display text-[2.75rem] leading-none",h.valueClass),children:a.streakCount}),e.jsx("div",{className:"mt-1 text-[11px] leading-tight text-white/68",children:h.label})]}),e.jsxs("div",{className:"ml-auto grid grid-cols-2 gap-1.5",children:[e.jsx(L,{variant:"ghost",size:"sm",className:"h-7 min-w-0 rounded-[11px] border border-white/8 bg-white/[0.04] px-3 text-white/72 hover:bg-white/[0.08] hover:text-white",disabled:i.isPending,onClick:()=>{T(a),k(!0)},"aria-label":`Edit ${a.title}`,title:"Edit habit",children:e.jsx(Ue,{className:"size-4"})}),e.jsx(L,{variant:"ghost",size:"sm",className:"h-7 min-w-0 rounded-[11px] border border-white/8 bg-white/[0.04] px-3 text-white/72 hover:bg-white/[0.08] hover:text-white",disabled:s.isPending,onClick:()=>E(a),"aria-label":`Delete ${a.title}`,title:"Delete habit",children:e.jsx(Qe,{className:"size-4"})})]})]})]}),e.jsxs("div",{className:"mt-auto grid gap-4 pt-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(b,{className:P("border-0",Mt(a.completionRate)),children:["Alignment ",a.completionRate,"%"]}),e.jsx(b,{className:"bg-white/[0.08] text-white/72",children:a.polarity==="positive"?`+${a.rewardXp} XP done`:`+${a.rewardXp} XP resisted`}),e.jsx(b,{className:"bg-white/[0.08] text-white/72",children:a.polarity==="positive"?`-${a.penaltyXp} XP missed`:`-${a.penaltyXp} XP performed`}),e.jsxs(b,{className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[U(ae.totalAp)," check-in"]}),se?e.jsxs(b,{className:"bg-orange-400/12 text-orange-100",children:[U(se.totalAp)," ","workout"]}):null,se?e.jsx(b,{className:"bg-white/[0.08] text-white/72",children:Ee(se.rateApPerHour)}):null,e.jsx(at,{entityType:"habit",entityId:a.id,count:ze,className:"min-h-8 rounded-full border-white/8 bg-white/[0.04] px-3 py-1.5 text-[12px] text-white/68 hover:bg-white/[0.07]"}),a.linkedBehaviorTitles.slice(0,2).map(x=>e.jsxs(b,{className:"bg-orange-400/12 text-orange-100",children:[e.jsx(ve,{className:"mr-1 size-3.5"}),x]},x)),a.linkedProjectIds.slice(1,2).map(x=>{const l=t.snapshot.dashboard.projects.find(p=>p.id===x);return l?e.jsxs(b,{className:"bg-sky-400/12 text-sky-100",children:["Project · ",l.title]},l.id):null}),a.linkedTaskIds.slice(1,2).map(x=>{const l=t.snapshot.tasks.find(p=>p.id===x);return l?e.jsxs(b,{className:"bg-indigo-400/12 text-indigo-100",children:["Task · ",l.title]},l.id):null}),a.linkedValueIds.slice(0,2).map(x=>{var p;const l=(p=_.data)==null?void 0:p.values.find(F=>F.id===x);return l?e.jsxs(b,{className:"bg-emerald-400/12 text-emerald-100",children:["Value · ",l.title]},l.id):null}),a.linkedPatternIds.slice(0,2).map(x=>{var p;const l=(p=_.data)==null?void 0:p.patterns.find(F=>F.id===x);return l?e.jsxs(b,{className:"bg-cyan-400/12 text-cyan-100",children:["Pattern · ",l.title]},l.id):null}),a.linkedBeliefIds.slice(0,2).map(x=>{var p;const l=(p=_.data)==null?void 0:p.beliefs.find(F=>F.id===x);return l?e.jsxs(b,{className:"bg-rose-400/12 text-rose-100",children:["Belief · ",l.statement]},l.id):null}),a.linkedModeIds.slice(0,2).map(x=>{var p;const l=(p=_.data)==null?void 0:p.modes.find(F=>F.id===x);return l?e.jsxs(b,{className:"bg-violet-400/12 text-violet-100",children:["Mode · ",l.title]},l.id):null}),a.linkedReportIds.slice(0,2).map(x=>{var p;const l=(p=_.data)==null?void 0:p.reports.find(F=>F.id===x);return l?e.jsxs(b,{className:"bg-fuchsia-400/12 text-fuchsia-100",children:["Report · ",l.title]},l.id):null})]}),e.jsx("div",{className:"grid gap-4",children:e.jsx(Xt,{habit:a,onSelectCell:(x,l)=>{j({habit:x,cell:l}),S(null)}})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs(L,{variant:"secondary",className:P("h-11 rounded-[16px] border",ie.className),disabled:r.isPending,onClick:()=>void r.mutateAsync({habitId:a.id,status:ie.status,dateKey:W(new Date)}),children:[e.jsx(ie.Icon,{className:"size-4"}),ie.label]}),e.jsxs(L,{variant:"secondary",className:P("h-11 rounded-[16px] border",re.className),disabled:r.isPending,onClick:()=>void r.mutateAsync({habitId:a.id,status:re.status,dateKey:W(new Date)}),children:[e.jsx(re.Icon,{className:"size-4"}),re.label]})]})]})]})]},a.id)})})]}),e.jsx(St,{open:B,pending:i.isPending,editingHabit:f,values:((ge=_.data)==null?void 0:ge.values)??[],patterns:((be=_.data)==null?void 0:be.patterns)??[],behaviors:((ye=_.data)==null?void 0:ye.behaviors)??[],beliefs:((we=_.data)==null?void 0:we.beliefs)??[],modes:((fe=_.data)==null?void 0:fe.modes)??[],reports:((je=_.data)==null?void 0:je.reports)??[],goals:t.snapshot.dashboard.goals,projects:t.snapshot.dashboard.projects,tasks:t.snapshot.tasks,users:t.snapshot.users,defaultUserId:(f==null?void 0:f.userId)??Z,onOpenChange:k,onSubmit:async(a,u)=>{try{await i.mutateAsync({input:a,habitId:u})}catch(h){throw h instanceof wt,h}}}),e.jsx(Ie,{open:C!==null,onOpenChange:a=>{!a&&!s.isPending&&E(null)},children:e.jsxs(_e,{children:[e.jsx(Pe,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.72)] backdrop-blur-xl"}),e.jsxs(De,{className:"fixed inset-x-4 top-1/2 z-50 mx-auto w-[min(30rem,calc(100vw-2rem))] max-w-[30rem] -translate-y-1/2 overflow-hidden rounded-[30px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,28,42,0.98),rgba(12,17,30,0.98))] shadow-[0_32px_90px_rgba(3,8,18,0.45)]",children:[e.jsx("div",{className:"border-b border-white/8 px-5 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Delete habit"}),e.jsx(Le,{className:"mt-2 text-lg font-semibold text-white",children:(C==null?void 0:C.title)??"Delete this habit?"}),e.jsx(Se,{className:"mt-3 text-sm text-white/56",children:"Remove this habit from Forge. The habit card disappears immediately after delete succeeds."})]}),e.jsx(Te,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"sm",className:"h-10 w-10 rounded-[14px] border border-white/8 bg-white/[0.04] px-0 text-white/72 hover:bg-white/[0.08] hover:text-white","aria-label":"Close delete habit modal",title:"Close",disabled:s.isPending,children:e.jsx(Ce,{className:"size-4"})})})]})}),e.jsxs("div",{className:"grid gap-4 p-5",children:[e.jsx("div",{className:"rounded-[20px] border border-rose-400/16 bg-rose-400/8 px-4 py-3 text-sm leading-6 text-rose-100/90",children:"This removes the habit and its check-in history from the habits page."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[e.jsx(L,{variant:"secondary",onClick:()=>E(null),disabled:s.isPending,children:"Cancel"}),e.jsx(L,{className:"border border-rose-300/18 bg-rose-300/14 text-rose-50 hover:bg-rose-300/20",pending:s.isPending,pendingLabel:"Deleting",onClick:()=>{C&&s.mutateAsync(C.id)},children:"Delete habit"})]})]})]})]})}),e.jsx(Ie,{open:c!==null,onOpenChange:a=>{a||j(null)},children:e.jsxs(_e,{children:[e.jsx(Pe,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.72)] backdrop-blur-xl"}),e.jsxs(De,{className:"fixed inset-x-4 top-1/2 z-50 mx-auto w-[min(42rem,calc(100vw-2rem))] max-w-[42rem] -translate-y-1/2 overflow-hidden rounded-[30px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,28,42,0.98),rgba(12,17,30,0.98))] shadow-[0_32px_90px_rgba(3,8,18,0.45)]",children:[e.jsx(Le,{className:"sr-only",children:"Habit history"}),e.jsx(Se,{className:"sr-only",children:"Log or revise a habit check-in for a selected history point."}),c&&V?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-b border-white/8 px-5 py-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Habit history"}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-lg font-semibold text-white",children:c.habit.title}),e.jsx(b,{className:"bg-white/[0.08] text-white/76",children:c.cell.actionLabel})]}),e.jsx("div",{className:"mt-3 text-sm text-white/56",children:c.habit.frequency==="daily"?"Log or revise the check-in for this specific day.":"Log or revise the representative check-in for this week."})]}),e.jsx(Te,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"sm",className:"h-10 w-10 rounded-[14px] border border-white/8 bg-white/[0.04] px-0 text-white/72 hover:bg-white/[0.08] hover:text-white","aria-label":"Close history modal",title:"Close",children:e.jsx(Ce,{className:"size-4"})})})]})}),e.jsxs("div",{className:"grid gap-4 p-5",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("button",{type:"button","aria-pressed":m!==null&&Y(c.habit,m)==="aligned",className:P("rounded-[22px] border px-4 py-4 text-left transition",m!==null&&Y(c.habit,m)==="aligned"?"border-emerald-300/24 bg-emerald-300/14 text-white shadow-[0_16px_36px_rgba(52,211,153,0.14)]":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"),onClick:()=>v(a=>a!==null&&Y(c.habit,a)==="aligned"?null:Q(c.habit,"aligned")),children:[e.jsxs("div",{className:"flex items-center gap-2 text-base font-medium",children:[e.jsx(ke,{className:"size-4"}),V.alignedLabel]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:V.alignedDescription})]}),e.jsxs("button",{type:"button","aria-pressed":m!==null&&Y(c.habit,m)==="unaligned",className:P("rounded-[22px] border px-4 py-4 text-left transition",m!==null&&Y(c.habit,m)==="unaligned"?"border-rose-300/24 bg-rose-300/14 text-white shadow-[0_16px_36px_rgba(251,113,133,0.14)]":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"),onClick:()=>v(a=>a!==null&&Y(c.habit,a)==="unaligned"?null:Q(c.habit,"unaligned")),children:[e.jsxs("div",{className:"flex items-center gap-2 text-base font-medium",children:[e.jsx(Ne,{className:"size-4"}),V.unalignedLabel]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:V.unalignedDescription})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white",children:"Optional note"}),e.jsx(xe,{value:H,onChange:a=>D(a.target.value),placeholder:"Add context for what happened on this day or week.",className:"min-h-24"})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[e.jsx(L,{variant:"secondary",onClick:()=>j(null),disabled:r.isPending,children:"Cancel"}),e.jsx(L,{disabled:r.isPending||!ue,pending:r.isPending,pendingLabel:"Saving",onClick:async()=>{ue&&(m===null?(await ft(c.habit.id,c.cell.actionDateKey),await G()):await r.mutateAsync({habitId:c.habit.id,status:m,dateKey:c.cell.actionDateKey,note:H.trim()||void 0}),j(null))},children:"Save check-in"})]})]})]}):null]})]})})]})}export{aa as HabitsPage};
|