@meridianjs/admin-dashboard 2.4.0 → 2.5.0

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.
@@ -1 +1 @@
1
- import{j as e}from"./vendor-query-CaIGp3JB.js";import{b as c,b2 as b,b3 as t,aJ as l,f as g,aS as x,aX as u}from"./index-WcKp7086.js";import{u as h}from"./vendor-react-Lycsri1F.js";import{p}from"./parseISO-BdsFsZH4.js";import"./vendor-radix-Bt8AkWnj.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cvk1s7Hk.js";const o={on_track:{label:"On track",dotCls:"bg-emerald-500",badgeCls:"text-emerald-700 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950/40 dark:border-emerald-800",accentBg:"bg-emerald-500"},delayed:{label:"Delayed",dotCls:"bg-orange-500",badgeCls:"text-orange-700 bg-orange-50 border-orange-200 dark:text-orange-400 dark:bg-orange-950/40 dark:border-orange-800",accentBg:"bg-orange-500"},on_hold:{label:"On hold",dotCls:"bg-amber-400",badgeCls:"text-amber-700 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/40 dark:border-amber-800",accentBg:"bg-amber-400"},completed:{label:"Completed",dotCls:"bg-indigo-500",badgeCls:"text-indigo-700 bg-indigo-50 border-indigo-200 dark:text-indigo-400 dark:bg-indigo-950/40 dark:border-indigo-800",accentBg:"bg-indigo-500"}};function f({health:s,className:d}){const a=o[s];return e.jsxs("span",{className:l("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium border shrink-0",a.badgeCls,d),children:[e.jsx("span",{className:l("h-1.5 w-1.5 rounded-full shrink-0",a.dotCls)}),a.label]})}function H(){const{projectKey:s,reportId:d}=h(),{data:a}=c(s??""),{data:r,isLoading:m,isError:n}=b(a==null?void 0:a.id,d);if(m)return e.jsxs("div",{className:"mx-auto px-8 py-10",children:[e.jsx(t,{className:"h-1 w-16 rounded-full mb-6"}),e.jsx(t,{className:"h-7 w-2/3 mb-4"}),e.jsx(t,{className:"h-5 w-32 mb-6"}),e.jsx(t,{className:"h-px w-full mb-6"}),e.jsx(t,{className:"h-4 w-full mb-2"}),e.jsx(t,{className:"h-4 w-5/6 mb-2"}),e.jsx(t,{className:"h-4 w-4/6"})]});if(n||!r)return e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Health report not found."});const i=o[r.health];return e.jsx("div",{className:"overflow-auto h-full bg-white dark:bg-card",children:e.jsxs("div",{className:"mx-auto px-8 py-10",children:[e.jsx("div",{className:l("h-1 w-16 rounded-full mb-6",i.accentBg)}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight leading-snug mb-2",children:r.title}),e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(f,{health:r.health}),e.jsx("span",{className:"text-sm text-muted-foreground",children:g(p(r.created_at),"d MMM yyyy 'at' HH:mm")})]}),e.jsx(x,{className:"mb-6"}),r.summary?e.jsx(u,{html:r.summary}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No summary was provided for this update."})]})})}export{H as HealthReportDetailPage};
1
+ import{j as e}from"./vendor-query-BildmsPY.js";import{b as c,b2 as b,b3 as t,aJ as l,f as g,aS as x,aX as u}from"./index-BJplLsFj.js";import{u as h}from"./vendor-react-Lycsri1F.js";import{p}from"./parseISO-C88XEjzj.js";import"./vendor-radix-B5umFwGL.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cu5gNfTV.js";const o={on_track:{label:"On track",dotCls:"bg-emerald-500",badgeCls:"text-emerald-700 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950/40 dark:border-emerald-800",accentBg:"bg-emerald-500"},delayed:{label:"Delayed",dotCls:"bg-orange-500",badgeCls:"text-orange-700 bg-orange-50 border-orange-200 dark:text-orange-400 dark:bg-orange-950/40 dark:border-orange-800",accentBg:"bg-orange-500"},on_hold:{label:"On hold",dotCls:"bg-amber-400",badgeCls:"text-amber-700 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/40 dark:border-amber-800",accentBg:"bg-amber-400"},completed:{label:"Completed",dotCls:"bg-indigo-500",badgeCls:"text-indigo-700 bg-indigo-50 border-indigo-200 dark:text-indigo-400 dark:bg-indigo-950/40 dark:border-indigo-800",accentBg:"bg-indigo-500"}};function f({health:s,className:d}){const a=o[s];return e.jsxs("span",{className:l("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium border shrink-0",a.badgeCls,d),children:[e.jsx("span",{className:l("h-1.5 w-1.5 rounded-full shrink-0",a.dotCls)}),a.label]})}function H(){const{projectKey:s,reportId:d}=h(),{data:a}=c(s??""),{data:r,isLoading:m,isError:n}=b(a==null?void 0:a.id,d);if(m)return e.jsxs("div",{className:"mx-auto px-8 py-10",children:[e.jsx(t,{className:"h-1 w-16 rounded-full mb-6"}),e.jsx(t,{className:"h-7 w-2/3 mb-4"}),e.jsx(t,{className:"h-5 w-32 mb-6"}),e.jsx(t,{className:"h-px w-full mb-6"}),e.jsx(t,{className:"h-4 w-full mb-2"}),e.jsx(t,{className:"h-4 w-5/6 mb-2"}),e.jsx(t,{className:"h-4 w-4/6"})]});if(n||!r)return e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Health report not found."});const i=o[r.health];return e.jsx("div",{className:"overflow-auto h-full bg-white dark:bg-card",children:e.jsxs("div",{className:"mx-auto px-8 py-10",children:[e.jsx("div",{className:l("h-1 w-16 rounded-full mb-6",i.accentBg)}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight leading-snug mb-2",children:r.title}),e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(f,{health:r.health}),e.jsx("span",{className:"text-sm text-muted-foreground",children:g(p(r.created_at),"d MMM yyyy 'at' HH:mm")})]}),e.jsx(x,{className:"mb-6"}),r.summary?e.jsx(u,{html:r.summary}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No summary was provided for this update."})]})})}export{H as HealthReportDetailPage};
@@ -1,4 +1,4 @@
1
- import{j as n}from"./vendor-query-CaIGp3JB.js";import{r as o,u as dt}from"./vendor-react-Lycsri1F.js";import{A as ut,E as ue,F as W,H as De,J as me,K as pe,L as Le,M as mt,Z as he,N as X,O as Me,Q as pt,R as ht,S as Te,T as $e,U as ne,V as fe,X as ft,Y as xt,$ as We,a0 as xe,a1 as ve,a2 as Ke,a3 as vt,a4 as Re,a5 as Ne,a6 as gt,a7 as yt,a8 as bt,a9 as ze,aa as Be,ab as jt,ac as Pt,ad as Nt,ae as kt,af as He,ag as wt,ah as At,ai as Ct,aj as St,ak as Et,al as It,am as Ot,an as ke,ao as we,ap as _t,aq as Dt,ar as Lt,as as U,at as Mt,au as Tt,av as $t,aw as Wt,ax as le,ay as ee,az as Kt,aA as Rt,aB as zt,b as Bt,aC as Ht,aD as Ut,aE as Ft,aF as Gt,aG as Vt,aH as Xt,B as F,P as Yt,aI as qt,aJ as Y,f as R,x as $,aK as Zt,aL as Ae,aM as Jt,aN as Qt,aO as ea,aP as ta,aQ as aa,aR as ra,aS as te,aT as na,aU as sa,aV as ia,aW as la,aX as oa,aY as Ce,aZ as ca,a_ as da,a$ as ua,b0 as ma,b1 as pa}from"./index-WcKp7086.js";import{p as z}from"./parseISO-BdsFsZH4.js";import"./vendor-radix-Bt8AkWnj.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cvk1s7Hk.js";/**
1
+ import{j as n}from"./vendor-query-BildmsPY.js";import{r as o,u as dt}from"./vendor-react-Lycsri1F.js";import{A as ut,E as ue,F as W,H as De,J as me,K as pe,L as Le,M as mt,Z as he,N as X,O as Me,Q as pt,R as ht,S as Te,T as $e,U as ne,V as fe,X as ft,Y as xt,$ as We,a0 as xe,a1 as ve,a2 as Ke,a3 as vt,a4 as Re,a5 as Ne,a6 as gt,a7 as yt,a8 as bt,a9 as ze,aa as Be,ab as jt,ac as Pt,ad as Nt,ae as kt,af as He,ag as wt,ah as At,ai as Ct,aj as St,ak as Et,al as It,am as Ot,an as ke,ao as we,ap as _t,aq as Dt,ar as Lt,as as U,at as Mt,au as Tt,av as $t,aw as Wt,ax as le,ay as ee,az as Kt,aA as Rt,aB as zt,b as Bt,aC as Ht,aD as Ut,aE as Ft,aF as Gt,aG as Vt,aH as Xt,B as F,P as Yt,aI as qt,aJ as Y,f as R,x as $,aK as Zt,aL as Ae,aM as Jt,aN as Qt,aO as ea,aP as ta,aQ as aa,aR as ra,aS as te,aT as na,aU as sa,aV as ia,aW as la,aX as oa,aY as Ce,aZ as ca,a_ as da,a$ as ua,b0 as ma,b1 as pa}from"./index-BJplLsFj.js";import{p as z}from"./parseISO-C88XEjzj.js";import"./vendor-radix-B5umFwGL.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cu5gNfTV.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/exceljs.min-BhVFTGw4.js","assets/vendor-react-Lycsri1F.js"])))=>i.map(i=>d[i]);
2
- import{a as Dt,b as vt,j as a}from"./vendor-query-CaIGp3JB.js";import{u as Ct,r as P,h as Mt}from"./vendor-react-Lycsri1F.js";import{_ as Ft,s as wt,a as nt,f as I,c as jt,i as St,u as It,b as zt,d as kt,e as Et,g as Gt,h as Nt,j as Rt,k as $t,W as ht,B as xt,D as Bt,P as Tt,G as Pt,l as At,m as rt,n as lt,o as Ut,p as Wt,q as Lt,r as it,t as yt,v as Ot,w as qt,I as Yt,C as Ht,x as dt,y as Kt,z as Qt}from"./index-WcKp7086.js";import"./vendor-radix-Bt8AkWnj.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cvk1s7Hk.js";const g=9;function bt(l){return"FF"+l.replace("#","")}async function Zt(l){var ct;const z=await Ft(()=>import("./exceljs.min-BhVFTGw4.js").then(e=>e.e),__vite__mapDeps([0,1])),{project:h,issues:R,statuses:k,sprints:Y,userMap:H,workingDays:$,holidays:K}=l,Q=new Map(k.map(e=>[e.key,e])),A=R.filter(e=>e.due_date),v=R.filter(e=>!e.due_date),m={},w=[];for(const e of A)e.sprint_id?(m[e.sprint_id]||(m[e.sprint_id]=[]),m[e.sprint_id].push(e)):w.push(e);let C=null,x=null;for(const e of A){const o=e.start_date?new Date(e.start_date):new Date(e.due_date),d=new Date(e.due_date);(!C||o<C)&&(C=o),(!x||d>x)&&(x=d)}const y=C!==null&&x!==null,U=y?wt(C,7):null,Z=y?nt(x,7):null,f=[];if(U&&Z){let e=new Date(U);for(;e<=Z;)f.push(new Date(e)),e=nt(e,1)}const W=new z.Workbook,s=W.addWorksheet("Gantt Chart"),j=g+f.length,M={type:"pattern",pattern:"solid",fgColor:{argb:"FF27272a"}},st={type:"pattern",pattern:"solid",fgColor:{argb:"FFf5f5f5"}},E={type:"pattern",pattern:"solid",fgColor:{argb:"FFfafafa"}},F={type:"pattern",pattern:"solid",fgColor:{argb:"FFe0e7ff"}},b={style:"thin",color:{argb:"FFe4e4e7"}},_={top:b,bottom:b,left:b,right:b};s.mergeCells(1,1,1,Math.max(g,j));const G=s.getCell(1,1);G.value=`${h.identifier} — ${h.name}`,G.font={bold:!0,size:14,color:{argb:"FFffffff"}},G.fill=M,G.alignment={vertical:"middle"},s.getRow(1).height=30,s.mergeCells(2,1,2,Math.max(g,j));const S=s.getCell(2,1);if(S.value=`Exported on ${I(new Date,"MMM d, yyyy")}`,S.font={size:10,color:{argb:"FF71717a"}},S.fill=M,S.alignment={vertical:"middle"},h.description){s.mergeCells(3,1,3,Math.max(g,j));const e=s.getCell(3,1);e.value=h.description,e.font={size:10,italic:!0,color:{argb:"FFa1a1aa"}},e.fill=M,e.alignment={vertical:"middle"}}const t=5,i=["ID","Title","Status","Priority","Assignee(s)","Sprint","Start Date","Due Date","Duration"],n=[12,35,15,10,22,18,12,12,10];for(let e=0;e<i.length;e++){const o=s.getColumn(e+1);o.width=n[e];const d=s.getCell(t,e+1);d.value=i[e],d.font={bold:!0,size:10,color:{argb:"FFffffff"}},d.fill=M,d.alignment={horizontal:"center",vertical:"middle"},d.border=_}for(let e=0;e<f.length;e++){const o=g+e+1,d=s.getColumn(o);d.width=4;const u=s.getCell(t,o);u.value=`${I(f[e],"d")}
2
+ import{a as Dt,b as vt,j as a}from"./vendor-query-BildmsPY.js";import{u as Ct,r as P,h as Mt}from"./vendor-react-Lycsri1F.js";import{_ as Ft,s as wt,a as nt,f as I,c as jt,i as St,u as It,b as zt,d as kt,e as Et,g as Gt,h as Nt,j as Rt,k as $t,W as ht,B as xt,D as Bt,P as Tt,G as Pt,l as At,m as rt,n as lt,o as Ut,p as Wt,q as Lt,r as it,t as yt,v as Ot,w as qt,I as Yt,C as Ht,x as dt,y as Kt,z as Qt}from"./index-BJplLsFj.js";import"./vendor-radix-B5umFwGL.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cu5gNfTV.js";const g=9;function bt(l){return"FF"+l.replace("#","")}async function Zt(l){var ct;const z=await Ft(()=>import("./exceljs.min-BhVFTGw4.js").then(e=>e.e),__vite__mapDeps([0,1])),{project:h,issues:R,statuses:k,sprints:Y,userMap:H,workingDays:$,holidays:K}=l,Q=new Map(k.map(e=>[e.key,e])),A=R.filter(e=>e.due_date),v=R.filter(e=>!e.due_date),m={},w=[];for(const e of A)e.sprint_id?(m[e.sprint_id]||(m[e.sprint_id]=[]),m[e.sprint_id].push(e)):w.push(e);let C=null,x=null;for(const e of A){const o=e.start_date?new Date(e.start_date):new Date(e.due_date),d=new Date(e.due_date);(!C||o<C)&&(C=o),(!x||d>x)&&(x=d)}const y=C!==null&&x!==null,U=y?wt(C,7):null,Z=y?nt(x,7):null,f=[];if(U&&Z){let e=new Date(U);for(;e<=Z;)f.push(new Date(e)),e=nt(e,1)}const W=new z.Workbook,s=W.addWorksheet("Gantt Chart"),j=g+f.length,M={type:"pattern",pattern:"solid",fgColor:{argb:"FF27272a"}},st={type:"pattern",pattern:"solid",fgColor:{argb:"FFf5f5f5"}},E={type:"pattern",pattern:"solid",fgColor:{argb:"FFfafafa"}},F={type:"pattern",pattern:"solid",fgColor:{argb:"FFe0e7ff"}},b={style:"thin",color:{argb:"FFe4e4e7"}},_={top:b,bottom:b,left:b,right:b};s.mergeCells(1,1,1,Math.max(g,j));const G=s.getCell(1,1);G.value=`${h.identifier} — ${h.name}`,G.font={bold:!0,size:14,color:{argb:"FFffffff"}},G.fill=M,G.alignment={vertical:"middle"},s.getRow(1).height=30,s.mergeCells(2,1,2,Math.max(g,j));const S=s.getCell(2,1);if(S.value=`Exported on ${I(new Date,"MMM d, yyyy")}`,S.font={size:10,color:{argb:"FF71717a"}},S.fill=M,S.alignment={vertical:"middle"},h.description){s.mergeCells(3,1,3,Math.max(g,j));const e=s.getCell(3,1);e.value=h.description,e.font={size:10,italic:!0,color:{argb:"FFa1a1aa"}},e.fill=M,e.alignment={vertical:"middle"}}const t=5,i=["ID","Title","Status","Priority","Assignee(s)","Sprint","Start Date","Due Date","Duration"],n=[12,35,15,10,22,18,12,12,10];for(let e=0;e<i.length;e++){const o=s.getColumn(e+1);o.width=n[e];const d=s.getCell(t,e+1);d.value=i[e],d.font={bold:!0,size:10,color:{argb:"FFffffff"}},d.fill=M,d.alignment={horizontal:"center",vertical:"middle"},d.border=_}for(let e=0;e<f.length;e++){const o=g+e+1,d=s.getColumn(o);d.width=4;const u=s.getCell(t,o);u.value=`${I(f[e],"d")}
3
3
  ${I(f[e],"MMM")}`,u.font={bold:!0,size:7,color:{argb:"FFffffff"}},u.fill=M,u.alignment={horizontal:"center",vertical:"middle",wrapText:!0},u.border=_}s.getRow(t).height=28;let p=t+1,J=0;function N(e){s.mergeCells(p,1,p,g);const o=s.getCell(p,1);o.value=e,o.font={bold:!0,size:10,color:{argb:"FF312e81"}},o.fill=F,o.alignment={vertical:"middle"},o.border=_;for(let d=0;d<f.length;d++){const u=s.getCell(p,g+d+1);u.fill=F,u.border=_}p++}function L(e,o){var gt;const d=J%2===0,u=Q.get(e.status),_t=(gt=e.assignee_ids)!=null&&gt.length?e.assignee_ids.map(r=>{var c;return((c=H.get(r))==null?void 0:c.name)??"Unknown"}).join(", "):"Unassigned",q=e.start_date?new Date(e.start_date):null,T=e.due_date?new Date(e.due_date):null;let ut="—";q&&T&&$&&(ut=`${jt(q,T,$,K)}d`);const ft=[e.identifier,e.title,(u==null?void 0:u.name)??e.status,e.priority.charAt(0).toUpperCase()+e.priority.slice(1),_t,o,q?I(q,"MMM d, yyyy"):"—",T?I(T,"MMM d, yyyy"):"—",ut];for(let r=0;r<ft.length;r++){const c=s.getCell(p,r+1);c.value=ft[r],c.font={size:9},c.alignment={vertical:"middle"},c.border=_,d&&(c.fill=E),r===2&&u&&(c.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(u.color)}},c.font={size:9,color:{argb:"FFffffff"},bold:!0},c.alignment={horizontal:"center",vertical:"middle"})}const pt=q??T,mt=T;let D=-1,et=-1;if(pt&&mt)for(let r=0;r<f.length;r++){const c=f[r];c>=pt&&c<=mt&&(D===-1&&(D=g+r+1),et=g+r+1)}if(D!==-1&&et>D&&s.mergeCells(p,D,p,et),D!==-1&&u){const r=s.getCell(p,D);r.fill={type:"pattern",pattern:"solid",fgColor:{argb:bt(u.color)}},r.border=_}for(let r=0;r<f.length;r++){const c=g+r+1;if(D!==-1&&c>=D&&c<=et)continue;const ot=s.getCell(p,c);ot.border=_,St(f[r],$,K)?d&&(ot.fill=E):ot.fill=st}p++,J++}const V=new Map(Y.map(e=>[e.id,e]));for(const e of Y){const o=m[e.id];if(o!=null&&o.length){N(e.name);for(const d of o)L(d,e.name)}}if(w.length>0){N("No Sprint");for(const e of w)L(e,"—")}if(v.length>0){N("Unscheduled");for(const e of v){const o=e.sprint_id?((ct=V.get(e.sprint_id))==null?void 0:ct.name)??"—":"—";L(e,o)}}s.views=[{state:"frozen",xSplit:g,ySplit:t}];const B=await W.xlsx.writeBuffer(),X=new Blob([B],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),tt=URL.createObjectURL(X),O=document.createElement("a");O.href=tt,O.download=`${h.identifier}-gantt-${I(new Date,"yyyy-MM-dd")}.xlsx`,document.body.appendChild(O),O.click(),document.body.removeChild(O),URL.revokeObjectURL(tt)}function at(l,z){const h=l.start_date?new Date(l.start_date):new Date(l.due_date),R=l.due_date?nt(new Date(l.due_date),1):nt(h,1);return{id:l.id,name:`${l.identifier} ${l.title}`,startAt:h,endAt:R,status:{id:l.status,name:l.status,color:z}}}function se(){const{projectKey:l,workspace:z}=Ct(),h=Dt(),R=It(),[k,Y]=P.useState("monthly"),[H,$]=P.useState(null),[K,Q]=P.useState(!1),A=P.useRef(null);P.useEffect(()=>{const t=requestAnimationFrame(()=>{var V;const i=(V=A.current)==null?void 0:V.querySelector(".gantt");if(!i)return;const n=new Date,p=n.getFullYear()-1,J=300;let N;if(k==="daily"){const B=new Date(p,0,1);N=Math.floor((n.getTime()-B.getTime())/864e5)*50}else{const B=k==="monthly"?150:100,X=(n.getFullYear()-p)*12+n.getMonth(),tt=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();N=X*B+(n.getDate()-1)/tt*B}const L=i.clientWidth-J;i.scrollLeft=Math.max(0,N-L/2)});return()=>cancelAnimationFrame(t)},[k]);const{data:v}=zt(l??""),m=(v==null?void 0:v.id)??"",{data:w=[]}=kt(m||void 0),{data:C=[]}=Et(m||void 0),{data:x=[]}=Gt(m||void 0),{data:y}=Nt(),{data:U=[]}=Rt(new Date().getFullYear()),{data:Z=new Map}=$t(),[f,W]=P.useState(!1),s=vt({mutationFn:({id:t,start_date:i,due_date:n})=>Qt.put(`/admin/issues/${t}`,{start_date:i,due_date:n}),onSuccess:()=>{h.invalidateQueries({queryKey:Kt.byProject(m)})},onError:()=>dt.error("Failed to update issue dates")}),j=Object.fromEntries(C.map(t=>[t.key,t.color])),M=t=>{if(!t.start_date||!t.due_date||!(y!=null&&y.working_days))return;const i=jt(new Date(t.start_date),new Date(t.due_date),y.working_days,U);return`${i} business day${i!==1?"s":""}`},st=w.filter(t=>t.due_date),E=w.filter(t=>!t.due_date),F={},b=[];for(const t of st)t.sprint_id?(F[t.sprint_id]||(F[t.sprint_id]=[]),F[t.sprint_id].push(t)):b.push(t);const _=async()=>{if(!(!v||f)){W(!0);try{await Zt({project:v,issues:w,statuses:C,sprints:x,userMap:Z,workingDays:(y==null?void 0:y.working_days)??{mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1},holidays:U}),dt.success("Gantt chart exported")}catch(t){dt.error("Failed to export Gantt chart"),console.error(t)}finally{W(!1)}}},G=(t,i,n)=>{s.mutate({id:t,start_date:I(i,"yyyy-MM-dd"),due_date:n?I(wt(n,1),"yyyy-MM-dd"):null})},S=t=>{const i=w.find(n=>n.id===t)??null;$(i)};return R&&l&&z?a.jsx(Mt,{to:`/${z}/projects/${l}/issues`,replace:!0}):l?a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.jsx(ht,{zone:"project.timeline.before",props:{projectId:m}}),a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0 bg-white dark:bg-zinc-950",children:[a.jsx("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5",children:["daily","monthly","quarterly"].map(t=>a.jsx("button",{onClick:()=>Y(t),className:`px-3 py-1 rounded text-xs font-medium transition-colors capitalize ${k===t?"bg-white dark:bg-zinc-900 text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:t},t))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(xt,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:_,disabled:f||w.length===0,children:[a.jsx(Bt,{className:"h-3.5 w-3.5"}),f?"Exporting...":"Export"]}),a.jsxs(xt,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>Q(!0),children:[a.jsx(Tt,{className:"h-3.5 w-3.5"}),"Issue"]})]})]}),a.jsx("div",{ref:A,className:"flex-1 min-h-0 overflow-hidden",children:a.jsxs(Pt,{range:k,zoom:100,className:"h-full bg-white dark:bg-zinc-950",children:[a.jsxs(At,{children:[x.map(t=>{const i=F[t.id]??[];return a.jsx(rt,{name:t.name,children:i.map(n=>a.jsx(lt,{feature:at(n,j[n.status]??"#94a3b8"),duration:M(n),onSelectItem:S},n.id))},t.id)}),b.length>0&&a.jsx(rt,{name:"No Sprint",children:b.map(t=>a.jsx(lt,{feature:at(t,j[t.status]??"#94a3b8"),duration:M(t),onSelectItem:S},t.id))}),E.length>0&&a.jsx(rt,{name:"Unscheduled",children:E.map(t=>a.jsx(lt,{feature:{id:t.id,name:`${t.identifier} ${t.title}`,startAt:new Date,endAt:new Date,status:{id:t.status,name:t.status,color:j[t.status]??"#94a3b8"}},onSelectItem:S},t.id))})]}),a.jsxs(Ut,{children:[a.jsx(Wt,{}),a.jsxs(Lt,{children:[x.map(t=>{const i=F[t.id]??[];return a.jsx(it,{children:i.map(n=>a.jsx("div",{className:"flex",children:a.jsx(yt,{onMove:G,...at(n,j[n.status]??"#94a3b8")})},n.id))},t.id)}),b.length>0&&a.jsx(it,{children:b.map(t=>a.jsx("div",{className:"flex",children:a.jsx(yt,{onMove:G,...at(t,j[t.status]??"#94a3b8")})},t.id))}),E.length>0&&a.jsx(it,{children:E.map(t=>a.jsx("div",{style:{height:"var(--gantt-row-height)"}},t.id))})]}),x.filter(t=>t.end_date).map(t=>a.jsx(Ot,{id:t.id,date:new Date(t.end_date),label:`${t.name} end`},t.id)),a.jsx(qt,{})]})]})}),a.jsx(ht,{zone:"project.timeline.after",props:{projectId:m}}),a.jsx(Yt,{issue:H,projectId:m,open:!!H,onClose:()=>$(null)}),a.jsx(Ht,{open:K,onClose:()=>Q(!1),projectId:m})]}):null}export{se as ProjectTimelinePage};
@@ -0,0 +1 @@
1
+ import{j as e,a as ce}from"./vendor-query-BildmsPY.js";import{r as h}from"./vendor-react-Lycsri1F.js";import{ba as ue,b5 as me,bb as Z,bc as ee,bd as te,be as se,bf as $,bg as L,f as C,B as N,bh as ge,bi as he,P as xe,bj as B,bk as R,bl as F,bm as Y,bn as G,bo as ne,i as ae,bp as re,bq as fe,br as pe,bs as be,bt as je,bu as ye,bv as ke,bw as Me,bx as ve,by as I,aM as U,aN as V,aO as K,aP as q,aQ as Q,aL as H,bz as De,bA as Ne,x as P,bB as we,b8 as Se,bC as Ce,h as _e,j as Te,c as Ie}from"./index-BJplLsFj.js";import"./vendor-radix-B5umFwGL.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cu5gNfTV.js";function oe(n,t){const{start:s,end:a}=ue(t==null?void 0:t.in,n);let o=+s>+a;const d=o?+s:+a,r=o?a:s;r.setHours(0,0,0,0);let c=1;const l=[];for(;+r<=d;)l.push(me(s,r)),r.setDate(r.getDate()+c),r.setHours(0,0,0,0);return o?l.reverse():l}function Ee(n,t,s){return Z(n,-1,s)}function Ae(n,t,s){return ee(n,-1,s)}const w=8,Oe=w*60;function J(n){if(n<=0)return"0h";const t=Math.floor(n/60),s=n%60,a=Math.floor(t/(w*5)),o=t%(w*5),d=Math.floor(o/w),r=o%w,c=[];return a>0&&c.push(`${a}w`),d>0&&c.push(`${d}d`),r>0&&c.push(`${r}h`),s>0&&a===0&&c.push(`${s}m`),c.length>0?c.join(" "):"0h"}function Pe(n,t){const s=te(new Date(n,t)),a=se(new Date(n,t)),o=$(s),d=L(a);return oe({start:o,end:d})}function Fe(n){const t=$(n),s=L(n);return oe({start:t,end:s})}function He(n){const t=new Map;for(const s of n){if(!s.logged_date)continue;const a=s.logged_date.slice(0,10),o=t.get(a);o?o.push(s):t.set(a,[s])}return t}const X=["bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400","bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400","bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400","bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400","bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400","bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400","bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400","bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400"];function $e(n){let t=0;for(let s=0;s<n.length;s++)t=(t<<5)-t+n.charCodeAt(s)|0;return X[Math.abs(t)%X.length]}function S(n){return C(n,"yyyy-MM-dd")}function Le(n){const t=n.trim();if(!t)return null;if(/^\d+(\.\d+)?$/.test(t))return Math.round(parseFloat(t)*60);let s=0,a=!1;const o=t.match(/(\d+(?:\.\d+)?)\s*h/i);o&&(s+=Math.round(parseFloat(o[1])*60),a=!0);const d=t.match(/(\d+)\s*m/i);return d&&(s+=parseInt(d[1],10),a=!0),a?s:null}function We({currentDate:n,view:t,onNavigate:s,onViewChange:a,onAddTime:o}){const d=C(n,"MMMM yyyy"),r=()=>{s(t==="month"?Ee(n):Ae(n))},c=()=>{s(t==="month"?Z(n,1):ee(n,1))},l=()=>{s(new Date)};return e.jsxs("div",{className:"flex flex-col gap-3 px-4 pt-4 pb-2 sm:px-6 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-xl font-bold sm:text-2xl",children:d}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(N,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:r,children:e.jsx(ge,{className:"h-4 w-4"})}),e.jsx(N,{variant:"outline",size:"sm",className:"h-8",onClick:l,children:"Today"}),e.jsx(N,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:c,children:e.jsx(he,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center rounded-md border bg-muted/40 p-0.5",children:[e.jsx("button",{className:`rounded px-3 py-1 text-xs font-medium transition-colors ${t==="week"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>a("week"),children:"Week"}),e.jsx("button",{className:`rounded px-3 py-1 text-xs font-medium transition-colors ${t==="month"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>a("month"),children:"Month"})]}),e.jsxs(N,{size:"sm",className:"h-8 gap-1.5",onClick:o,children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"Add spent time"]})]})]})}function ze({totalLoggedMinutes:n,totalExpectedMinutes:t}){return e.jsxs("div",{className:"px-4 pb-2 text-sm text-muted-foreground sm:px-6",children:["Spent time"," ",e.jsx("span",{className:"font-medium text-foreground",children:J(n)})," ","of"," ",e.jsx("span",{className:"font-medium text-foreground",children:J(t)})]})}function ie({date:n,logs:t,isCurrentMonth:s,isToday:a,isBusinessDay:o,isHoliday:d,holidayName:r,compact:c,onClickDay:l}){const x=n.getDate(),m=t.reduce((u,D)=>u+(D.duration_minutes??0),0),b=Math.floor(m/60),g=o?w:0;let v="text-muted-foreground bg-muted/60";g>0&&m>0&&(v=b>=g?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400");let j="";d?j="bg-amber-50/50 dark:bg-amber-950/10":o||(j="bg-muted/20");const f=c?3:8,y=Be(t),k=y.slice(0,f),M=y.length-f;return e.jsxs("div",{className:`relative flex flex-col border-r border-b p-1.5 ${j} ${s?"":"opacity-40"} ${a?"ring-2 ring-inset ring-indigo-500/40":""} ${c?"min-h-[100px]":"min-h-[180px]"} cursor-pointer hover:bg-accent/30 transition-colors`,onClick:()=>l==null?void 0:l(n),children:[e.jsxs("div",{className:"flex items-start justify-between gap-1 mb-1",children:[e.jsx("span",{className:`text-sm font-medium leading-none ${a?"flex h-6 w-6 items-center justify-center rounded-full bg-indigo-600 text-white text-xs":""}`,children:x}),(m>0||g>0)&&e.jsxs("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium leading-none ${v}`,children:[b,"h of ",g,"h"]})]}),d&&r&&e.jsx("span",{className:"text-xs text-amber-600 dark:text-amber-400 truncate mb-0.5",children:r}),e.jsxs("div",{className:"flex flex-col gap-0.5 overflow-hidden flex-1",children:[k.map(u=>e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs("div",{className:`rounded px-1.5 py-1 text-xs font-medium leading-tight truncate ${u.colorClass}`,children:[u.identifier,u.totalMinutes>0&&e.jsx("span",{className:"ml-1 opacity-70",children:F(u.totalMinutes)})]})}),e.jsxs(Y,{side:"top",className:"text-xs",children:[e.jsx("p",{className:"font-medium",children:u.identifier}),u.title&&e.jsx("p",{className:"text-muted-foreground",children:u.title}),e.jsx("p",{children:F(u.totalMinutes)})]})]},u.key)),M>0&&e.jsxs(B,{children:[e.jsx(R,{asChild:!0,children:e.jsxs("span",{className:"text-xs text-muted-foreground px-1.5",children:["+",M," more"]})}),e.jsx(Y,{side:"top",className:"text-xs max-w-[200px]",children:y.slice(f).map(u=>e.jsxs("div",{children:[u.identifier," — ",F(u.totalMinutes)]},u.key))})]})]})]})}function Be(n){const t=new Map;for(const s of n){const a=s.issue_identifier??s.issue_id,o=t.get(a);o?o.totalMinutes+=s.duration_minutes??0:t.set(a,{key:a,identifier:s.issue_identifier??"Unknown",title:s.issue_title??null,projectIdentifier:s.project_identifier??null,totalMinutes:s.duration_minutes??0,colorClass:$e(s.project_identifier??s.project_id??"")})}return Array.from(t.values())}const Re=["SUN","MON","TUE","WED","THU","FRI","SAT"];function Ye({dates:n,currentDate:t,logsByDate:s,workingDays:a,holidays:o,onClickDay:d}){const r=G(t),c=new Date;return e.jsx(ne,{delayDuration:200,children:e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"grid grid-cols-7 min-w-[700px]",children:[Re.map(l=>e.jsx("div",{className:"border-r border-b px-2 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-muted/30",children:l},l)),n.map(l=>{const x=S(l),m=s.get(x)??[],b=ae(l,a,o),g=Ge(l,o);return e.jsx(ie,{date:l,logs:m,isCurrentMonth:G(l)===r,isToday:re(l,c),isBusinessDay:b,isHoliday:!!g,holidayName:g==null?void 0:g.name,compact:!0,onClickDay:d},x)})]})})})}function Ge(n,t){const s=n.getMonth(),a=n.getDate(),o=n.getFullYear();return t.find(d=>{const r=new Date(d.date);return d.recurring?r.getMonth()===s&&r.getDate()===a:r.getFullYear()===o&&r.getMonth()===s&&r.getDate()===a})}function Ue({dates:n,logsByDate:t,workingDays:s,holidays:a,onClickDay:o}){const d=new Date;return e.jsx(ne,{delayDuration:200,children:e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"grid grid-cols-7 min-w-[700px]",children:[n.map(r=>e.jsx("div",{className:"border-r border-b px-2 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-muted/30",children:C(r,"EEE MMM d")},r.toISOString())),n.map(r=>{const c=S(r),l=t.get(c)??[],x=ae(r,s,a),m=Ve(r,a);return e.jsx(ie,{date:r,logs:l,isCurrentMonth:!0,isToday:re(r,d),isBusinessDay:x,isHoliday:!!m,holidayName:m==null?void 0:m.name,compact:!1,onClickDay:o},c)})]})})})}function Ve(n,t){const s=n.getMonth(),a=n.getDate(),o=n.getFullYear();return t.find(d=>{const r=new Date(d.date);return d.recurring?r.getMonth()===s&&r.getDate()===a:r.getFullYear()===o&&r.getMonth()===s&&r.getDate()===a})}function Ke({open:n,onOpenChange:t,defaultDate:s}){const a=ce(),[o,d]=h.useState(""),[r,c]=h.useState(""),[l,x]=h.useState(""),[m,b]=h.useState(C(s??new Date,"yyyy-MM-dd")),[g,v]=h.useState(""),[j,f]=h.useState(""),{data:y=[]}=fe(),k=h.useMemo(()=>y.map(i=>i.id),[y]),{data:M=[]}=pe(k.length>0?{workspaceIds:k,limit:500}:{allWorkspaces:!0,limit:500}),{data:u}=be({project_id:o,search:j||void 0,pageSize:30}),D=(u==null?void 0:u.issues)??[],_=je(r),E=()=>{const i=Le(l);if(!i||i<=0){P.error("Please enter a valid duration (e.g. 2h 30m)");return}if(!r){P.error("Please select an issue");return}_.mutate({duration_minutes:i,description:g||void 0,logged_date:m},{onSuccess:()=>{P.success("Time logged successfully"),a.invalidateQueries({queryKey:we.all}),T()},onError:A=>{P.error((A==null?void 0:A.message)??"Failed to log time")}})},T=()=>{d(""),c(""),x(""),b(C(new Date,"yyyy-MM-dd")),v(""),f(""),t(!1)},p=i=>{if(i&&s&&b(C(s,"yyyy-MM-dd")),!i){T();return}t(i)};return e.jsx(ye,{open:n,onOpenChange:p,children:e.jsxs(ke,{className:"sm:max-w-md",children:[e.jsx(Me,{children:e.jsx(ve,{children:"Add spent time"})}),e.jsxs("div",{className:"grid gap-4 py-2",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(I,{htmlFor:"ts-project",children:"Project"}),e.jsxs(U,{value:o,onValueChange:i=>{d(i),c(""),f("")},children:[e.jsx(V,{id:"ts-project",children:e.jsx(K,{placeholder:"Select a project"})}),e.jsx(q,{children:M.map(i=>e.jsxs(Q,{value:i.id,children:[i.identifier," — ",i.name]},i.id))})]})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(I,{htmlFor:"ts-issue",children:"Issue"}),e.jsx(H,{placeholder:"Search issues...",value:j,onChange:i=>f(i.target.value),className:"mb-1",disabled:!o}),e.jsxs(U,{value:r,onValueChange:c,disabled:!o,children:[e.jsx(V,{id:"ts-issue",children:e.jsx(K,{placeholder:o?"Select an issue":"Select a project first"})}),e.jsxs(q,{children:[D.map(i=>e.jsxs(Q,{value:i.id,children:[i.identifier," — ",i.title]},i.id)),D.length===0&&o&&e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No issues found"})]})]})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(I,{htmlFor:"ts-duration",children:"Duration"}),e.jsx(H,{id:"ts-duration",placeholder:"e.g. 2h 30m",value:l,onChange:i=>x(i.target.value)})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(I,{htmlFor:"ts-date",children:"Date"}),e.jsx(H,{id:"ts-date",type:"date",value:m,onChange:i=>b(i.target.value)})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(I,{htmlFor:"ts-desc",children:"Description (optional)"}),e.jsx(De,{id:"ts-desc",placeholder:"What did you work on?",value:g,onChange:i=>v(i.target.value),rows:2})]})]}),e.jsxs(Ne,{children:[e.jsx(N,{variant:"outline",onClick:T,children:"Cancel"}),e.jsx(N,{onClick:E,disabled:_.isPending||!r||!l,children:_.isPending?"Logging...":"Log time"})]})]})})}function tt(){const{user:n}=Se(),[t,s]=h.useState(new Date),[a,o]=h.useState("month"),[d,r]=h.useState(!1),[c,l]=h.useState(null),x=t.getFullYear(),m=t.getMonth(),{from:b,to:g,gridDates:v}=h.useMemo(()=>{if(a==="month"){const i=Pe(x,m);return{from:S(i[0]),to:S(i[i.length-1]),gridDates:i}}const p=Fe(t);return{from:S(p[0]),to:S(p[p.length-1]),gridDates:p}},[x,m,t,a]),{data:j}=Ce({user_id:n==null?void 0:n.id,from:b,to:g,limit:1e3},{enabled:!!(n!=null&&n.id)}),f=(j==null?void 0:j.time_logs)??[],{data:y}=_e(),k=(y==null?void 0:y.working_days)??{mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1},{data:M=[]}=Te(x),u=h.useMemo(()=>He(f),[f]),{totalLoggedMinutes:D,totalExpectedMinutes:_}=h.useMemo(()=>{const p=a==="month"?te(t):$(t),i=a==="month"?se(t):L(t),de=Ie(p,i,k,M)*Oe;let W=0;for(const O of f){if(!O.logged_date||!O.duration_minutes)continue;const le=O.logged_date.slice(0,10),z=new Date(le+"T00:00:00");z>=p&&z<=i&&(W+=O.duration_minutes)}return{totalLoggedMinutes:W,totalExpectedMinutes:de}},[f,t,a,k,M]),E=p=>{l(p),r(!0)},T=()=>{l(null),r(!0)};return e.jsxs("div",{className:"p-2 md:h-full",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[e.jsx(We,{currentDate:t,view:a,onNavigate:s,onViewChange:o,onAddTime:T}),e.jsx(ze,{totalLoggedMinutes:D,totalExpectedMinutes:_}),a==="month"?e.jsx(Ye,{dates:v,currentDate:t,logsByDate:u,workingDays:k,holidays:M,onClickDay:E}):e.jsx(Ue,{dates:v,logsByDate:u,workingDays:k,holidays:M,onClickDay:E})]}),e.jsx(Ke,{open:d,onOpenChange:r,defaultDate:c})]})}export{tt as TimesheetPage};
@@ -0,0 +1 @@
1
+ import{j as r}from"./vendor-query-BildmsPY.js";import{b8 as t,b9 as i}from"./index-BJplLsFj.js";import"./vendor-react-Lycsri1F.js";import"./vendor-radix-B5umFwGL.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-Cu5gNfTV.js";function u(){const{workspace:o}=t();return r.jsx(i,{workspaceId:o==null?void 0:o.id})}export{u as WorkspaceReportingPage};