@optifye/dashboard-core 4.2.8 → 4.2.9
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/index.d.mts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +202 -151
- package/dist/index.mjs +203 -152
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -630,10 +630,6 @@ interface WorkspaceMonthlyMetric {
|
|
|
630
630
|
avg_pph: number;
|
|
631
631
|
pph_threshold: number;
|
|
632
632
|
workspace_rank: number;
|
|
633
|
-
/**
|
|
634
|
-
* Total idle time for the shift in seconds
|
|
635
|
-
*/
|
|
636
|
-
idle_time: number;
|
|
637
633
|
}
|
|
638
634
|
interface LineMonthlyMetric {
|
|
639
635
|
date: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -630,10 +630,6 @@ interface WorkspaceMonthlyMetric {
|
|
|
630
630
|
avg_pph: number;
|
|
631
631
|
pph_threshold: number;
|
|
632
632
|
workspace_rank: number;
|
|
633
|
-
/**
|
|
634
|
-
* Total idle time for the shift in seconds
|
|
635
|
-
*/
|
|
636
|
-
idle_time: number;
|
|
637
633
|
}
|
|
638
634
|
interface LineMonthlyMetric {
|
|
639
635
|
date: string;
|
package/dist/index.js
CHANGED
|
@@ -1020,7 +1020,7 @@ var dashboardService = {
|
|
|
1020
1020
|
const formattedStartDate = formatDate(startDate);
|
|
1021
1021
|
const formattedEndDate = formatDate(endDate);
|
|
1022
1022
|
try {
|
|
1023
|
-
const { data, error } = await supabase.from(metricsTable).select("date, shift_id, efficiency, total_output, avg_cycle_time,
|
|
1023
|
+
const { data, error } = await supabase.from(metricsTable).select("date, shift_id, efficiency, total_output, avg_cycle_time, ideal_output, avg_pph, pph_threshold, workspace_rank").eq("workspace_id", workspaceUuid).gte("date", formattedStartDate).lte("date", formattedEndDate).order("date", { ascending: true }).order("shift_id", { ascending: true });
|
|
1024
1024
|
if (error) throw error;
|
|
1025
1025
|
if (!data) return [];
|
|
1026
1026
|
const transformedData = data.map((item) => ({
|
|
@@ -1033,8 +1033,7 @@ var dashboardService = {
|
|
|
1033
1033
|
ideal_output: item.ideal_output || 0,
|
|
1034
1034
|
avg_pph: item.avg_pph || 0,
|
|
1035
1035
|
pph_threshold: item.pph_threshold || 0,
|
|
1036
|
-
workspace_rank: item.workspace_rank || 0
|
|
1037
|
-
idle_time: item.idle_time || 0
|
|
1036
|
+
workspace_rank: item.workspace_rank || 0
|
|
1038
1037
|
}));
|
|
1039
1038
|
return transformedData;
|
|
1040
1039
|
} catch (err) {
|
|
@@ -14731,16 +14730,16 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
14731
14730
|
if (!this.isVisible) {
|
|
14732
14731
|
return hiddenVisibility;
|
|
14733
14732
|
}
|
|
14734
|
-
const
|
|
14733
|
+
const styles2 = {
|
|
14735
14734
|
visibility: ""
|
|
14736
14735
|
};
|
|
14737
14736
|
const transformTemplate = this.getTransformTemplate();
|
|
14738
14737
|
if (this.needsReset) {
|
|
14739
14738
|
this.needsReset = false;
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
return
|
|
14739
|
+
styles2.opacity = "";
|
|
14740
|
+
styles2.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
14741
|
+
styles2.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
|
|
14742
|
+
return styles2;
|
|
14744
14743
|
}
|
|
14745
14744
|
const lead = this.getLead();
|
|
14746
14745
|
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
@@ -14757,35 +14756,35 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
14757
14756
|
}
|
|
14758
14757
|
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
14759
14758
|
this.applyTransformsToTarget();
|
|
14760
|
-
|
|
14759
|
+
styles2.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
14761
14760
|
if (transformTemplate) {
|
|
14762
|
-
|
|
14761
|
+
styles2.transform = transformTemplate(valuesToRender, styles2.transform);
|
|
14763
14762
|
}
|
|
14764
14763
|
const { x, y } = this.projectionDelta;
|
|
14765
|
-
|
|
14764
|
+
styles2.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
14766
14765
|
if (lead.animationValues) {
|
|
14767
|
-
|
|
14766
|
+
styles2.opacity = lead === this ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
14768
14767
|
} else {
|
|
14769
|
-
|
|
14768
|
+
styles2.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
|
|
14770
14769
|
}
|
|
14771
14770
|
for (const key in scaleCorrectors) {
|
|
14772
14771
|
if (valuesToRender[key] === void 0)
|
|
14773
14772
|
continue;
|
|
14774
14773
|
const { correct, applyTo } = scaleCorrectors[key];
|
|
14775
|
-
const corrected =
|
|
14774
|
+
const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
14776
14775
|
if (applyTo) {
|
|
14777
14776
|
const num = applyTo.length;
|
|
14778
14777
|
for (let i = 0; i < num; i++) {
|
|
14779
|
-
|
|
14778
|
+
styles2[applyTo[i]] = corrected;
|
|
14780
14779
|
}
|
|
14781
14780
|
} else {
|
|
14782
|
-
|
|
14781
|
+
styles2[key] = corrected;
|
|
14783
14782
|
}
|
|
14784
14783
|
}
|
|
14785
14784
|
if (this.options.layoutId) {
|
|
14786
|
-
|
|
14785
|
+
styles2.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none";
|
|
14787
14786
|
}
|
|
14788
|
-
return
|
|
14787
|
+
return styles2;
|
|
14789
14788
|
}
|
|
14790
14789
|
clearSnapshot() {
|
|
14791
14790
|
this.resumeFrom = this.snapshot = void 0;
|
|
@@ -16892,23 +16891,35 @@ var HourlyOutputChart = ({
|
|
|
16892
16891
|
const [animatedData, setAnimatedData] = React14__namespace.default.useState(Array(SHIFT_DURATION).fill(0));
|
|
16893
16892
|
const prevDataRef = React14__namespace.default.useRef(Array(SHIFT_DURATION).fill(0));
|
|
16894
16893
|
const animationFrameRef = React14__namespace.default.useRef(null);
|
|
16895
|
-
const [
|
|
16894
|
+
const [idleBarState, setIdleBarState] = React14__namespace.default.useState({
|
|
16895
|
+
visible: showIdleTime,
|
|
16896
|
+
key: 0,
|
|
16897
|
+
shouldAnimate: false
|
|
16898
|
+
});
|
|
16896
16899
|
const prevShowIdleTimeRef = React14__namespace.default.useRef(showIdleTime);
|
|
16897
|
-
const
|
|
16900
|
+
const stateUpdateTimeoutRef = React14__namespace.default.useRef(null);
|
|
16898
16901
|
React14__namespace.default.useEffect(() => {
|
|
16902
|
+
if (stateUpdateTimeoutRef.current) {
|
|
16903
|
+
clearTimeout(stateUpdateTimeoutRef.current);
|
|
16904
|
+
}
|
|
16899
16905
|
if (showIdleTime && !prevShowIdleTimeRef.current) {
|
|
16900
|
-
|
|
16901
|
-
|
|
16902
|
-
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
|
|
16906
|
-
|
|
16906
|
+
requestAnimationFrame(() => {
|
|
16907
|
+
setIdleBarState({
|
|
16908
|
+
visible: true,
|
|
16909
|
+
key: Date.now(),
|
|
16910
|
+
shouldAnimate: true
|
|
16911
|
+
});
|
|
16912
|
+
stateUpdateTimeoutRef.current = setTimeout(() => {
|
|
16913
|
+
setIdleBarState((prev) => ({ ...prev, shouldAnimate: false }));
|
|
16914
|
+
}, 1100);
|
|
16915
|
+
});
|
|
16916
|
+
} else if (!showIdleTime && prevShowIdleTimeRef.current) {
|
|
16917
|
+
setIdleBarState((prev) => ({ ...prev, visible: false }));
|
|
16907
16918
|
}
|
|
16908
16919
|
prevShowIdleTimeRef.current = showIdleTime;
|
|
16909
16920
|
return () => {
|
|
16910
|
-
if (
|
|
16911
|
-
clearTimeout(
|
|
16921
|
+
if (stateUpdateTimeoutRef.current) {
|
|
16922
|
+
clearTimeout(stateUpdateTimeoutRef.current);
|
|
16912
16923
|
}
|
|
16913
16924
|
};
|
|
16914
16925
|
}, [showIdleTime]);
|
|
@@ -17001,6 +17012,55 @@ var HourlyOutputChart = ({
|
|
|
17001
17012
|
};
|
|
17002
17013
|
});
|
|
17003
17014
|
}, [animatedData, data, pphThreshold, idleTimeHourly, shiftStartTime.hour, formatHour, formatTimeRange]);
|
|
17015
|
+
const IdleBar = React14__namespace.default.useMemo(() => {
|
|
17016
|
+
if (!idleBarState.visible) return null;
|
|
17017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17018
|
+
recharts.Bar,
|
|
17019
|
+
{
|
|
17020
|
+
dataKey: "idleMinutes",
|
|
17021
|
+
yAxisId: "idle",
|
|
17022
|
+
maxBarSize: 35,
|
|
17023
|
+
radius: [10, 10, 0, 0],
|
|
17024
|
+
fill: "url(#idlePattern)",
|
|
17025
|
+
opacity: 0.7,
|
|
17026
|
+
isAnimationActive: idleBarState.shouldAnimate,
|
|
17027
|
+
animationBegin: 0,
|
|
17028
|
+
animationDuration: 1e3,
|
|
17029
|
+
animationEasing: "ease-out",
|
|
17030
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17031
|
+
recharts.LabelList,
|
|
17032
|
+
{
|
|
17033
|
+
dataKey: "idleMinutes",
|
|
17034
|
+
position: "top",
|
|
17035
|
+
content: (props) => {
|
|
17036
|
+
const { x, y, width, value } = props;
|
|
17037
|
+
if (!value || value === 0) return null;
|
|
17038
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17039
|
+
"text",
|
|
17040
|
+
{
|
|
17041
|
+
x: x + width / 2,
|
|
17042
|
+
y: y - 2,
|
|
17043
|
+
textAnchor: "middle",
|
|
17044
|
+
fontSize: "9",
|
|
17045
|
+
fontWeight: "600",
|
|
17046
|
+
fill: "#6b7280",
|
|
17047
|
+
style: {
|
|
17048
|
+
opacity: 1,
|
|
17049
|
+
pointerEvents: "none"
|
|
17050
|
+
},
|
|
17051
|
+
children: [
|
|
17052
|
+
value,
|
|
17053
|
+
"m"
|
|
17054
|
+
]
|
|
17055
|
+
}
|
|
17056
|
+
);
|
|
17057
|
+
}
|
|
17058
|
+
}
|
|
17059
|
+
)
|
|
17060
|
+
},
|
|
17061
|
+
`idle-bar-${idleBarState.key}`
|
|
17062
|
+
);
|
|
17063
|
+
}, [idleBarState.visible, idleBarState.key, idleBarState.shouldAnimate]);
|
|
17004
17064
|
const maxYValue = Math.ceil(pphThreshold * 1.5);
|
|
17005
17065
|
const generateYAxisTicks = () => {
|
|
17006
17066
|
const targetValue = Math.round(pphThreshold);
|
|
@@ -17258,51 +17318,7 @@ var HourlyOutputChart = ({
|
|
|
17258
17318
|
]
|
|
17259
17319
|
}
|
|
17260
17320
|
),
|
|
17261
|
-
|
|
17262
|
-
recharts.Bar,
|
|
17263
|
-
{
|
|
17264
|
-
dataKey: "idleMinutes",
|
|
17265
|
-
yAxisId: "idle",
|
|
17266
|
-
maxBarSize: 35,
|
|
17267
|
-
radius: [10, 10, 0, 0],
|
|
17268
|
-
fill: "url(#idlePattern)",
|
|
17269
|
-
opacity: 0.7,
|
|
17270
|
-
isAnimationActive: shouldAnimateIdle,
|
|
17271
|
-
animationBegin: shouldAnimateIdle ? 200 : 0,
|
|
17272
|
-
animationDuration: shouldAnimateIdle ? 800 : 0,
|
|
17273
|
-
animationEasing: "ease-out",
|
|
17274
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17275
|
-
recharts.LabelList,
|
|
17276
|
-
{
|
|
17277
|
-
dataKey: "idleMinutes",
|
|
17278
|
-
position: "top",
|
|
17279
|
-
content: (props) => {
|
|
17280
|
-
const { x, y, width, value } = props;
|
|
17281
|
-
if (!value || value === 0) return null;
|
|
17282
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17283
|
-
"text",
|
|
17284
|
-
{
|
|
17285
|
-
x: x + width / 2,
|
|
17286
|
-
y: y - 2,
|
|
17287
|
-
textAnchor: "middle",
|
|
17288
|
-
fontSize: "9",
|
|
17289
|
-
fontWeight: "600",
|
|
17290
|
-
fill: "#6b7280",
|
|
17291
|
-
style: {
|
|
17292
|
-
opacity: 1,
|
|
17293
|
-
pointerEvents: "none"
|
|
17294
|
-
},
|
|
17295
|
-
children: [
|
|
17296
|
-
value,
|
|
17297
|
-
"m"
|
|
17298
|
-
]
|
|
17299
|
-
}
|
|
17300
|
-
);
|
|
17301
|
-
}
|
|
17302
|
-
}
|
|
17303
|
-
)
|
|
17304
|
-
}
|
|
17305
|
-
),
|
|
17321
|
+
IdleBar,
|
|
17306
17322
|
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("pattern", { id: "idlePattern", patternUnits: "userSpaceOnUse", width: "4", height: "4", children: [
|
|
17307
17323
|
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "4", height: "4", fill: "#9ca3af", opacity: "0.2" }),
|
|
17308
17324
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M 0,4 l 4,-4 M -1,1 l 2,-2 M 3,5 l 2,-2", stroke: "#6b7280", strokeWidth: "0.5", opacity: "0.3" })
|
|
@@ -19775,6 +19791,32 @@ var WorkspaceCard = ({
|
|
|
19775
19791
|
}
|
|
19776
19792
|
);
|
|
19777
19793
|
};
|
|
19794
|
+
var styles = `
|
|
19795
|
+
@keyframes fadeIn {
|
|
19796
|
+
from {
|
|
19797
|
+
opacity: 0;
|
|
19798
|
+
transform: translateY(-10px);
|
|
19799
|
+
}
|
|
19800
|
+
to {
|
|
19801
|
+
opacity: 1;
|
|
19802
|
+
transform: translateY(0);
|
|
19803
|
+
}
|
|
19804
|
+
}
|
|
19805
|
+
|
|
19806
|
+
.calendar-container {
|
|
19807
|
+
will-change: transform, opacity;
|
|
19808
|
+
animation: fadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
|
|
19809
|
+
}
|
|
19810
|
+
|
|
19811
|
+
.calendar-wrapper:not(.animation-complete) * {
|
|
19812
|
+
transition: none !important;
|
|
19813
|
+
}
|
|
19814
|
+
|
|
19815
|
+
.calendar-wrapper:not(.animation-complete) .group:hover {
|
|
19816
|
+
opacity: 1 !important;
|
|
19817
|
+
transform: scale(1) !important;
|
|
19818
|
+
}
|
|
19819
|
+
`;
|
|
19778
19820
|
var WEEKDAYS2 = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
19779
19821
|
var getTimeInZoneAsDate = (timezone) => {
|
|
19780
19822
|
const time2 = getCurrentTimeInZone(timezone);
|
|
@@ -19793,20 +19835,20 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19793
19835
|
}) => {
|
|
19794
19836
|
const { dateTimeConfig } = useDashboardConfig();
|
|
19795
19837
|
const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
19838
|
+
const [animationComplete, setAnimationComplete] = React14.useState(false);
|
|
19839
|
+
React14.useEffect(() => {
|
|
19840
|
+
setAnimationComplete(false);
|
|
19841
|
+
const timer = setTimeout(() => {
|
|
19842
|
+
setAnimationComplete(true);
|
|
19843
|
+
}, 600);
|
|
19844
|
+
return () => clearTimeout(timer);
|
|
19845
|
+
}, [month, year]);
|
|
19796
19846
|
const calendarData = React14.useMemo(() => {
|
|
19797
19847
|
const startOfMonth = dateFnsTz.toZonedTime(new Date(year, month, 1), configuredTimezone);
|
|
19798
19848
|
const endOfMonth = dateFnsTz.toZonedTime(new Date(year, month + 1, 0), configuredTimezone);
|
|
19799
19849
|
const totalDays = endOfMonth.getDate();
|
|
19800
19850
|
let startOffset = startOfMonth.getDay() - 1;
|
|
19801
19851
|
if (startOffset === -1) startOffset = 6;
|
|
19802
|
-
console.log("Calendar generation for:", {
|
|
19803
|
-
month: month + 1,
|
|
19804
|
-
year,
|
|
19805
|
-
startOffset,
|
|
19806
|
-
totalDays,
|
|
19807
|
-
configuredTimezone
|
|
19808
|
-
});
|
|
19809
|
-
console.log("Data points received:", data);
|
|
19810
19852
|
const calendar = Array(startOffset).fill(null);
|
|
19811
19853
|
for (let day = 1; day <= totalDays; day++) {
|
|
19812
19854
|
const currentDate = new Date(year, month, day);
|
|
@@ -19820,15 +19862,6 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19820
19862
|
const dataDate = new Date(d.date);
|
|
19821
19863
|
const dataDateStr = dataDate.toISOString().split("T")[0];
|
|
19822
19864
|
const matches = dataDateStr === dateToMatch;
|
|
19823
|
-
if (day <= 3 && matches) {
|
|
19824
|
-
console.log(`Found data match for day ${day}:`, {
|
|
19825
|
-
dataDate: dataDate.toISOString(),
|
|
19826
|
-
currentDate: currentTimezoneDate.toISOString(),
|
|
19827
|
-
dataDateStr,
|
|
19828
|
-
dateToMatch,
|
|
19829
|
-
data: d
|
|
19830
|
-
});
|
|
19831
|
-
}
|
|
19832
19865
|
return matches;
|
|
19833
19866
|
});
|
|
19834
19867
|
if (matchingData.length > 0) {
|
|
@@ -19839,32 +19872,10 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19839
19872
|
// Use the timezone-adjusted date for display
|
|
19840
19873
|
});
|
|
19841
19874
|
} else {
|
|
19842
|
-
calendar.push(
|
|
19843
|
-
date: currentTimezoneDate,
|
|
19844
|
-
dayShift: {
|
|
19845
|
-
efficiency: 0,
|
|
19846
|
-
output: 0,
|
|
19847
|
-
cycleTime: 0,
|
|
19848
|
-
pph: 0,
|
|
19849
|
-
pphThreshold: 0,
|
|
19850
|
-
idealOutput: 0,
|
|
19851
|
-
rank: 0,
|
|
19852
|
-
idleTime: 0
|
|
19853
|
-
},
|
|
19854
|
-
nightShift: {
|
|
19855
|
-
efficiency: 0,
|
|
19856
|
-
output: 0,
|
|
19857
|
-
cycleTime: 0,
|
|
19858
|
-
pph: 0,
|
|
19859
|
-
pphThreshold: 0,
|
|
19860
|
-
idealOutput: 0,
|
|
19861
|
-
rank: 0,
|
|
19862
|
-
idleTime: 0
|
|
19863
|
-
}
|
|
19864
|
-
});
|
|
19875
|
+
calendar.push(null);
|
|
19865
19876
|
}
|
|
19866
19877
|
}
|
|
19867
|
-
return calendar;
|
|
19878
|
+
return { calendar, startOffset };
|
|
19868
19879
|
}, [data, month, year, configuredTimezone]);
|
|
19869
19880
|
const monthlyMetrics = React14.useMemo(() => {
|
|
19870
19881
|
const validDays = data.filter((day) => {
|
|
@@ -19881,15 +19892,17 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19881
19892
|
return [];
|
|
19882
19893
|
}
|
|
19883
19894
|
return [day.dayShift, day.nightShift];
|
|
19884
|
-
})
|
|
19895
|
+
});
|
|
19885
19896
|
if (validShifts.length === 0) return null;
|
|
19886
19897
|
const badShiftsCount = validShifts.filter((shift) => shift.efficiency < 75).length;
|
|
19898
|
+
const totalIdleTime = validShifts.reduce((sum, shift) => sum + shift.idleTime, 0);
|
|
19899
|
+
const avgIdleTime = Math.round(totalIdleTime / validShifts.length);
|
|
19887
19900
|
return {
|
|
19888
19901
|
avgEfficiency: Math.round(validShifts.reduce((sum, shift) => sum + shift.efficiency, 0) / validShifts.length),
|
|
19889
19902
|
avgCycleTime: Math.round(validShifts.reduce((sum, shift) => sum + shift.cycleTime, 0) / validShifts.length),
|
|
19903
|
+
avgIdleTime,
|
|
19890
19904
|
badDaysCount: badShiftsCount,
|
|
19891
|
-
totalDays: validShifts.length
|
|
19892
|
-
avgIdleTime: Math.round(validShifts.reduce((sum, shift) => sum + (shift.idleTime || 0), 0) / validShifts.length)
|
|
19905
|
+
totalDays: validShifts.length
|
|
19893
19906
|
};
|
|
19894
19907
|
}, [data, month, year, configuredTimezone]);
|
|
19895
19908
|
const handleDayClick = React14.useCallback((day, shift) => {
|
|
@@ -19937,7 +19950,6 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19937
19950
|
compareDate.setHours(0, 0, 0, 0);
|
|
19938
19951
|
if (compareDate.getDay() === 0) return "bg-gray-300";
|
|
19939
19952
|
if (compareDate > istNow) return "bg-gray-200";
|
|
19940
|
-
if (efficiency < 10) return "bg-gray-300";
|
|
19941
19953
|
if (efficiency >= 80) return "bg-[#00AB45]/90";
|
|
19942
19954
|
if (efficiency >= 70) return "bg-[#FFB020]/90";
|
|
19943
19955
|
return "bg-[#E34329]/90";
|
|
@@ -19976,38 +19988,55 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19976
19988
|
] })
|
|
19977
19989
|
] }) });
|
|
19978
19990
|
};
|
|
19979
|
-
const renderDayCell = React14.useCallback((day) => {
|
|
19980
|
-
if (
|
|
19991
|
+
const renderDayCell = React14.useCallback((day, dayNumber, index) => {
|
|
19992
|
+
if (dayNumber === null) {
|
|
19993
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full" });
|
|
19994
|
+
}
|
|
19995
|
+
const cellDate = dateFnsTz.toZonedTime(new Date(year, month, dayNumber), configuredTimezone);
|
|
19996
|
+
const isToday = isCurrentDate(cellDate);
|
|
19997
|
+
const isFuture = isFutureDate(cellDate);
|
|
19998
|
+
const isSunday = cellDate.getDay() === 0;
|
|
19999
|
+
if (!day) {
|
|
20000
|
+
let bgColor = "bg-gray-100";
|
|
20001
|
+
let textColor = "text-gray-400";
|
|
20002
|
+
if (isSunday) {
|
|
20003
|
+
bgColor = "bg-gray-200";
|
|
20004
|
+
textColor = "text-gray-500";
|
|
20005
|
+
}
|
|
20006
|
+
if (isFuture) {
|
|
20007
|
+
bgColor = "bg-gray-50";
|
|
20008
|
+
textColor = "text-gray-300";
|
|
20009
|
+
}
|
|
20010
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `h-full border border-gray-200 rounded-lg ${bgColor} ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} cursor-not-allowed opacity-60`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `text-base font-medium ${textColor} ${isToday ? "text-blue-500" : ""}`, children: dayNumber }) }) });
|
|
20011
|
+
}
|
|
19981
20012
|
const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
|
|
19982
|
-
const isToday = isCurrentDate(day.date);
|
|
19983
|
-
const isFuture = isFutureDate(day.date);
|
|
19984
|
-
const isInactive = shiftData.efficiency < 10;
|
|
19985
20013
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19986
20014
|
"div",
|
|
19987
20015
|
{
|
|
19988
|
-
className: `group h-full transition-all duration-
|
|
19989
|
-
onClick: () => !isFuture &&
|
|
20016
|
+
className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
|
|
20017
|
+
onClick: () => !isFuture && handleDayClick(day, selectedShift),
|
|
19990
20018
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `
|
|
19991
20019
|
${getPerformanceColor(shiftData.efficiency, day.date)}
|
|
19992
|
-
rounded-lg h-full p-2 relative transition-all duration-
|
|
20020
|
+
rounded-lg h-full p-2 relative ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} shadow-sm
|
|
19993
20021
|
${isToday ? "ring-2 ring-blue-500 ring-offset-2 shadow-md" : ""}
|
|
19994
20022
|
`, children: [
|
|
19995
20023
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `
|
|
19996
|
-
text-base font-medium text-white flex items-center transition-all duration-
|
|
20024
|
+
text-base font-medium text-white flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
|
|
19997
20025
|
${isToday ? "bg-blue-500 rounded-full w-7 h-7 justify-center" : ""}
|
|
19998
20026
|
`, children: day.date.getDate() }),
|
|
19999
|
-
!isFuture &&
|
|
20027
|
+
!isFuture && animationComplete && renderStats(shiftData, day.date)
|
|
20000
20028
|
] })
|
|
20001
20029
|
}
|
|
20002
20030
|
);
|
|
20003
|
-
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick]);
|
|
20004
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `space-y-6 ${className || ""}`, children: [
|
|
20031
|
+
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete]);
|
|
20032
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `calendar-wrapper space-y-6 ${className || ""} ${animationComplete ? "animation-complete" : ""}`, children: [
|
|
20033
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
|
|
20005
20034
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 border border-gray-200 rounded-lg p-1 bg-gray-50", children: [
|
|
20006
20035
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20007
20036
|
"button",
|
|
20008
20037
|
{
|
|
20009
20038
|
onClick: () => handleShiftChange("day"),
|
|
20010
|
-
className: `px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${selectedShift === "day" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" :
|
|
20039
|
+
className: `px-4 py-2 text-sm font-medium rounded-md ${animationComplete ? "transition-all duration-200" : ""} ${selectedShift === "day" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" : `text-gray-600 ${animationComplete ? "hover:text-gray-900 hover:bg-gray-100" : ""}`}`,
|
|
20011
20040
|
children: "Day Shift"
|
|
20012
20041
|
}
|
|
20013
20042
|
),
|
|
@@ -20015,23 +20044,27 @@ var WorkspaceHistoryCalendar = ({
|
|
|
20015
20044
|
"button",
|
|
20016
20045
|
{
|
|
20017
20046
|
onClick: () => handleShiftChange("night"),
|
|
20018
|
-
className: `px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${selectedShift === "night" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" :
|
|
20047
|
+
className: `px-4 py-2 text-sm font-medium rounded-md ${animationComplete ? "transition-all duration-200" : ""} ${selectedShift === "night" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" : `text-gray-600 ${animationComplete ? "hover:text-gray-900 hover:bg-gray-100" : ""}`}`,
|
|
20019
20048
|
children: "Night Shift"
|
|
20020
20049
|
}
|
|
20021
20050
|
)
|
|
20022
20051
|
] }) }),
|
|
20023
20052
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
|
|
20024
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20053
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20025
20054
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
|
|
20026
20055
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: selectedShift === "day" ? "Day Shifts" : "Night Shifts" }),
|
|
20027
20056
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Calendar view of daily performance" })
|
|
20028
20057
|
] }),
|
|
20029
20058
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6", children: [
|
|
20030
20059
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-2", children: WEEKDAYS2.map((day) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-600 text-center", children: day }, day)) }),
|
|
20031
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-2", children: calendarData.map((day, index) =>
|
|
20060
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-2", children: calendarData.calendar.map((day, index) => {
|
|
20061
|
+
const startOffset = calendarData.startOffset;
|
|
20062
|
+
const dayNumber = index >= startOffset ? index - startOffset + 1 : null;
|
|
20063
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-square relative transition-all duration-200 ease-in-out", children: renderDayCell(day, dayNumber && dayNumber <= new Date(year, month + 1, 0).getDate() ? dayNumber : null, index) }, index);
|
|
20064
|
+
}) })
|
|
20032
20065
|
] })
|
|
20033
20066
|
] }),
|
|
20034
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20067
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20035
20068
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
|
|
20036
20069
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: "Monthly Summary" }),
|
|
20037
20070
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Overview of monthly performance metrics" })
|
|
@@ -22602,7 +22635,7 @@ var WorkspaceGridItem = React14__namespace.default.memo(({
|
|
|
22602
22635
|
}, [data.efficiency, isInactive, position.size, position.orientation]);
|
|
22603
22636
|
const { arrow, color: arrowColor } = React14.useMemo(() => getTrendArrowAndColor2(data.trend_score), [data.trend_score]);
|
|
22604
22637
|
const workspaceNumber = React14.useMemo(() => getWorkspaceNumber(data.workspace_name), [data.workspace_name]);
|
|
22605
|
-
const
|
|
22638
|
+
const styles2 = React14.useMemo(() => getWorkspaceStyles(position, isInactive), [position, isInactive]);
|
|
22606
22639
|
const arrowPosition = React14.useMemo(() => getArrowPositionClass(position), [position]);
|
|
22607
22640
|
const handleClick = React14.useCallback((e) => {
|
|
22608
22641
|
e.preventDefault();
|
|
@@ -22653,7 +22686,7 @@ var WorkspaceGridItem = React14__namespace.default.memo(({
|
|
|
22653
22686
|
"button",
|
|
22654
22687
|
{
|
|
22655
22688
|
onClick: handleClick,
|
|
22656
|
-
className: `${
|
|
22689
|
+
className: `${styles2} ${colorClass} ${isBottleneck ? "ring-2 ring-red-500/70" : ""} ${isVeryLowEfficiency ? "ring-2 ring-red-500/50" : ""} ${isInactive ? "bg-gray-200" : ""} shadow-lg`,
|
|
22657
22690
|
"aria-label": isInactive ? `Inactive workspace ${workspaceNumber}` : `View details for workspace ${workspaceNumber}`,
|
|
22658
22691
|
title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name)}` : getWorkspaceDisplayName(data.workspace_name),
|
|
22659
22692
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `font-semibold tracking-wide text-[min(4vw,2rem)] uppercase ${isInactive ? "text-gray-400" : "text-white"} drop-shadow-sm`, children: workspaceNumber })
|
|
@@ -30164,6 +30197,11 @@ var WorkspaceDetailView = ({
|
|
|
30164
30197
|
return getOperationalDate();
|
|
30165
30198
|
}, [isHistoricView, date]);
|
|
30166
30199
|
const handleMonthlyDataLoaded = React14.useCallback((data) => {
|
|
30200
|
+
console.log("[handleMonthlyDataLoaded] Received data:", {
|
|
30201
|
+
dataLength: data?.length,
|
|
30202
|
+
isArray: Array.isArray(data),
|
|
30203
|
+
sample: data?.[0]
|
|
30204
|
+
});
|
|
30167
30205
|
if (!data || !Array.isArray(data)) {
|
|
30168
30206
|
console.error("Invalid monthly metrics data received:", data);
|
|
30169
30207
|
setMonthlyData([]);
|
|
@@ -30181,22 +30219,35 @@ var WorkspaceDetailView = ({
|
|
|
30181
30219
|
if (!dayEntry) {
|
|
30182
30220
|
dayEntry = {
|
|
30183
30221
|
date: dateObj,
|
|
30184
|
-
dayShift:
|
|
30185
|
-
|
|
30222
|
+
dayShift: null,
|
|
30223
|
+
// Start with null instead of zeros
|
|
30224
|
+
nightShift: null
|
|
30225
|
+
// Start with null instead of zeros
|
|
30186
30226
|
};
|
|
30187
30227
|
dayDataMap.set(dateKey, dayEntry);
|
|
30188
30228
|
}
|
|
30189
|
-
const
|
|
30190
|
-
|
|
30191
|
-
|
|
30192
|
-
|
|
30193
|
-
|
|
30194
|
-
|
|
30195
|
-
|
|
30196
|
-
|
|
30197
|
-
|
|
30229
|
+
const shiftData = {
|
|
30230
|
+
efficiency: metric.avg_efficiency || 0,
|
|
30231
|
+
output: metric.total_output || 0,
|
|
30232
|
+
cycleTime: metric.avg_cycle_time || 0,
|
|
30233
|
+
pph: metric.avg_pph || 0,
|
|
30234
|
+
pphThreshold: metric.pph_threshold || 0,
|
|
30235
|
+
idealOutput: metric.ideal_output || 0,
|
|
30236
|
+
rank: metric.workspace_rank || 0,
|
|
30237
|
+
idleTime: metric.idle_time || 0
|
|
30238
|
+
};
|
|
30239
|
+
if (metric.shift_id === 0) {
|
|
30240
|
+
dayEntry.dayShift = shiftData;
|
|
30241
|
+
} else {
|
|
30242
|
+
dayEntry.nightShift = shiftData;
|
|
30243
|
+
}
|
|
30198
30244
|
});
|
|
30199
|
-
const processedData = Array.from(dayDataMap.values())
|
|
30245
|
+
const processedData = Array.from(dayDataMap.values()).filter((entry) => entry.dayShift !== null || entry.nightShift !== null).map((entry) => ({
|
|
30246
|
+
date: entry.date,
|
|
30247
|
+
// If a shift is null (no data), provide zeros for compatibility
|
|
30248
|
+
dayShift: entry.dayShift || { efficiency: 0, output: 0, cycleTime: 0, pph: 0, pphThreshold: 0, idealOutput: 0, rank: 0, idleTime: 0 },
|
|
30249
|
+
nightShift: entry.nightShift || { efficiency: 0, output: 0, cycleTime: 0, pph: 0, pphThreshold: 0, idealOutput: 0, rank: 0, idleTime: 0 }
|
|
30250
|
+
}));
|
|
30200
30251
|
console.log(`[handleMonthlyDataLoaded] Transformed data for calendar:`, {
|
|
30201
30252
|
count: processedData.length,
|
|
30202
30253
|
sample: processedData.slice(0, 1)
|
|
@@ -30656,7 +30707,7 @@ var WorkspaceDetailView = ({
|
|
|
30656
30707
|
}
|
|
30657
30708
|
)
|
|
30658
30709
|
] }),
|
|
30659
|
-
|
|
30710
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30660
30711
|
WorkspaceHistoryCalendar,
|
|
30661
30712
|
{
|
|
30662
30713
|
data: monthlyData,
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import Hls2 from 'hls.js';
|
|
|
10
10
|
import useSWR from 'swr';
|
|
11
11
|
import { noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds, memo as memo$1 } from 'motion-utils';
|
|
12
12
|
import { getValueTransition, hover, press, isPrimaryPointer, GroupPlaybackControls, setDragLock, supportsLinearEasing, attachTimeline, isGenerator, calcGeneratorDuration, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, generateLinearEasing, isBezierDefinition } from 'motion-dom';
|
|
13
|
-
import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine,
|
|
13
|
+
import { Bar, LabelList, ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine, Cell, PieChart, Pie, Legend, LineChart as LineChart$1, Line } from 'recharts';
|
|
14
14
|
import { Slot } from '@radix-ui/react-slot';
|
|
15
15
|
import { Camera, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, X, Coffee, Plus, Clock, Minus, ArrowDown, ArrowUp, Search, CheckCircle, AlertTriangle, Info, Share2, Download, User, XCircle, ChevronLeft, ChevronRight, AlertCircle, Sun, Moon, MessageSquare, Trash2, ArrowLeft, RefreshCw, Menu, Send, Copy, Edit2, UserCheck, Save, LogOut, Calendar, Settings, LifeBuoy, Loader2, ArrowLeftIcon as ArrowLeftIcon$1, Settings2, CheckCircle2, EyeOff, Eye, Zap, UserCircle } from 'lucide-react';
|
|
16
16
|
import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
|
|
@@ -991,7 +991,7 @@ var dashboardService = {
|
|
|
991
991
|
const formattedStartDate = formatDate(startDate);
|
|
992
992
|
const formattedEndDate = formatDate(endDate);
|
|
993
993
|
try {
|
|
994
|
-
const { data, error } = await supabase.from(metricsTable).select("date, shift_id, efficiency, total_output, avg_cycle_time,
|
|
994
|
+
const { data, error } = await supabase.from(metricsTable).select("date, shift_id, efficiency, total_output, avg_cycle_time, ideal_output, avg_pph, pph_threshold, workspace_rank").eq("workspace_id", workspaceUuid).gte("date", formattedStartDate).lte("date", formattedEndDate).order("date", { ascending: true }).order("shift_id", { ascending: true });
|
|
995
995
|
if (error) throw error;
|
|
996
996
|
if (!data) return [];
|
|
997
997
|
const transformedData = data.map((item) => ({
|
|
@@ -1004,8 +1004,7 @@ var dashboardService = {
|
|
|
1004
1004
|
ideal_output: item.ideal_output || 0,
|
|
1005
1005
|
avg_pph: item.avg_pph || 0,
|
|
1006
1006
|
pph_threshold: item.pph_threshold || 0,
|
|
1007
|
-
workspace_rank: item.workspace_rank || 0
|
|
1008
|
-
idle_time: item.idle_time || 0
|
|
1007
|
+
workspace_rank: item.workspace_rank || 0
|
|
1009
1008
|
}));
|
|
1010
1009
|
return transformedData;
|
|
1011
1010
|
} catch (err) {
|
|
@@ -14702,16 +14701,16 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
14702
14701
|
if (!this.isVisible) {
|
|
14703
14702
|
return hiddenVisibility;
|
|
14704
14703
|
}
|
|
14705
|
-
const
|
|
14704
|
+
const styles2 = {
|
|
14706
14705
|
visibility: ""
|
|
14707
14706
|
};
|
|
14708
14707
|
const transformTemplate = this.getTransformTemplate();
|
|
14709
14708
|
if (this.needsReset) {
|
|
14710
14709
|
this.needsReset = false;
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
return
|
|
14710
|
+
styles2.opacity = "";
|
|
14711
|
+
styles2.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
|
|
14712
|
+
styles2.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
|
|
14713
|
+
return styles2;
|
|
14715
14714
|
}
|
|
14716
14715
|
const lead = this.getLead();
|
|
14717
14716
|
if (!this.projectionDelta || !this.layout || !lead.target) {
|
|
@@ -14728,35 +14727,35 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
14728
14727
|
}
|
|
14729
14728
|
const valuesToRender = lead.animationValues || lead.latestValues;
|
|
14730
14729
|
this.applyTransformsToTarget();
|
|
14731
|
-
|
|
14730
|
+
styles2.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
|
|
14732
14731
|
if (transformTemplate) {
|
|
14733
|
-
|
|
14732
|
+
styles2.transform = transformTemplate(valuesToRender, styles2.transform);
|
|
14734
14733
|
}
|
|
14735
14734
|
const { x, y } = this.projectionDelta;
|
|
14736
|
-
|
|
14735
|
+
styles2.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
|
|
14737
14736
|
if (lead.animationValues) {
|
|
14738
|
-
|
|
14737
|
+
styles2.opacity = lead === this ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
14739
14738
|
} else {
|
|
14740
|
-
|
|
14739
|
+
styles2.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
|
|
14741
14740
|
}
|
|
14742
14741
|
for (const key in scaleCorrectors) {
|
|
14743
14742
|
if (valuesToRender[key] === void 0)
|
|
14744
14743
|
continue;
|
|
14745
14744
|
const { correct, applyTo } = scaleCorrectors[key];
|
|
14746
|
-
const corrected =
|
|
14745
|
+
const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
14747
14746
|
if (applyTo) {
|
|
14748
14747
|
const num = applyTo.length;
|
|
14749
14748
|
for (let i = 0; i < num; i++) {
|
|
14750
|
-
|
|
14749
|
+
styles2[applyTo[i]] = corrected;
|
|
14751
14750
|
}
|
|
14752
14751
|
} else {
|
|
14753
|
-
|
|
14752
|
+
styles2[key] = corrected;
|
|
14754
14753
|
}
|
|
14755
14754
|
}
|
|
14756
14755
|
if (this.options.layoutId) {
|
|
14757
|
-
|
|
14756
|
+
styles2.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none";
|
|
14758
14757
|
}
|
|
14759
|
-
return
|
|
14758
|
+
return styles2;
|
|
14760
14759
|
}
|
|
14761
14760
|
clearSnapshot() {
|
|
14762
14761
|
this.resumeFrom = this.snapshot = void 0;
|
|
@@ -16863,23 +16862,35 @@ var HourlyOutputChart = ({
|
|
|
16863
16862
|
const [animatedData, setAnimatedData] = React14__default.useState(Array(SHIFT_DURATION).fill(0));
|
|
16864
16863
|
const prevDataRef = React14__default.useRef(Array(SHIFT_DURATION).fill(0));
|
|
16865
16864
|
const animationFrameRef = React14__default.useRef(null);
|
|
16866
|
-
const [
|
|
16865
|
+
const [idleBarState, setIdleBarState] = React14__default.useState({
|
|
16866
|
+
visible: showIdleTime,
|
|
16867
|
+
key: 0,
|
|
16868
|
+
shouldAnimate: false
|
|
16869
|
+
});
|
|
16867
16870
|
const prevShowIdleTimeRef = React14__default.useRef(showIdleTime);
|
|
16868
|
-
const
|
|
16871
|
+
const stateUpdateTimeoutRef = React14__default.useRef(null);
|
|
16869
16872
|
React14__default.useEffect(() => {
|
|
16873
|
+
if (stateUpdateTimeoutRef.current) {
|
|
16874
|
+
clearTimeout(stateUpdateTimeoutRef.current);
|
|
16875
|
+
}
|
|
16870
16876
|
if (showIdleTime && !prevShowIdleTimeRef.current) {
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16877
|
+
requestAnimationFrame(() => {
|
|
16878
|
+
setIdleBarState({
|
|
16879
|
+
visible: true,
|
|
16880
|
+
key: Date.now(),
|
|
16881
|
+
shouldAnimate: true
|
|
16882
|
+
});
|
|
16883
|
+
stateUpdateTimeoutRef.current = setTimeout(() => {
|
|
16884
|
+
setIdleBarState((prev) => ({ ...prev, shouldAnimate: false }));
|
|
16885
|
+
}, 1100);
|
|
16886
|
+
});
|
|
16887
|
+
} else if (!showIdleTime && prevShowIdleTimeRef.current) {
|
|
16888
|
+
setIdleBarState((prev) => ({ ...prev, visible: false }));
|
|
16878
16889
|
}
|
|
16879
16890
|
prevShowIdleTimeRef.current = showIdleTime;
|
|
16880
16891
|
return () => {
|
|
16881
|
-
if (
|
|
16882
|
-
clearTimeout(
|
|
16892
|
+
if (stateUpdateTimeoutRef.current) {
|
|
16893
|
+
clearTimeout(stateUpdateTimeoutRef.current);
|
|
16883
16894
|
}
|
|
16884
16895
|
};
|
|
16885
16896
|
}, [showIdleTime]);
|
|
@@ -16972,6 +16983,55 @@ var HourlyOutputChart = ({
|
|
|
16972
16983
|
};
|
|
16973
16984
|
});
|
|
16974
16985
|
}, [animatedData, data, pphThreshold, idleTimeHourly, shiftStartTime.hour, formatHour, formatTimeRange]);
|
|
16986
|
+
const IdleBar = React14__default.useMemo(() => {
|
|
16987
|
+
if (!idleBarState.visible) return null;
|
|
16988
|
+
return /* @__PURE__ */ jsx(
|
|
16989
|
+
Bar,
|
|
16990
|
+
{
|
|
16991
|
+
dataKey: "idleMinutes",
|
|
16992
|
+
yAxisId: "idle",
|
|
16993
|
+
maxBarSize: 35,
|
|
16994
|
+
radius: [10, 10, 0, 0],
|
|
16995
|
+
fill: "url(#idlePattern)",
|
|
16996
|
+
opacity: 0.7,
|
|
16997
|
+
isAnimationActive: idleBarState.shouldAnimate,
|
|
16998
|
+
animationBegin: 0,
|
|
16999
|
+
animationDuration: 1e3,
|
|
17000
|
+
animationEasing: "ease-out",
|
|
17001
|
+
children: /* @__PURE__ */ jsx(
|
|
17002
|
+
LabelList,
|
|
17003
|
+
{
|
|
17004
|
+
dataKey: "idleMinutes",
|
|
17005
|
+
position: "top",
|
|
17006
|
+
content: (props) => {
|
|
17007
|
+
const { x, y, width, value } = props;
|
|
17008
|
+
if (!value || value === 0) return null;
|
|
17009
|
+
return /* @__PURE__ */ jsxs(
|
|
17010
|
+
"text",
|
|
17011
|
+
{
|
|
17012
|
+
x: x + width / 2,
|
|
17013
|
+
y: y - 2,
|
|
17014
|
+
textAnchor: "middle",
|
|
17015
|
+
fontSize: "9",
|
|
17016
|
+
fontWeight: "600",
|
|
17017
|
+
fill: "#6b7280",
|
|
17018
|
+
style: {
|
|
17019
|
+
opacity: 1,
|
|
17020
|
+
pointerEvents: "none"
|
|
17021
|
+
},
|
|
17022
|
+
children: [
|
|
17023
|
+
value,
|
|
17024
|
+
"m"
|
|
17025
|
+
]
|
|
17026
|
+
}
|
|
17027
|
+
);
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
)
|
|
17031
|
+
},
|
|
17032
|
+
`idle-bar-${idleBarState.key}`
|
|
17033
|
+
);
|
|
17034
|
+
}, [idleBarState.visible, idleBarState.key, idleBarState.shouldAnimate]);
|
|
16975
17035
|
const maxYValue = Math.ceil(pphThreshold * 1.5);
|
|
16976
17036
|
const generateYAxisTicks = () => {
|
|
16977
17037
|
const targetValue = Math.round(pphThreshold);
|
|
@@ -17229,51 +17289,7 @@ var HourlyOutputChart = ({
|
|
|
17229
17289
|
]
|
|
17230
17290
|
}
|
|
17231
17291
|
),
|
|
17232
|
-
|
|
17233
|
-
Bar,
|
|
17234
|
-
{
|
|
17235
|
-
dataKey: "idleMinutes",
|
|
17236
|
-
yAxisId: "idle",
|
|
17237
|
-
maxBarSize: 35,
|
|
17238
|
-
radius: [10, 10, 0, 0],
|
|
17239
|
-
fill: "url(#idlePattern)",
|
|
17240
|
-
opacity: 0.7,
|
|
17241
|
-
isAnimationActive: shouldAnimateIdle,
|
|
17242
|
-
animationBegin: shouldAnimateIdle ? 200 : 0,
|
|
17243
|
-
animationDuration: shouldAnimateIdle ? 800 : 0,
|
|
17244
|
-
animationEasing: "ease-out",
|
|
17245
|
-
children: /* @__PURE__ */ jsx(
|
|
17246
|
-
LabelList,
|
|
17247
|
-
{
|
|
17248
|
-
dataKey: "idleMinutes",
|
|
17249
|
-
position: "top",
|
|
17250
|
-
content: (props) => {
|
|
17251
|
-
const { x, y, width, value } = props;
|
|
17252
|
-
if (!value || value === 0) return null;
|
|
17253
|
-
return /* @__PURE__ */ jsxs(
|
|
17254
|
-
"text",
|
|
17255
|
-
{
|
|
17256
|
-
x: x + width / 2,
|
|
17257
|
-
y: y - 2,
|
|
17258
|
-
textAnchor: "middle",
|
|
17259
|
-
fontSize: "9",
|
|
17260
|
-
fontWeight: "600",
|
|
17261
|
-
fill: "#6b7280",
|
|
17262
|
-
style: {
|
|
17263
|
-
opacity: 1,
|
|
17264
|
-
pointerEvents: "none"
|
|
17265
|
-
},
|
|
17266
|
-
children: [
|
|
17267
|
-
value,
|
|
17268
|
-
"m"
|
|
17269
|
-
]
|
|
17270
|
-
}
|
|
17271
|
-
);
|
|
17272
|
-
}
|
|
17273
|
-
}
|
|
17274
|
-
)
|
|
17275
|
-
}
|
|
17276
|
-
),
|
|
17292
|
+
IdleBar,
|
|
17277
17293
|
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("pattern", { id: "idlePattern", patternUnits: "userSpaceOnUse", width: "4", height: "4", children: [
|
|
17278
17294
|
/* @__PURE__ */ jsx("rect", { width: "4", height: "4", fill: "#9ca3af", opacity: "0.2" }),
|
|
17279
17295
|
/* @__PURE__ */ jsx("path", { d: "M 0,4 l 4,-4 M -1,1 l 2,-2 M 3,5 l 2,-2", stroke: "#6b7280", strokeWidth: "0.5", opacity: "0.3" })
|
|
@@ -19746,6 +19762,32 @@ var WorkspaceCard = ({
|
|
|
19746
19762
|
}
|
|
19747
19763
|
);
|
|
19748
19764
|
};
|
|
19765
|
+
var styles = `
|
|
19766
|
+
@keyframes fadeIn {
|
|
19767
|
+
from {
|
|
19768
|
+
opacity: 0;
|
|
19769
|
+
transform: translateY(-10px);
|
|
19770
|
+
}
|
|
19771
|
+
to {
|
|
19772
|
+
opacity: 1;
|
|
19773
|
+
transform: translateY(0);
|
|
19774
|
+
}
|
|
19775
|
+
}
|
|
19776
|
+
|
|
19777
|
+
.calendar-container {
|
|
19778
|
+
will-change: transform, opacity;
|
|
19779
|
+
animation: fadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
|
|
19780
|
+
}
|
|
19781
|
+
|
|
19782
|
+
.calendar-wrapper:not(.animation-complete) * {
|
|
19783
|
+
transition: none !important;
|
|
19784
|
+
}
|
|
19785
|
+
|
|
19786
|
+
.calendar-wrapper:not(.animation-complete) .group:hover {
|
|
19787
|
+
opacity: 1 !important;
|
|
19788
|
+
transform: scale(1) !important;
|
|
19789
|
+
}
|
|
19790
|
+
`;
|
|
19749
19791
|
var WEEKDAYS2 = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
19750
19792
|
var getTimeInZoneAsDate = (timezone) => {
|
|
19751
19793
|
const time2 = getCurrentTimeInZone(timezone);
|
|
@@ -19764,20 +19806,20 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19764
19806
|
}) => {
|
|
19765
19807
|
const { dateTimeConfig } = useDashboardConfig();
|
|
19766
19808
|
const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
19809
|
+
const [animationComplete, setAnimationComplete] = useState(false);
|
|
19810
|
+
useEffect(() => {
|
|
19811
|
+
setAnimationComplete(false);
|
|
19812
|
+
const timer = setTimeout(() => {
|
|
19813
|
+
setAnimationComplete(true);
|
|
19814
|
+
}, 600);
|
|
19815
|
+
return () => clearTimeout(timer);
|
|
19816
|
+
}, [month, year]);
|
|
19767
19817
|
const calendarData = useMemo(() => {
|
|
19768
19818
|
const startOfMonth = toZonedTime(new Date(year, month, 1), configuredTimezone);
|
|
19769
19819
|
const endOfMonth = toZonedTime(new Date(year, month + 1, 0), configuredTimezone);
|
|
19770
19820
|
const totalDays = endOfMonth.getDate();
|
|
19771
19821
|
let startOffset = startOfMonth.getDay() - 1;
|
|
19772
19822
|
if (startOffset === -1) startOffset = 6;
|
|
19773
|
-
console.log("Calendar generation for:", {
|
|
19774
|
-
month: month + 1,
|
|
19775
|
-
year,
|
|
19776
|
-
startOffset,
|
|
19777
|
-
totalDays,
|
|
19778
|
-
configuredTimezone
|
|
19779
|
-
});
|
|
19780
|
-
console.log("Data points received:", data);
|
|
19781
19823
|
const calendar = Array(startOffset).fill(null);
|
|
19782
19824
|
for (let day = 1; day <= totalDays; day++) {
|
|
19783
19825
|
const currentDate = new Date(year, month, day);
|
|
@@ -19791,15 +19833,6 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19791
19833
|
const dataDate = new Date(d.date);
|
|
19792
19834
|
const dataDateStr = dataDate.toISOString().split("T")[0];
|
|
19793
19835
|
const matches = dataDateStr === dateToMatch;
|
|
19794
|
-
if (day <= 3 && matches) {
|
|
19795
|
-
console.log(`Found data match for day ${day}:`, {
|
|
19796
|
-
dataDate: dataDate.toISOString(),
|
|
19797
|
-
currentDate: currentTimezoneDate.toISOString(),
|
|
19798
|
-
dataDateStr,
|
|
19799
|
-
dateToMatch,
|
|
19800
|
-
data: d
|
|
19801
|
-
});
|
|
19802
|
-
}
|
|
19803
19836
|
return matches;
|
|
19804
19837
|
});
|
|
19805
19838
|
if (matchingData.length > 0) {
|
|
@@ -19810,32 +19843,10 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19810
19843
|
// Use the timezone-adjusted date for display
|
|
19811
19844
|
});
|
|
19812
19845
|
} else {
|
|
19813
|
-
calendar.push(
|
|
19814
|
-
date: currentTimezoneDate,
|
|
19815
|
-
dayShift: {
|
|
19816
|
-
efficiency: 0,
|
|
19817
|
-
output: 0,
|
|
19818
|
-
cycleTime: 0,
|
|
19819
|
-
pph: 0,
|
|
19820
|
-
pphThreshold: 0,
|
|
19821
|
-
idealOutput: 0,
|
|
19822
|
-
rank: 0,
|
|
19823
|
-
idleTime: 0
|
|
19824
|
-
},
|
|
19825
|
-
nightShift: {
|
|
19826
|
-
efficiency: 0,
|
|
19827
|
-
output: 0,
|
|
19828
|
-
cycleTime: 0,
|
|
19829
|
-
pph: 0,
|
|
19830
|
-
pphThreshold: 0,
|
|
19831
|
-
idealOutput: 0,
|
|
19832
|
-
rank: 0,
|
|
19833
|
-
idleTime: 0
|
|
19834
|
-
}
|
|
19835
|
-
});
|
|
19846
|
+
calendar.push(null);
|
|
19836
19847
|
}
|
|
19837
19848
|
}
|
|
19838
|
-
return calendar;
|
|
19849
|
+
return { calendar, startOffset };
|
|
19839
19850
|
}, [data, month, year, configuredTimezone]);
|
|
19840
19851
|
const monthlyMetrics = useMemo(() => {
|
|
19841
19852
|
const validDays = data.filter((day) => {
|
|
@@ -19852,15 +19863,17 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19852
19863
|
return [];
|
|
19853
19864
|
}
|
|
19854
19865
|
return [day.dayShift, day.nightShift];
|
|
19855
|
-
})
|
|
19866
|
+
});
|
|
19856
19867
|
if (validShifts.length === 0) return null;
|
|
19857
19868
|
const badShiftsCount = validShifts.filter((shift) => shift.efficiency < 75).length;
|
|
19869
|
+
const totalIdleTime = validShifts.reduce((sum, shift) => sum + shift.idleTime, 0);
|
|
19870
|
+
const avgIdleTime = Math.round(totalIdleTime / validShifts.length);
|
|
19858
19871
|
return {
|
|
19859
19872
|
avgEfficiency: Math.round(validShifts.reduce((sum, shift) => sum + shift.efficiency, 0) / validShifts.length),
|
|
19860
19873
|
avgCycleTime: Math.round(validShifts.reduce((sum, shift) => sum + shift.cycleTime, 0) / validShifts.length),
|
|
19874
|
+
avgIdleTime,
|
|
19861
19875
|
badDaysCount: badShiftsCount,
|
|
19862
|
-
totalDays: validShifts.length
|
|
19863
|
-
avgIdleTime: Math.round(validShifts.reduce((sum, shift) => sum + (shift.idleTime || 0), 0) / validShifts.length)
|
|
19876
|
+
totalDays: validShifts.length
|
|
19864
19877
|
};
|
|
19865
19878
|
}, [data, month, year, configuredTimezone]);
|
|
19866
19879
|
const handleDayClick = useCallback((day, shift) => {
|
|
@@ -19908,7 +19921,6 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19908
19921
|
compareDate.setHours(0, 0, 0, 0);
|
|
19909
19922
|
if (compareDate.getDay() === 0) return "bg-gray-300";
|
|
19910
19923
|
if (compareDate > istNow) return "bg-gray-200";
|
|
19911
|
-
if (efficiency < 10) return "bg-gray-300";
|
|
19912
19924
|
if (efficiency >= 80) return "bg-[#00AB45]/90";
|
|
19913
19925
|
if (efficiency >= 70) return "bg-[#FFB020]/90";
|
|
19914
19926
|
return "bg-[#E34329]/90";
|
|
@@ -19947,38 +19959,55 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19947
19959
|
] })
|
|
19948
19960
|
] }) });
|
|
19949
19961
|
};
|
|
19950
|
-
const renderDayCell = useCallback((day) => {
|
|
19951
|
-
if (
|
|
19962
|
+
const renderDayCell = useCallback((day, dayNumber, index) => {
|
|
19963
|
+
if (dayNumber === null) {
|
|
19964
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full" });
|
|
19965
|
+
}
|
|
19966
|
+
const cellDate = toZonedTime(new Date(year, month, dayNumber), configuredTimezone);
|
|
19967
|
+
const isToday = isCurrentDate(cellDate);
|
|
19968
|
+
const isFuture = isFutureDate(cellDate);
|
|
19969
|
+
const isSunday = cellDate.getDay() === 0;
|
|
19970
|
+
if (!day) {
|
|
19971
|
+
let bgColor = "bg-gray-100";
|
|
19972
|
+
let textColor = "text-gray-400";
|
|
19973
|
+
if (isSunday) {
|
|
19974
|
+
bgColor = "bg-gray-200";
|
|
19975
|
+
textColor = "text-gray-500";
|
|
19976
|
+
}
|
|
19977
|
+
if (isFuture) {
|
|
19978
|
+
bgColor = "bg-gray-50";
|
|
19979
|
+
textColor = "text-gray-300";
|
|
19980
|
+
}
|
|
19981
|
+
return /* @__PURE__ */ jsx("div", { className: `h-full border border-gray-200 rounded-lg ${bgColor} ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} cursor-not-allowed opacity-60`, children: /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsx("div", { className: `text-base font-medium ${textColor} ${isToday ? "text-blue-500" : ""}`, children: dayNumber }) }) });
|
|
19982
|
+
}
|
|
19952
19983
|
const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
|
|
19953
|
-
const isToday = isCurrentDate(day.date);
|
|
19954
|
-
const isFuture = isFutureDate(day.date);
|
|
19955
|
-
const isInactive = shiftData.efficiency < 10;
|
|
19956
19984
|
return /* @__PURE__ */ jsx(
|
|
19957
19985
|
"div",
|
|
19958
19986
|
{
|
|
19959
|
-
className: `group h-full transition-all duration-
|
|
19960
|
-
onClick: () => !isFuture &&
|
|
19987
|
+
className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
|
|
19988
|
+
onClick: () => !isFuture && handleDayClick(day, selectedShift),
|
|
19961
19989
|
children: /* @__PURE__ */ jsxs("div", { className: `
|
|
19962
19990
|
${getPerformanceColor(shiftData.efficiency, day.date)}
|
|
19963
|
-
rounded-lg h-full p-2 relative transition-all duration-
|
|
19991
|
+
rounded-lg h-full p-2 relative ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} shadow-sm
|
|
19964
19992
|
${isToday ? "ring-2 ring-blue-500 ring-offset-2 shadow-md" : ""}
|
|
19965
19993
|
`, children: [
|
|
19966
19994
|
/* @__PURE__ */ jsx("div", { className: `
|
|
19967
|
-
text-base font-medium text-white flex items-center transition-all duration-
|
|
19995
|
+
text-base font-medium text-white flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
|
|
19968
19996
|
${isToday ? "bg-blue-500 rounded-full w-7 h-7 justify-center" : ""}
|
|
19969
19997
|
`, children: day.date.getDate() }),
|
|
19970
|
-
!isFuture &&
|
|
19998
|
+
!isFuture && animationComplete && renderStats(shiftData, day.date)
|
|
19971
19999
|
] })
|
|
19972
20000
|
}
|
|
19973
20001
|
);
|
|
19974
|
-
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick]);
|
|
19975
|
-
return /* @__PURE__ */ jsxs("div", { className: `space-y-6 ${className || ""}`, children: [
|
|
20002
|
+
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete]);
|
|
20003
|
+
return /* @__PURE__ */ jsxs("div", { className: `calendar-wrapper space-y-6 ${className || ""} ${animationComplete ? "animation-complete" : ""}`, children: [
|
|
20004
|
+
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
|
|
19976
20005
|
/* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 border border-gray-200 rounded-lg p-1 bg-gray-50", children: [
|
|
19977
20006
|
/* @__PURE__ */ jsx(
|
|
19978
20007
|
"button",
|
|
19979
20008
|
{
|
|
19980
20009
|
onClick: () => handleShiftChange("day"),
|
|
19981
|
-
className: `px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${selectedShift === "day" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" :
|
|
20010
|
+
className: `px-4 py-2 text-sm font-medium rounded-md ${animationComplete ? "transition-all duration-200" : ""} ${selectedShift === "day" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" : `text-gray-600 ${animationComplete ? "hover:text-gray-900 hover:bg-gray-100" : ""}`}`,
|
|
19982
20011
|
children: "Day Shift"
|
|
19983
20012
|
}
|
|
19984
20013
|
),
|
|
@@ -19986,23 +20015,27 @@ var WorkspaceHistoryCalendar = ({
|
|
|
19986
20015
|
"button",
|
|
19987
20016
|
{
|
|
19988
20017
|
onClick: () => handleShiftChange("night"),
|
|
19989
|
-
className: `px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ${selectedShift === "night" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" :
|
|
20018
|
+
className: `px-4 py-2 text-sm font-medium rounded-md ${animationComplete ? "transition-all duration-200" : ""} ${selectedShift === "night" ? "bg-white text-blue-600 shadow-sm ring-1 ring-gray-200" : `text-gray-600 ${animationComplete ? "hover:text-gray-900 hover:bg-gray-100" : ""}`}`,
|
|
19990
20019
|
children: "Night Shift"
|
|
19991
20020
|
}
|
|
19992
20021
|
)
|
|
19993
20022
|
] }) }),
|
|
19994
20023
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
|
|
19995
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20024
|
+
/* @__PURE__ */ jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
19996
20025
|
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
19997
20026
|
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: selectedShift === "day" ? "Day Shifts" : "Night Shifts" }),
|
|
19998
20027
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Calendar view of daily performance" })
|
|
19999
20028
|
] }),
|
|
20000
20029
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-6", children: [
|
|
20001
20030
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-2", children: WEEKDAYS2.map((day) => /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-gray-600 text-center", children: day }, day)) }),
|
|
20002
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-2", children: calendarData.map((day, index) =>
|
|
20031
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-2", children: calendarData.calendar.map((day, index) => {
|
|
20032
|
+
const startOffset = calendarData.startOffset;
|
|
20033
|
+
const dayNumber = index >= startOffset ? index - startOffset + 1 : null;
|
|
20034
|
+
return /* @__PURE__ */ jsx("div", { className: "aspect-square relative transition-all duration-200 ease-in-out", children: renderDayCell(day, dayNumber && dayNumber <= new Date(year, month + 1, 0).getDate() ? dayNumber : null, index) }, index);
|
|
20035
|
+
}) })
|
|
20003
20036
|
] })
|
|
20004
20037
|
] }),
|
|
20005
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20038
|
+
/* @__PURE__ */ jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
20006
20039
|
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
20007
20040
|
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: "Monthly Summary" }),
|
|
20008
20041
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Overview of monthly performance metrics" })
|
|
@@ -22573,7 +22606,7 @@ var WorkspaceGridItem = React14__default.memo(({
|
|
|
22573
22606
|
}, [data.efficiency, isInactive, position.size, position.orientation]);
|
|
22574
22607
|
const { arrow, color: arrowColor } = useMemo(() => getTrendArrowAndColor2(data.trend_score), [data.trend_score]);
|
|
22575
22608
|
const workspaceNumber = useMemo(() => getWorkspaceNumber(data.workspace_name), [data.workspace_name]);
|
|
22576
|
-
const
|
|
22609
|
+
const styles2 = useMemo(() => getWorkspaceStyles(position, isInactive), [position, isInactive]);
|
|
22577
22610
|
const arrowPosition = useMemo(() => getArrowPositionClass(position), [position]);
|
|
22578
22611
|
const handleClick = useCallback((e) => {
|
|
22579
22612
|
e.preventDefault();
|
|
@@ -22624,7 +22657,7 @@ var WorkspaceGridItem = React14__default.memo(({
|
|
|
22624
22657
|
"button",
|
|
22625
22658
|
{
|
|
22626
22659
|
onClick: handleClick,
|
|
22627
|
-
className: `${
|
|
22660
|
+
className: `${styles2} ${colorClass} ${isBottleneck ? "ring-2 ring-red-500/70" : ""} ${isVeryLowEfficiency ? "ring-2 ring-red-500/50" : ""} ${isInactive ? "bg-gray-200" : ""} shadow-lg`,
|
|
22628
22661
|
"aria-label": isInactive ? `Inactive workspace ${workspaceNumber}` : `View details for workspace ${workspaceNumber}`,
|
|
22629
22662
|
title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name)}` : getWorkspaceDisplayName(data.workspace_name),
|
|
22630
22663
|
children: /* @__PURE__ */ jsx("div", { className: `font-semibold tracking-wide text-[min(4vw,2rem)] uppercase ${isInactive ? "text-gray-400" : "text-white"} drop-shadow-sm`, children: workspaceNumber })
|
|
@@ -30135,6 +30168,11 @@ var WorkspaceDetailView = ({
|
|
|
30135
30168
|
return getOperationalDate();
|
|
30136
30169
|
}, [isHistoricView, date]);
|
|
30137
30170
|
const handleMonthlyDataLoaded = useCallback((data) => {
|
|
30171
|
+
console.log("[handleMonthlyDataLoaded] Received data:", {
|
|
30172
|
+
dataLength: data?.length,
|
|
30173
|
+
isArray: Array.isArray(data),
|
|
30174
|
+
sample: data?.[0]
|
|
30175
|
+
});
|
|
30138
30176
|
if (!data || !Array.isArray(data)) {
|
|
30139
30177
|
console.error("Invalid monthly metrics data received:", data);
|
|
30140
30178
|
setMonthlyData([]);
|
|
@@ -30152,22 +30190,35 @@ var WorkspaceDetailView = ({
|
|
|
30152
30190
|
if (!dayEntry) {
|
|
30153
30191
|
dayEntry = {
|
|
30154
30192
|
date: dateObj,
|
|
30155
|
-
dayShift:
|
|
30156
|
-
|
|
30193
|
+
dayShift: null,
|
|
30194
|
+
// Start with null instead of zeros
|
|
30195
|
+
nightShift: null
|
|
30196
|
+
// Start with null instead of zeros
|
|
30157
30197
|
};
|
|
30158
30198
|
dayDataMap.set(dateKey, dayEntry);
|
|
30159
30199
|
}
|
|
30160
|
-
const
|
|
30161
|
-
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
30167
|
-
|
|
30168
|
-
|
|
30200
|
+
const shiftData = {
|
|
30201
|
+
efficiency: metric.avg_efficiency || 0,
|
|
30202
|
+
output: metric.total_output || 0,
|
|
30203
|
+
cycleTime: metric.avg_cycle_time || 0,
|
|
30204
|
+
pph: metric.avg_pph || 0,
|
|
30205
|
+
pphThreshold: metric.pph_threshold || 0,
|
|
30206
|
+
idealOutput: metric.ideal_output || 0,
|
|
30207
|
+
rank: metric.workspace_rank || 0,
|
|
30208
|
+
idleTime: metric.idle_time || 0
|
|
30209
|
+
};
|
|
30210
|
+
if (metric.shift_id === 0) {
|
|
30211
|
+
dayEntry.dayShift = shiftData;
|
|
30212
|
+
} else {
|
|
30213
|
+
dayEntry.nightShift = shiftData;
|
|
30214
|
+
}
|
|
30169
30215
|
});
|
|
30170
|
-
const processedData = Array.from(dayDataMap.values())
|
|
30216
|
+
const processedData = Array.from(dayDataMap.values()).filter((entry) => entry.dayShift !== null || entry.nightShift !== null).map((entry) => ({
|
|
30217
|
+
date: entry.date,
|
|
30218
|
+
// If a shift is null (no data), provide zeros for compatibility
|
|
30219
|
+
dayShift: entry.dayShift || { efficiency: 0, output: 0, cycleTime: 0, pph: 0, pphThreshold: 0, idealOutput: 0, rank: 0, idleTime: 0 },
|
|
30220
|
+
nightShift: entry.nightShift || { efficiency: 0, output: 0, cycleTime: 0, pph: 0, pphThreshold: 0, idealOutput: 0, rank: 0, idleTime: 0 }
|
|
30221
|
+
}));
|
|
30171
30222
|
console.log(`[handleMonthlyDataLoaded] Transformed data for calendar:`, {
|
|
30172
30223
|
count: processedData.length,
|
|
30173
30224
|
sample: processedData.slice(0, 1)
|
|
@@ -30627,7 +30678,7 @@ var WorkspaceDetailView = ({
|
|
|
30627
30678
|
}
|
|
30628
30679
|
)
|
|
30629
30680
|
] }),
|
|
30630
|
-
|
|
30681
|
+
/* @__PURE__ */ jsx(
|
|
30631
30682
|
WorkspaceHistoryCalendar,
|
|
30632
30683
|
{
|
|
30633
30684
|
data: monthlyData,
|