@meridianjs/admin-dashboard 1.28.0 → 1.30.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.
@@ -0,0 +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-DFNKfBK2.js";import{u as h}from"./vendor-react-Lycsri1F.js";import{p}from"./parseISO-BYBJ5Tah.js";import"./vendor-radix-BO9o-Y4t.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-AZ54pP77.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};
@@ -0,0 +1,6 @@
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-DFNKfBK2.js";import{p as z}from"./parseISO-BYBJ5Tah.js";import"./vendor-radix-BO9o-Y4t.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-AZ54pP77.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ha=ut("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);function de(){return de=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)({}).hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},de.apply(null,arguments)}var Ue=t=>{var{cx:e,cy:a,r,className:s}=t,l=ue("recharts-dot",s);return W(e)&&W(a)&&W(r)?o.createElement("circle",de({},me(t),De(t),{className:l,cx:e,cy:a,r})):null},fa=["points"];function Se(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,r)}return a}function oe(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?Se(Object(a),!0).forEach(function(r){xa(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Se(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function xa(t,e,a){return(e=va(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function va(t){var e=ga(t,"string");return typeof e=="symbol"?e:e+""}function ga(t,e){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)({}).hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},ae.apply(null,arguments)}function ya(t,e){if(t==null)return{};var a,r,s=ba(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r<l.length;r++)a=l[r],e.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function ba(t,e){if(t==null)return{};var a={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;a[r]=t[r]}return a}function ja(t){var{option:e,dotProps:a,className:r}=t;if(o.isValidElement(e))return o.cloneElement(e,a);if(typeof e=="function")return e(a);var s=ue(r,typeof e!="boolean"?e.className:""),l=a??{},{points:d}=l,i=ya(l,fa);return o.createElement(Ue,ae({},i,{className:s}))}function Pa(t,e){return t==null?!1:e?!0:t.length===1}function Na(t){var{points:e,dot:a,className:r,dotClassName:s,dataKey:l,baseProps:d,needClip:i,clipPathId:c,zIndex:m=pe.scatter}=t;if(!Pa(e,a))return null;var p=Le(a),h=mt(a),g=e.map((v,k)=>{var b,C,S=oe(oe(oe({r:3},d),h),{},{index:k,cx:(b=v.x)!==null&&b!==void 0?b:void 0,cy:(C=v.y)!==null&&C!==void 0?C:void 0,dataKey:l,value:v.value,payload:v.payload,points:e});return o.createElement(ja,{key:"dot-".concat(k),option:a,dotProps:S,className:s})}),f={};return i&&c!=null&&(f.clipPath="url(#clipPath-".concat(p?"":"dots-").concat(c,")")),o.createElement(he,{zIndex:m},o.createElement(X,ae({className:r},f),g))}function Ee(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,r)}return a}function ce(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?Ee(Object(a),!0).forEach(function(r){ka(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Ee(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function ka(t,e,a){return(e=wa(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function wa(t){var e=Aa(t,"string");return typeof e=="symbol"?e:e+""}function Aa(t,e){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ca=t=>{var{point:e,childIndex:a,mainColor:r,activeDot:s,dataKey:l,clipPath:d}=t;if(s===!1||e.x==null||e.y==null)return null;var i={index:a,dataKey:l,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},c=ce(ce(ce({},i),$e(s)),De(s)),m;return o.isValidElement(s)?m=o.cloneElement(s,c):typeof s=="function"?m=s(c):m=o.createElement(Ue,c),o.createElement(X,{className:"recharts-active-dot",clipPath:d},m)};function Ie(t){var{points:e,mainColor:a,activeDot:r,itemDataKey:s,clipPath:l,zIndex:d=pe.activeDot}=t,i=Me(pt),c=ht();if(e==null||c==null)return null;var m=e.find(p=>c.includes(p.payload));return Te(m)?null:o.createElement(he,{zIndex:d},o.createElement(Ca,{point:m,childIndex:Number(i),mainColor:a,dataKey:s,activeDot:r,clipPath:l}))}function Sa(t){var e=$e(t),a=3,r=2;if(e!=null){var{r:s,strokeWidth:l}=e,d=Number(s),i=Number(l);return(Number.isNaN(d)||d<0)&&(d=a),(Number.isNaN(i)||i<0)&&(i=r),{r:d,strokeWidth:i}}return{r:a,strokeWidth:r}}var Fe=(t,e,a)=>We(t,"xAxis",xe(t,e),a),Ge=(t,e,a)=>Ke(t,"xAxis",xe(t,e),a),Ve=(t,e,a)=>We(t,"yAxis",ve(t,e),a),Xe=(t,e,a)=>Ke(t,"yAxis",ve(t,e),a),Ea=ne([fe,Fe,Ve,Ge,Xe],(t,e,a,r,s)=>Re(t,"xAxis")?Ne(e,r,!1):Ne(a,s,!1)),Ia=(t,e)=>e,Ye=ne([gt,Ia],(t,e)=>t.filter(a=>a.type==="area").find(a=>a.id===e)),qe=t=>{var e=fe(t),a=Re(e,"xAxis");return a?"yAxis":"xAxis"},Oa=(t,e)=>{var a=qe(t);return a==="yAxis"?ve(t,e):xe(t,e)},_a=(t,e,a)=>yt(t,qe(t),Oa(t,e),a),Da=ne([Ye,_a],(t,e)=>{var a;if(!(t==null||e==null)){var{stackId:r}=t,s=vt(t);if(!(r==null||s==null)){var l=(a=e[r])===null||a===void 0?void 0:a.stackedData,d=l==null?void 0:l.find(i=>i.key===s);if(d!=null)return d.map(i=>[i[0],i[1]])}}}),La=ne([fe,Fe,Ve,Ge,Xe,Da,ft,Ea,Ye,xt],(t,e,a,r,s,l,d,i,c,m)=>{var{chartData:p,dataStartIndex:h,dataEndIndex:g}=d;if(!(c==null||t!=="horizontal"&&t!=="vertical"||e==null||a==null||r==null||s==null||r.length===0||s.length===0||i==null)){var{data:f}=c,v;if(f&&f.length>0?v=f:v=p==null?void 0:p.slice(h,g+1),v!=null)return Qa({layout:t,xAxis:e,yAxis:a,xAxisTicks:r,yAxisTicks:s,dataStartIndex:h,areaSettings:c,stackedData:l,displayedData:v,chartBaseValue:m,bandSize:i})}}),Ma=["id"],Ta=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function B(){return B=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)({}).hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},B.apply(null,arguments)}function Ze(t,e){if(t==null)return{};var a,r,s=$a(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r<l.length;r++)a=l[r],e.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function $a(t,e){if(t==null)return{};var a={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;a[r]=t[r]}return a}function Oe(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,r)}return a}function G(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?Oe(Object(a),!0).forEach(function(r){Wa(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Oe(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function Wa(t,e,a){return(e=Ka(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Ka(t){var e=Ra(t,"string");return typeof e=="symbol"?e:e+""}function Ra(t,e){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function re(t,e){return t&&t!=="none"?t:e}var za=t=>{var{dataKey:e,name:a,stroke:r,fill:s,legendType:l,hide:d}=t;return[{inactive:d,dataKey:e,type:l,color:re(r,s),value:He(a,e),payload:t}]},Ba=o.memo(t=>{var{dataKey:e,data:a,stroke:r,strokeWidth:s,fill:l,name:d,hide:i,unit:c,tooltipType:m,id:p}=t,h={dataDefinedOnItem:a,getPosition:At,settings:{stroke:r,strokeWidth:s,fill:l,dataKey:e,nameKey:void 0,name:He(d,e),hide:i,type:m,color:re(r,l),unit:c,graphicalItemId:p}};return o.createElement(wt,{tooltipEntrySettings:h})});function Ha(t){var{clipPathId:e,points:a,props:r}=t,{needClip:s,dot:l,dataKey:d}=r,i=me(r);return o.createElement(Na,{points:a,dot:l,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:d,baseProps:i,needClip:s,clipPathId:e})}function Ua(t){var{showLabels:e,children:a,points:r}=t,s=r.map(l=>{var d,i,c={x:(d=l.x)!==null&&d!==void 0?d:0,y:(i=l.y)!==null&&i!==void 0?i:0,width:0,lowerWidth:0,upperWidth:0,height:0};return G(G({},c),{},{value:l.value,payload:l.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return o.createElement($t,{value:e?s:void 0},a)}function _e(t){var{points:e,baseLine:a,needClip:r,clipPathId:s,props:l}=t,{layout:d,type:i,stroke:c,connectNulls:m,isRange:p}=l,{id:h}=l,g=Ze(l,Ma),f=me(g),v=Wt(g);return o.createElement(o.Fragment,null,(e==null?void 0:e.length)>1&&o.createElement(X,{clipPath:r?"url(#clipPath-".concat(s,")"):void 0},o.createElement(le,B({},v,{id:h,points:e,connectNulls:m,type:i,baseLine:a,layout:d,stroke:"none",className:"recharts-area-area"})),c!=="none"&&o.createElement(le,B({},f,{className:"recharts-area-curve",layout:d,type:i,connectNulls:m,fill:"none",points:e})),c!=="none"&&p&&o.createElement(le,B({},f,{className:"recharts-area-curve",layout:d,type:i,connectNulls:m,fill:"none",points:a}))),o.createElement(Ha,{points:e,props:g,clipPathId:s}))}function Fa(t){var e,a,{alpha:r,baseLine:s,points:l,strokeWidth:d}=t,i=(e=l[0])===null||e===void 0?void 0:e.y,c=(a=l[l.length-1])===null||a===void 0?void 0:a.y;if(!ee(i)||!ee(c))return null;var m=r*Math.abs(i-c),p=Math.max(...l.map(h=>h.x||0));return W(s)?p=Math.max(s,p):s&&Array.isArray(s)&&s.length&&(p=Math.max(...s.map(h=>h.x||0),p)),W(p)?o.createElement("rect",{x:0,y:i<c?i:i-m,width:p+(d?parseInt("".concat(d),10):1),height:Math.floor(m)}):null}function Ga(t){var e,a,{alpha:r,baseLine:s,points:l,strokeWidth:d}=t,i=(e=l[0])===null||e===void 0?void 0:e.x,c=(a=l[l.length-1])===null||a===void 0?void 0:a.x;if(!ee(i)||!ee(c))return null;var m=r*Math.abs(i-c),p=Math.max(...l.map(h=>h.y||0));return W(s)?p=Math.max(s,p):s&&Array.isArray(s)&&s.length&&(p=Math.max(...s.map(h=>h.y||0),p)),W(p)?o.createElement("rect",{x:i<c?i:i-m,y:0,width:m,height:Math.floor(p+(d?parseInt("".concat(d),10):1))}):null}function Va(t){var{alpha:e,layout:a,points:r,baseLine:s,strokeWidth:l}=t;return a==="vertical"?o.createElement(Fa,{alpha:e,points:r,baseLine:s,strokeWidth:l}):o.createElement(Ga,{alpha:e,points:r,baseLine:s,strokeWidth:l})}function Xa(t){var{needClip:e,clipPathId:a,props:r,previousPointsRef:s,previousBaselineRef:l}=t,{points:d,baseLine:i,isAnimationActive:c,animationBegin:m,animationDuration:p,animationEasing:h,onAnimationStart:g,onAnimationEnd:f}=r,v=o.useMemo(()=>({points:d,baseLine:i}),[d,i]),k=_t(v,"recharts-area-"),b=Dt(),[C,S]=o.useState(!1),E=!C,x=o.useCallback(()=>{typeof f=="function"&&f(),S(!1)},[f]),w=o.useCallback(()=>{typeof g=="function"&&g(),S(!0)},[g]);if(b==null)return null;var j=s.current,P=l.current;return o.createElement(Ua,{showLabels:E,points:d},r.children,o.createElement(Lt,{animationId:k,begin:m,duration:p,isActive:c,easing:h,onAnimationEnd:x,onAnimationStart:w,key:k},N=>{if(j){var I=j.length/d.length,L=N===1?d:d.map((A,D)=>{var M=Math.floor(D*I);if(j[M]){var K=j[M];return G(G({},A),{},{x:U(K.x,A.x,N),y:U(K.y,A.y,N)})}return A}),O;return W(i)?O=U(P,i,N):Te(i)||Mt(i)?O=U(P,0,N):O=i.map((A,D)=>{var M=Math.floor(D*I);if(Array.isArray(P)&&P[M]){var K=P[M];return G(G({},A),{},{x:U(K.x,A.x,N),y:U(K.y,A.y,N)})}return A}),N>0&&(s.current=L,l.current=O),o.createElement(_e,{points:L,baseLine:O,needClip:e,clipPathId:a,props:r})}return N>0&&(s.current=d,l.current=i),o.createElement(X,null,c&&o.createElement("defs",null,o.createElement("clipPath",{id:"animationClipPath-".concat(a)},o.createElement(Va,{alpha:N,points:d,baseLine:i,layout:b,strokeWidth:r.strokeWidth}))),o.createElement(X,{clipPath:"url(#animationClipPath-".concat(a,")")},o.createElement(_e,{points:d,baseLine:i,needClip:e,clipPathId:a,props:r})))}),o.createElement(Tt,{label:r.label}))}function Ya(t){var{needClip:e,clipPathId:a,props:r}=t,s=o.useRef(null),l=o.useRef();return o.createElement(Xa,{needClip:e,clipPathId:a,props:r,previousPointsRef:s,previousBaselineRef:l})}class qa extends o.PureComponent{render(){var{hide:e,dot:a,points:r,className:s,top:l,left:d,needClip:i,xAxisId:c,yAxisId:m,width:p,height:h,id:g,baseLine:f,zIndex:v}=this.props;if(e)return null;var k=ue("recharts-area",s),b=g,{r:C,strokeWidth:S}=Sa(a),E=Le(a),x=C*2+S,w=i?"url(#clipPath-".concat(E?"":"dots-").concat(b,")"):void 0;return o.createElement(he,{zIndex:v},o.createElement(X,{className:k},i&&o.createElement("defs",null,o.createElement(Ot,{clipPathId:b,xAxisId:c,yAxisId:m}),!E&&o.createElement("clipPath",{id:"clipPath-dots-".concat(b)},o.createElement("rect",{x:d-x/2,y:l-x/2,width:p+x,height:h+x}))),o.createElement(Ya,{needClip:i,clipPathId:b,props:this.props})),o.createElement(Ie,{points:r,mainColor:re(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}),this.props.isRange&&Array.isArray(f)&&o.createElement(Ie,{points:f,mainColor:re(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}))}}var Je={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:pe.area};function Za(t){var e,a=ze(t,Je),{activeDot:r,animationBegin:s,animationDuration:l,animationEasing:d,connectNulls:i,dot:c,fill:m,fillOpacity:p,hide:h,isAnimationActive:g,legendType:f,stroke:v,xAxisId:k,yAxisId:b}=a,C=Ze(a,Ta),S=Ct(),E=St(),{needClip:x}=Et(k,b),w=Be(),{points:j,isRange:P,baseLine:N}=(e=Me(M=>La(M,t.id,w)))!==null&&e!==void 0?e:{},I=It();if(S!=="horizontal"&&S!=="vertical"||I==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var{height:L,width:O,x:A,y:D}=I;return!j||!j.length?null:o.createElement(qa,B({},C,{activeDot:r,animationBegin:s,animationDuration:l,animationEasing:d,baseLine:N,connectNulls:i,dot:c,fill:m,fillOpacity:p,height:L,hide:h,layout:S,isAnimationActive:g==="auto"?!Kt.isSsr:g,isRange:P,legendType:f,needClip:x,points:j,stroke:v,width:O,left:A,top:D,xAxisId:k,yAxisId:b}))}var Ja=(t,e,a,r,s)=>{var l=a??e;if(W(l))return l;var d=t==="horizontal"?s:r,i=d.scale.domain();if(d.type==="number"){var c=Math.max(i[0],i[1]),m=Math.min(i[0],i[1]);return l==="dataMin"?m:l==="dataMax"||c<0?c:Math.max(Math.min(i[0],i[1]),0)}return l==="dataMin"?i[0]:l==="dataMax"?i[1]:i[0]};function Qa(t){var{areaSettings:{connectNulls:e,baseValue:a,dataKey:r},stackedData:s,layout:l,chartBaseValue:d,xAxis:i,yAxis:c,displayedData:m,dataStartIndex:p,xAxisTicks:h,yAxisTicks:g,bandSize:f}=t,v=s&&s.length,k=Ja(l,d,a,i,c),b=l==="horizontal",C=!1,S=m.map((x,w)=>{var j,P,N,I;if(v)I=s[p+w];else{var L=ke(x,r);Array.isArray(L)?(I=L,C=!0):I=[k,L]}var O=(j=(P=I)===null||P===void 0?void 0:P[1])!==null&&j!==void 0?j:null,A=O==null||v&&!e&&ke(x,r)==null;if(b){var D;return{x:we({axis:i,ticks:h,bandSize:f,entry:x,index:w}),y:A?null:(D=c.scale.map(O))!==null&&D!==void 0?D:null,value:I,payload:x}}return{x:A?null:(N=i.scale.map(O))!==null&&N!==void 0?N:null,y:we({axis:c,ticks:g,bandSize:f,entry:x,index:w}),value:I,payload:x}}),E;return v||C?E=S.map(x=>{var w,j=Array.isArray(x.value)?x.value[0]:null;if(b){var P;return{x:x.x,y:j!=null&&x.y!=null&&(P=c.scale.map(j))!==null&&P!==void 0?P:null,payload:x.payload}}return{x:j!=null&&(w=i.scale.map(j))!==null&&w!==void 0?w:null,y:x.y,payload:x.payload}}):E=b?c.scale.map(k):i.scale.map(k),{points:S,baseLine:E??0,isRange:C}}function er(t){var e=ze(t,Je),a=Be();return o.createElement(jt,{id:e.id,type:"area"},r=>o.createElement(o.Fragment,null,o.createElement(Pt,{legendPayload:za(e)}),o.createElement(Ba,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),o.createElement(Nt,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:kt(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:a,connectNulls:e.connectNulls}),o.createElement(Za,B({},e,{id:r}))))}var Qe=o.memo(er,bt);Qe.displayName="Area";var tr=["axis"],ar=o.forwardRef((t,e)=>o.createElement(Rt,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:tr,tooltipPayloadSearcher:zt,categoricalChartProps:t,ref:e}));const q={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",stroke:"#10b981",fill:"#d1fae5"},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",stroke:"#f97316",fill:"#ffedd5"},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",stroke:"#fbbf24",fill:"#fef9c3"},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",stroke:"#6366f1",fill:"#e0e7ff"}},rr={delayed:1,on_hold:2,on_track:3,completed:4},nr={1:"Delayed",2:"On hold",3:"On track",4:"Completed"};function V({health:t,className:e}){const a=q[t];return n.jsxs("span",{className:Y("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium border shrink-0",a.badgeCls,e),children:[n.jsx("span",{className:Y("h-1.5 w-1.5 rounded-full shrink-0",a.dotCls)}),a.label]})}function sr({updates:t,onSelect:e}){const a=t[0],r=q[a.health],s=o.useMemo(()=>[...t].reverse().map(c=>{const m=c.report_date??c.created_at;return{id:c.id,date:m,dateLabel:R(z(m),"d MMM yy"),level:rr[c.health],health:c.health,title:c.title??"Untitled"}}),[t]),l=s.length>=2?`${R(z(s[0].date),"MMM yyyy")} – ${R(z(s[s.length-1].date),"MMM yyyy")}`:null,d=({active:c,payload:m})=>{if(!c||!(m!=null&&m.length))return null;const p=m[0].payload;return n.jsxs("div",{className:"bg-popover border border-border rounded-lg shadow-lg px-3 py-2.5 text-sm min-w-[180px]",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:p.dateLabel}),n.jsx(V,{health:p.health}),n.jsx("p",{className:"text-xs font-medium mt-1.5 text-foreground max-w-[220px] truncate",children:p.title}),n.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Click to view report →"})]})},i=c=>{var p,h,g;const m=(g=(h=(p=c==null?void 0:c.activePayload)==null?void 0:p[0])==null?void 0:h.payload)==null?void 0:g.id;m&&e(m)};return n.jsxs("div",{className:"px-8 py-10",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"Status History"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Health status changes over time. Click a point to read the full report."})]}),n.jsxs("div",{className:"flex items-center gap-3 mb-6 flex-wrap",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Current"}),n.jsx(V,{health:a.health})]}),n.jsx(te,{orientation:"vertical",className:"h-4 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.length," update",t.length!==1?"s":""]}),l&&n.jsxs(n.Fragment,{children:[n.jsx(te,{orientation:"vertical",className:"h-4 shrink-0"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:l})]})]}),n.jsx("div",{className:"rounded-xl border border-border bg-muted/20 p-4",children:n.jsx(ca,{width:"100%",height:220,children:n.jsxs(ar,{data:s,margin:{top:16,right:16,bottom:8,left:0},onClick:i,style:{cursor:"pointer"},children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:"healthAreaGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"5%",stopColor:r.stroke,stopOpacity:.18}),n.jsx("stop",{offset:"95%",stopColor:r.stroke,stopOpacity:.03})]})}),n.jsx(da,{strokeDasharray:"3 3",stroke:"currentColor",className:"text-border",strokeOpacity:.5,vertical:!1}),n.jsx(ua,{dataKey:"dateLabel",tick:{fontSize:11,fill:"currentColor",className:"text-muted-foreground"},tickLine:!1,axisLine:!1,dy:6}),n.jsx(ma,{domain:[.5,4.5],ticks:[1,2,3,4],tickFormatter:c=>nr[c]??"",tick:{fontSize:10,fill:"currentColor",className:"text-muted-foreground"},tickLine:!1,axisLine:!1,width:68}),n.jsx(pa,{content:n.jsx(d,{}),cursor:{stroke:r.stroke,strokeWidth:1,strokeDasharray:"4 4"}}),n.jsx(Qe,{type:"stepAfter",dataKey:"level",stroke:r.stroke,strokeWidth:2,fill:"url(#healthAreaGradient)",dot:{r:4,fill:r.stroke,stroke:"white",strokeWidth:2},activeDot:{r:6,fill:r.stroke,stroke:"white",strokeWidth:2,style:{cursor:"pointer"}},isAnimationActive:!1})]})})})]})}function pr(){var je,Pe;const{workspace:t,projectKey:e}=dt(),{data:a}=Bt(e??""),{data:r}=Ht((a==null?void 0:a.id)??""),{data:s=[],isLoading:l}=Ut(a==null?void 0:a.id),d=Ft((a==null?void 0:a.id)??""),i=Gt((a==null?void 0:a.id)??""),c=Vt((a==null?void 0:a.id)??""),m=Xt((a==null?void 0:a.id)??""),[p,h]=o.useState(null),[g,f]=o.useState(!1),[v,k]=o.useState(!1),[b,C]=o.useState(null),[S,E]=o.useState(null),[x,w]=o.useState("on_track"),[j,P]=o.useState(""),[N,I]=o.useState(""),[L,O]=o.useState([]),[A,D]=o.useState(()=>new Date().toISOString().slice(0,10)),M=o.useMemo(()=>r!=null&&r.members?r.members.filter(u=>u.user).map(u=>{const y=u.user;return{id:y.id,email:y.email,first_name:y.first_name??"",last_name:y.last_name??""}}):[],[r]),K=o.useMemo(()=>M.map(u=>({id:u.id,label:`${u.first_name} ${u.last_name}`.trim()||u.email,email:u.email})),[M]),T=o.useMemo(()=>[...s].sort((u,y)=>{const H=u.report_date??u.created_at;return(y.report_date??y.created_at).localeCompare(H)}),[s]),et=T.find(u=>u.id===p),ge=!l&&T.length>=2,ye=!p&&!g&&ge,tt=!p&&!g&&!l&&!ge&&T.length===1,be=g||T.length===0&&!l,_=et??(tt?T[0]:null),at=async()=>{if(a){if(!j.trim()){$.error("Please add a title");return}try{if(v&&p)await i.mutateAsync({updateId:p,health:x,title:j.trim(),summary:N||null,report_date:A||null,collaborators:L}),$.success("Update saved"),k(!1),f(!1);else{const u=await d.mutateAsync({health:x,title:j.trim(),summary:N||null,report_date:A||null,collaborators:L});$.success("Status update posted"),P(""),I(""),w("on_track"),D(new Date().toISOString().slice(0,10)),O([]),f(!1),h(u.update.id)}}catch{$.error(v?"Failed to save update":"Failed to post status update")}}},rt=()=>{k(!1),P(""),I(""),w("on_track"),D(new Date().toISOString().slice(0,10)),O([]),h(null),f(!0)},nt=u=>{h(u.id),w(u.health),P(u.title??""),I(u.summary??""),D(u.report_date??new Date().toISOString().slice(0,10)),O(u.collaborators??[]),k(!0),f(!0)},st=u=>{C(u.id)},it=async()=>{if(b)try{await c.mutateAsync(b),$.success("Update deleted");const u=T.filter(y=>y.id!==b);h(u.length>0?u[0].id:null),f(!1)}catch{$.error("Failed to delete update")}finally{C(null)}},lt=()=>{k(!1),f(!1),O([]),T.length===1?h(T[0].id):h(null)},ot=u=>{var y;if(!((y=u.collaborators)!=null&&y.length)){$.error("No collaborators added to this update");return}E(u.id)},ct=async()=>{if(S)try{const u=await m.mutateAsync(S);$.success(u.sent===0?"No recipients to notify":`Report sent to ${u.sent} collaborator${u.sent===1?"":"s"}`)}catch{$.error("Failed to send report")}finally{E(null)}};return n.jsxs("div",{className:"flex h-full overflow-hidden bg-white dark:bg-card",children:[n.jsxs("div",{className:"w-[20rem] shrink-0 border-r border-border flex flex-col bg-muted/20",children:[n.jsxs("div",{className:"px-4 py-3.5 flex items-center justify-between shrink-0 border-b border-border",children:[n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"History"}),n.jsxs(F,{variant:"default",size:"sm",onClick:rt,className:"flex items-center gap-1 text-xs transition-colors",children:[n.jsx(Yt,{className:"h-3.5 w-3.5"}),"New Update"]})]}),n.jsxs(qt,{className:"flex-1",children:[l&&n.jsx("div",{className:"px-4 py-10 text-center text-xs text-muted-foreground",children:"Loading…"}),!l&&T.length===0&&n.jsxs("div",{className:"px-4 py-10 text-center text-xs text-muted-foreground leading-relaxed",children:["No status updates yet.",n.jsx("br",{}),"Post your first update."]}),n.jsx("div",{className:"py-1 divide-y divide-border",children:T.map((u,y)=>{const H=p===u.id||!p&&!be&&!ye&&y===0,Z=u.report_date??u.created_at,J=z(Z),Q=q[u.health];return n.jsxs("button",{onClick:()=>{h(u.id),f(!1)},className:Y("w-full text-left px-3 py-3 transition-colors focus:outline-none group relative",H?"bg-white dark:bg-card shadow-[inset_2px_0_0_0] shadow-foreground/20":"hover:bg-white dark:hover:bg-card"),children:[n.jsx("span",{className:Y("absolute left-0 top-0 h-full bottom-3 w-0.5 rounded-full transition-opacity",Q.accentBg,H?"opacity-100":"opacity-0 group-hover:opacity-40")}),n.jsxs("div",{className:"pl-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5 min-w-0",children:[n.jsx("p",{className:"text-xs font-medium text-foreground truncate flex-1 min-w-0",children:u.title}),n.jsx(V,{health:u.health})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("p",{className:"text-[11px] text-muted-foreground",children:R(J,"d MMM yyyy")}),n.jsx("button",{type:"button",title:"Copy link",onClick:se=>{se.stopPropagation();const ie=`${window.location.origin}/${t}/projects/${e}/health/${u.id}`;navigator.clipboard.writeText(ie).then(()=>{$.success("Link copied")})},className:"h-4 w-4 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:n.jsx(ha,{className:"h-2.5 w-2.5"})}),n.jsx("button",{type:"button",title:"Open in new tab",onClick:se=>{se.stopPropagation();const ie=`${window.location.origin}/${t}/projects/${e}/health/${u.id}`;window.open(ie,"_blank","noopener,noreferrer")},className:"h-4 w-4 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:n.jsx(Zt,{className:"h-2.5 w-2.5"})})]})]})]},u.id)})})]})]}),n.jsx("div",{className:"flex-1 overflow-auto",children:ye?n.jsx(sr,{updates:T,onSelect:u=>{h(u),f(!1)}}):be?n.jsxs("div",{className:"mx-auto px-8 py-10",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:v?"Edit status update":"New status update"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Share the current health of this project with your team."})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Title ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(Ae,{placeholder:"e.g. Q1 milestone reached on schedule",value:j,onChange:u=>P(u.target.value),className:"text-sm"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Status ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsxs(Jt,{value:x,onValueChange:u=>w(u),children:[n.jsx(Qt,{className:"w-48",children:n.jsx(ea,{children:n.jsx(V,{health:x})})}),n.jsx(ta,{children:Object.keys(q).map(u=>n.jsx(aa,{value:u,children:n.jsx(V,{health:u})},u))})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{className:"text-sm font-medium",children:"Report date"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"The date this report represents — can be set to a future period."}),n.jsx(Ae,{type:"date",value:A,onChange:u=>D(u.target.value),className:"w-48 text-sm"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{className:"text-sm font-medium",children:"Collaborators"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"People who will receive this report when you send it."}),n.jsx(ra,{value:L,onChange:O,users:M,emptyLabel:"Add collaborators"})]}),n.jsx(te,{}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{className:"text-sm font-medium",children:"Summary"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Describe the current state. Use @ to mention team members."}),n.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:n.jsx(na,{content:N,onChange:I,placeholder:"How's this project going? What blockers exist?",editorClassName:"min-h-[220px] px-4 py-3",users:K})})]}),n.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[n.jsx(F,{onClick:at,disabled:d.isPending||i.isPending,children:v?i.isPending?"Saving…":"Save changes":d.isPending?"Posting…":"Post update"}),n.jsx(F,{variant:"ghost",onClick:lt,children:"Cancel"})]})]})]}):_?n.jsxs("div",{className:"mx-auto px-8 py-10",children:[n.jsx("div",{className:Y("h-1 w-16 rounded-full mb-6",q[_.health].accentBg)}),n.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[n.jsx("h2",{className:"text-xl font-semibold tracking-tight leading-snug",children:_.title}),n.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[n.jsx(F,{size:"icon",variant:"ghost",className:"h-8 w-8",title:"Edit",onClick:()=>nt(_),children:n.jsx(sa,{className:"h-3.5 w-3.5"})}),n.jsx(F,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",title:"Delete",onClick:()=>st(_),disabled:c.isPending,children:n.jsx(ia,{className:"h-3.5 w-3.5"})}),n.jsx(F,{size:"icon",variant:"ghost",className:"h-8 w-8",title:"Send report to collaborators",onClick:()=>ot(_),disabled:m.isPending||!((je=_.collaborators)!=null&&je.length),children:n.jsx(la,{className:"h-3.5 w-3.5"})})]})]}),n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx(V,{health:_.health}),n.jsx("span",{className:"text-sm text-muted-foreground",children:_.report_date?R(z(_.report_date),"d MMM yyyy"):R(z(_.created_at),"d MMM yyyy 'at' HH:mm")}),_.report_date&&n.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["posted ",R(z(_.created_at),"d MMM")]})]}),((Pe=_.collaborators)==null?void 0:Pe.length)>0&&(()=>{const u=M.filter(y=>_.collaborators.includes(y.id));return n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Collaborators"}),n.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:u.map(y=>{var J,Q;const H=`${y.first_name} ${y.last_name}`.trim()||y.email,Z=((((J=y.first_name)==null?void 0:J[0])??"")+(((Q=y.last_name)==null?void 0:Q[0])??"")).toUpperCase()||y.email[0].toUpperCase();return n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-muted rounded-full px-2 py-0.5",title:y.email,children:[n.jsx("span",{className:"inline-flex h-4 w-4 rounded-full bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-300 items-center justify-center text-[9px] font-medium shrink-0",children:Z}),H]},y.id)})})]})})(),n.jsx(te,{className:"mb-6"}),_.summary?n.jsx(oa,{html:_.summary}):n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No summary was provided for this update."})]}):null}),n.jsx(Ce,{open:!!b,onClose:()=>C(null),onConfirm:it,title:"Delete status update",description:"This status update will be permanently deleted. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",loading:c.isPending}),n.jsx(Ce,{open:!!S,onClose:()=>E(null),onConfirm:ct,title:"Send health report",description:"This will email the health report to all collaborators on this update.",confirmLabel:"Send",loading:m.isPending})]})}export{pr as ProjectHealthPage};
@@ -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-CaZekJXM.js";import"./vendor-radix-BO9o-Y4t.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-AZ54pP77.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-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-DFNKfBK2.js";import"./vendor-radix-BO9o-Y4t.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-AZ54pP77.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 r}from"./vendor-query-CaIGp3JB.js";import{b8 as t,b9 as i}from"./index-DFNKfBK2.js";import"./vendor-react-Lycsri1F.js";import"./vendor-radix-BO9o-Y4t.js";import"./vendor-dnd-DuI-3XLF.js";import"./vendor-editor-AZ54pP77.js";function u(){const{workspace:o}=t();return r.jsx(i,{workspaceId:o==null?void 0:o.id})}export{u as WorkspaceReportingPage};