@optifye/dashboard-core 6.12.27 → 6.12.28
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/{automation-pIVo1XWk.d.mts → automation-CQqrAD4z.d.mts} +1 -1
- package/dist/{automation-pIVo1XWk.d.ts → automation-CQqrAD4z.d.ts} +1 -1
- package/dist/automation.d.mts +1 -1
- package/dist/automation.d.ts +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +55 -15
- package/dist/index.mjs +56 -16
- package/package.json +1 -1
|
@@ -181,7 +181,7 @@ interface WorkspaceMetrics {
|
|
|
181
181
|
factory_area_key?: string | null;
|
|
182
182
|
factory_area_name?: string | null;
|
|
183
183
|
factory_area_enabled?: boolean | null;
|
|
184
|
-
leaderboard_metric_kind?: 'efficiency' | 'recent_flow_shift_average';
|
|
184
|
+
leaderboard_metric_kind?: 'efficiency' | 'cycle_time' | 'recent_flow_shift_average';
|
|
185
185
|
leaderboard_value?: number | null;
|
|
186
186
|
avg_recent_flow?: number | null;
|
|
187
187
|
recent_flow_mode?: 'computed' | 'hold' | 'unavailable';
|
|
@@ -181,7 +181,7 @@ interface WorkspaceMetrics {
|
|
|
181
181
|
factory_area_key?: string | null;
|
|
182
182
|
factory_area_name?: string | null;
|
|
183
183
|
factory_area_enabled?: boolean | null;
|
|
184
|
-
leaderboard_metric_kind?: 'efficiency' | 'recent_flow_shift_average';
|
|
184
|
+
leaderboard_metric_kind?: 'efficiency' | 'cycle_time' | 'recent_flow_shift_average';
|
|
185
185
|
leaderboard_value?: number | null;
|
|
186
186
|
avg_recent_flow?: number | null;
|
|
187
187
|
recent_flow_mode?: 'computed' | 'hold' | 'unavailable';
|
package/dist/automation.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, W as WorkspaceMetrics, e as WorkspaceVideoStream } from './automation-
|
|
1
|
+
export { z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, W as WorkspaceMetrics, e as WorkspaceVideoStream } from './automation-CQqrAD4z.mjs';
|
|
2
2
|
import 'react';
|
package/dist/automation.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, W as WorkspaceMetrics, e as WorkspaceVideoStream } from './automation-
|
|
1
|
+
export { z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, W as WorkspaceMetrics, e as WorkspaceVideoStream } from './automation-CQqrAD4z.js';
|
|
2
2
|
import 'react';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LineSignal, V as VideoGridMetricMode, W as WorkspaceMetrics, a as LineInfo, b as WorkspaceDetailedMetrics, S as SkuBreakdownItem, c as SkuSegmentItem, d as LineSkuBreakdownItem, E as EfficiencyLegendUpdate, D as DashboardKPIs, P as PoorPerformingWorkspace, e as WorkspaceVideoStream, K as KpiTrend, M as MonthlyTrendSummary, f as Workspace, g as WorkspaceCameraIpInfo, h as WorkspaceActionUpdate, A as ActionThreshold, i as ShiftConfiguration, j as KpiSignal, k as LineIssueResolutionSummary } from './automation-
|
|
2
|
-
export { r as CountDelta, C as CurrentWorkspaceSKU, s as DurationDelta, o as KpiSignalMode, n as KpiSignalSource, l as LineDetailedMetrics, m as LineSignalSource, u as LineThreshold, q as PercentageDelta, z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, v as ShiftConfigurationRecord, p as ValueDelta, t as WorkspaceCropRect, x as isRecentFlowVideoGridMetricMode, y as isWipGatedVideoGridMetricMode, w as normalizeVideoGridMetricMode } from './automation-
|
|
1
|
+
import { L as LineSignal, V as VideoGridMetricMode, W as WorkspaceMetrics, a as LineInfo, b as WorkspaceDetailedMetrics, S as SkuBreakdownItem, c as SkuSegmentItem, d as LineSkuBreakdownItem, E as EfficiencyLegendUpdate, D as DashboardKPIs, P as PoorPerformingWorkspace, e as WorkspaceVideoStream, K as KpiTrend, M as MonthlyTrendSummary, f as Workspace, g as WorkspaceCameraIpInfo, h as WorkspaceActionUpdate, A as ActionThreshold, i as ShiftConfiguration, j as KpiSignal, k as LineIssueResolutionSummary } from './automation-CQqrAD4z.mjs';
|
|
2
|
+
export { r as CountDelta, C as CurrentWorkspaceSKU, s as DurationDelta, o as KpiSignalMode, n as KpiSignalSource, l as LineDetailedMetrics, m as LineSignalSource, u as LineThreshold, q as PercentageDelta, z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, v as ShiftConfigurationRecord, p as ValueDelta, t as WorkspaceCropRect, x as isRecentFlowVideoGridMetricMode, y as isWipGatedVideoGridMetricMode, w as normalizeVideoGridMetricMode } from './automation-CQqrAD4z.mjs';
|
|
3
3
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
4
4
|
import { SupabaseClient as SupabaseClient$1, Session, User, AuthError } from '@supabase/supabase-js';
|
|
5
5
|
import { LucideProps, Share2, Download } from 'lucide-react';
|
|
@@ -2704,7 +2704,7 @@ interface LeaderboardEntry {
|
|
|
2704
2704
|
efficiency: number;
|
|
2705
2705
|
avg_recent_flow?: number | null;
|
|
2706
2706
|
leaderboard_value?: number | null;
|
|
2707
|
-
leaderboard_metric_kind?: 'efficiency' | 'recent_flow_shift_average';
|
|
2707
|
+
leaderboard_metric_kind?: 'efficiency' | 'cycle_time' | 'recent_flow_shift_average';
|
|
2708
2708
|
total_output?: number;
|
|
2709
2709
|
total_day_output?: number;
|
|
2710
2710
|
avg_pph?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LineSignal, V as VideoGridMetricMode, W as WorkspaceMetrics, a as LineInfo, b as WorkspaceDetailedMetrics, S as SkuBreakdownItem, c as SkuSegmentItem, d as LineSkuBreakdownItem, E as EfficiencyLegendUpdate, D as DashboardKPIs, P as PoorPerformingWorkspace, e as WorkspaceVideoStream, K as KpiTrend, M as MonthlyTrendSummary, f as Workspace, g as WorkspaceCameraIpInfo, h as WorkspaceActionUpdate, A as ActionThreshold, i as ShiftConfiguration, j as KpiSignal, k as LineIssueResolutionSummary } from './automation-
|
|
2
|
-
export { r as CountDelta, C as CurrentWorkspaceSKU, s as DurationDelta, o as KpiSignalMode, n as KpiSignalSource, l as LineDetailedMetrics, m as LineSignalSource, u as LineThreshold, q as PercentageDelta, z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, v as ShiftConfigurationRecord, p as ValueDelta, t as WorkspaceCropRect, x as isRecentFlowVideoGridMetricMode, y as isWipGatedVideoGridMetricMode, w as normalizeVideoGridMetricMode } from './automation-
|
|
1
|
+
import { L as LineSignal, V as VideoGridMetricMode, W as WorkspaceMetrics, a as LineInfo, b as WorkspaceDetailedMetrics, S as SkuBreakdownItem, c as SkuSegmentItem, d as LineSkuBreakdownItem, E as EfficiencyLegendUpdate, D as DashboardKPIs, P as PoorPerformingWorkspace, e as WorkspaceVideoStream, K as KpiTrend, M as MonthlyTrendSummary, f as Workspace, g as WorkspaceCameraIpInfo, h as WorkspaceActionUpdate, A as ActionThreshold, i as ShiftConfiguration, j as KpiSignal, k as LineIssueResolutionSummary } from './automation-CQqrAD4z.js';
|
|
2
|
+
export { r as CountDelta, C as CurrentWorkspaceSKU, s as DurationDelta, o as KpiSignalMode, n as KpiSignalSource, l as LineDetailedMetrics, m as LineSignalSource, u as LineThreshold, q as PercentageDelta, z as RecentFlowSnapshotGrid, R as RecentFlowSnapshotGridProps, v as ShiftConfigurationRecord, p as ValueDelta, t as WorkspaceCropRect, x as isRecentFlowVideoGridMetricMode, y as isWipGatedVideoGridMetricMode, w as normalizeVideoGridMetricMode } from './automation-CQqrAD4z.js';
|
|
3
3
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
4
4
|
import { SupabaseClient as SupabaseClient$1, Session, User, AuthError } from '@supabase/supabase-js';
|
|
5
5
|
import { LucideProps, Share2, Download } from 'lucide-react';
|
|
@@ -2704,7 +2704,7 @@ interface LeaderboardEntry {
|
|
|
2704
2704
|
efficiency: number;
|
|
2705
2705
|
avg_recent_flow?: number | null;
|
|
2706
2706
|
leaderboard_value?: number | null;
|
|
2707
|
-
leaderboard_metric_kind?: 'efficiency' | 'recent_flow_shift_average';
|
|
2707
|
+
leaderboard_metric_kind?: 'efficiency' | 'cycle_time' | 'recent_flow_shift_average';
|
|
2708
2708
|
total_output?: number;
|
|
2709
2709
|
total_day_output?: number;
|
|
2710
2710
|
avg_pph?: number;
|
package/dist/index.js
CHANGED
|
@@ -14320,9 +14320,11 @@ var useLeaderboardMetrics = (date, shiftId, limit = 10, filter2 = "all") => {
|
|
|
14320
14320
|
`/api/dashboard/leaderboard?${params.toString()}`
|
|
14321
14321
|
);
|
|
14322
14322
|
let entries = (data.entries || []).slice();
|
|
14323
|
-
entries.sort(
|
|
14324
|
-
|
|
14325
|
-
|
|
14323
|
+
entries.sort((a, b) => {
|
|
14324
|
+
const valueA = a.leaderboard_metric_kind === "cycle_time" ? a.leaderboard_value : a.efficiency;
|
|
14325
|
+
const valueB = b.leaderboard_metric_kind === "cycle_time" ? b.leaderboard_value : b.efficiency;
|
|
14326
|
+
return (valueB ?? -1) - (valueA ?? -1);
|
|
14327
|
+
});
|
|
14326
14328
|
if (filter2 === "top") {
|
|
14327
14329
|
entries = entries.slice(0, limit);
|
|
14328
14330
|
} else if (filter2 === "bottom") {
|
|
@@ -57701,7 +57703,7 @@ var SideNavBar = React144.memo(({
|
|
|
57701
57703
|
const role = user?.role_level;
|
|
57702
57704
|
const roleNavPaths = React144.useMemo(() => getRoleNavPaths(role), [role]);
|
|
57703
57705
|
const showLiveMonitorLink = roleNavPaths.includes("/live-monitor");
|
|
57704
|
-
const rootDashboardSurface = React144.useMemo(() => "monitor", []);
|
|
57706
|
+
const rootDashboardSurface = React144.useMemo(() => role === "owner" || role === "plant_head" || role === "optifye" ? "operations_overview" : "monitor", [role]);
|
|
57705
57707
|
const getBasePath = React144.useCallback((path) => {
|
|
57706
57708
|
const firstSegment = path.split("?")[0].split("/").filter(Boolean)[0];
|
|
57707
57709
|
return firstSegment ? `/${firstSegment}` : "/";
|
|
@@ -57752,6 +57754,12 @@ var SideNavBar = React144.memo(({
|
|
|
57752
57754
|
dashboard_surface: dashboardSurface
|
|
57753
57755
|
}
|
|
57754
57756
|
}), []);
|
|
57757
|
+
const handleHomeClick = React144.useCallback(() => {
|
|
57758
|
+
navigate("/", {
|
|
57759
|
+
trackingEvent: buildDashboardSurfaceTrackingEvent("side_nav", "/", rootDashboardSurface)
|
|
57760
|
+
});
|
|
57761
|
+
onMobileMenuClose?.();
|
|
57762
|
+
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent, rootDashboardSurface]);
|
|
57755
57763
|
const handleLeaderboardClick = React144.useCallback(() => {
|
|
57756
57764
|
navigate(`/leaderboard`, {
|
|
57757
57765
|
trackingEvent: {
|
|
@@ -58057,6 +58065,7 @@ var SideNavBar = React144.memo(({
|
|
|
58057
58065
|
});
|
|
58058
58066
|
onMobileMenuClose?.();
|
|
58059
58067
|
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent, rootDashboardSurface]);
|
|
58068
|
+
const homeButtonClasses = React144.useMemo(() => getButtonClasses("/"), [getButtonClasses]);
|
|
58060
58069
|
const liveButtonClasses = React144.useMemo(() => getButtonClasses("/live-monitor"), [getButtonClasses]);
|
|
58061
58070
|
const leaderboardButtonClasses = React144.useMemo(() => getButtonClasses("/leaderboard"), [getButtonClasses]);
|
|
58062
58071
|
const kpisButtonClasses = React144.useMemo(() => getButtonClasses("/kpis"), [getButtonClasses]);
|
|
@@ -58088,6 +58097,21 @@ var SideNavBar = React144.memo(({
|
|
|
58088
58097
|
}
|
|
58089
58098
|
) }),
|
|
58090
58099
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full py-6 px-4 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
58100
|
+
canAccessPath("/") && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
58101
|
+
"button",
|
|
58102
|
+
{
|
|
58103
|
+
onClick: handleHomeClick,
|
|
58104
|
+
className: homeButtonClasses,
|
|
58105
|
+
"aria-label": "Home",
|
|
58106
|
+
tabIndex: 0,
|
|
58107
|
+
role: "tab",
|
|
58108
|
+
"aria-selected": isPathActive("/"),
|
|
58109
|
+
children: [
|
|
58110
|
+
/* @__PURE__ */ jsxRuntime.jsx(outline.HomeIcon, { className: "w-5 h-5 mb-1" }),
|
|
58111
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Home" })
|
|
58112
|
+
]
|
|
58113
|
+
}
|
|
58114
|
+
),
|
|
58091
58115
|
showLiveMonitorLink && canAccessPath("/live-monitor") && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
58092
58116
|
"button",
|
|
58093
58117
|
{
|
|
@@ -58216,6 +58240,18 @@ var SideNavBar = React144.memo(({
|
|
|
58216
58240
|
};
|
|
58217
58241
|
};
|
|
58218
58242
|
return /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "px-5 py-6", children: [
|
|
58243
|
+
canAccessPath("/") && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
58244
|
+
"button",
|
|
58245
|
+
{
|
|
58246
|
+
onClick: handleMobileNavClick(handleHomeClick),
|
|
58247
|
+
className: getMobileButtonClass("/"),
|
|
58248
|
+
"aria-label": "Home",
|
|
58249
|
+
children: [
|
|
58250
|
+
/* @__PURE__ */ jsxRuntime.jsx(outline.HomeIcon, { className: getIconClass("/") }),
|
|
58251
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base font-medium", children: "Home" })
|
|
58252
|
+
]
|
|
58253
|
+
}
|
|
58254
|
+
),
|
|
58219
58255
|
showLiveMonitorLink && canAccessPath("/live-monitor") && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
58220
58256
|
"button",
|
|
58221
58257
|
{
|
|
@@ -70517,12 +70553,16 @@ var KPIsOverviewView = ({
|
|
|
70517
70553
|
() => new Set(resolvedAssignedLineIds),
|
|
70518
70554
|
[resolvedAssignedLineIds]
|
|
70519
70555
|
);
|
|
70556
|
+
const loadedLineIds = React144__namespace.default.useMemo(
|
|
70557
|
+
() => lines.map((line) => line.id).filter(Boolean),
|
|
70558
|
+
[lines]
|
|
70559
|
+
);
|
|
70520
70560
|
const metricsLineIds = React144__namespace.default.useMemo(() => {
|
|
70521
70561
|
if (isSuperAdmin) {
|
|
70522
|
-
return lineIds ?? [];
|
|
70562
|
+
return loadedLineIds.length > 0 ? loadedLineIds : lineIds ?? [];
|
|
70523
70563
|
}
|
|
70524
70564
|
return resolvedAssignedLineIds;
|
|
70525
|
-
}, [isSuperAdmin, lineIds, resolvedAssignedLineIds]);
|
|
70565
|
+
}, [isSuperAdmin, loadedLineIds, lineIds, resolvedAssignedLineIds]);
|
|
70526
70566
|
const assignedLineIdsForLeaderboard = isSuperAdmin ? void 0 : resolvedAssignedLineIds;
|
|
70527
70567
|
const leaderboardLinesForView = React144__namespace.default.useMemo(() => {
|
|
70528
70568
|
const targetMode = viewType === "machine" ? "uptime" : "output";
|
|
@@ -71576,16 +71616,16 @@ var AnimatedEfficiency = React144.memo(({ value }) => {
|
|
|
71576
71616
|
});
|
|
71577
71617
|
AnimatedEfficiency.displayName = "AnimatedEfficiency";
|
|
71578
71618
|
var getWorkspaceLeaderboardMetricValue = (workspace) => {
|
|
71579
|
-
if (workspace.leaderboard_metric_kind === "
|
|
71619
|
+
if (workspace.leaderboard_metric_kind === "cycle_time") {
|
|
71580
71620
|
const cycleRatio = getCycleRatio(workspace);
|
|
71581
|
-
return cycleRatio === null ? null : cycleRatio * 100;
|
|
71621
|
+
return toFiniteNumber(workspace.leaderboard_value) ?? (cycleRatio === null ? null : cycleRatio * 100);
|
|
71582
71622
|
}
|
|
71583
|
-
return toFiniteNumber(workspace.
|
|
71623
|
+
return toFiniteNumber(workspace.efficiency);
|
|
71584
71624
|
};
|
|
71585
71625
|
var getWorkspaceDisplayedMetricValue = (workspace) => getWorkspaceLeaderboardMetricValue(workspace);
|
|
71586
|
-
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "
|
|
71626
|
+
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "cycle_time" ? "Actual CT / Standard CT" : defaultLabel;
|
|
71587
71627
|
var renderWorkspaceLeaderboardMetric = (workspace) => {
|
|
71588
|
-
if (workspace.leaderboard_metric_kind === "
|
|
71628
|
+
if (workspace.leaderboard_metric_kind === "cycle_time") {
|
|
71589
71629
|
const actualCT = formatCycleTimeValue(workspace.avg_cycle_time);
|
|
71590
71630
|
const standardCT = formatCycleTimeValue(workspace.ideal_cycle_time);
|
|
71591
71631
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tabular-nums", children: [
|
|
@@ -72554,13 +72594,13 @@ var LeaderboardDetailView = React144.memo(({
|
|
|
72554
72594
|
error.message
|
|
72555
72595
|
] }) });
|
|
72556
72596
|
}
|
|
72557
|
-
const
|
|
72558
|
-
(workspace) => workspace.leaderboard_metric_kind === "
|
|
72597
|
+
const hasCycleTimeLeaderboardRows = sortedWorkspaces.some(
|
|
72598
|
+
(workspace) => workspace.leaderboard_metric_kind === "cycle_time"
|
|
72559
72599
|
);
|
|
72560
72600
|
const hasEfficiencyLeaderboardRows = sortedWorkspaces.some(
|
|
72561
|
-
(workspace) => workspace.leaderboard_metric_kind !== "
|
|
72601
|
+
(workspace) => workspace.leaderboard_metric_kind !== "cycle_time"
|
|
72562
72602
|
);
|
|
72563
|
-
const metricLabel = viewType === "machine" ? "Utilization" :
|
|
72603
|
+
const metricLabel = viewType === "machine" ? "Utilization" : hasCycleTimeLeaderboardRows && !hasEfficiencyLeaderboardRows ? "Actual CT / Standard CT" : hasCycleTimeLeaderboardRows && hasEfficiencyLeaderboardRows ? "Performance" : "Efficiency";
|
|
72564
72604
|
const descendingSortLabel = "Highest to Lowest";
|
|
72565
72605
|
const ascendingSortLabel = "Lowest to Highest";
|
|
72566
72606
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `min-h-screen bg-slate-50 flex flex-col ${className}`, style: { willChange: "contents" }, children: [
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Too
|
|
|
16
16
|
import { Slot } from '@radix-ui/react-slot';
|
|
17
17
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
18
18
|
import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
|
|
19
|
-
import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
|
|
19
|
+
import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
|
|
20
20
|
import { CheckIcon } from '@heroicons/react/24/solid';
|
|
21
21
|
import html2canvas from 'html2canvas';
|
|
22
22
|
import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
|
|
@@ -14291,9 +14291,11 @@ var useLeaderboardMetrics = (date, shiftId, limit = 10, filter2 = "all") => {
|
|
|
14291
14291
|
`/api/dashboard/leaderboard?${params.toString()}`
|
|
14292
14292
|
);
|
|
14293
14293
|
let entries = (data.entries || []).slice();
|
|
14294
|
-
entries.sort(
|
|
14295
|
-
|
|
14296
|
-
|
|
14294
|
+
entries.sort((a, b) => {
|
|
14295
|
+
const valueA = a.leaderboard_metric_kind === "cycle_time" ? a.leaderboard_value : a.efficiency;
|
|
14296
|
+
const valueB = b.leaderboard_metric_kind === "cycle_time" ? b.leaderboard_value : b.efficiency;
|
|
14297
|
+
return (valueB ?? -1) - (valueA ?? -1);
|
|
14298
|
+
});
|
|
14297
14299
|
if (filter2 === "top") {
|
|
14298
14300
|
entries = entries.slice(0, limit);
|
|
14299
14301
|
} else if (filter2 === "bottom") {
|
|
@@ -57672,7 +57674,7 @@ var SideNavBar = memo$1(({
|
|
|
57672
57674
|
const role = user?.role_level;
|
|
57673
57675
|
const roleNavPaths = useMemo(() => getRoleNavPaths(role), [role]);
|
|
57674
57676
|
const showLiveMonitorLink = roleNavPaths.includes("/live-monitor");
|
|
57675
|
-
const rootDashboardSurface = useMemo(() => "monitor", []);
|
|
57677
|
+
const rootDashboardSurface = useMemo(() => role === "owner" || role === "plant_head" || role === "optifye" ? "operations_overview" : "monitor", [role]);
|
|
57676
57678
|
const getBasePath = useCallback((path) => {
|
|
57677
57679
|
const firstSegment = path.split("?")[0].split("/").filter(Boolean)[0];
|
|
57678
57680
|
return firstSegment ? `/${firstSegment}` : "/";
|
|
@@ -57723,6 +57725,12 @@ var SideNavBar = memo$1(({
|
|
|
57723
57725
|
dashboard_surface: dashboardSurface
|
|
57724
57726
|
}
|
|
57725
57727
|
}), []);
|
|
57728
|
+
const handleHomeClick = useCallback(() => {
|
|
57729
|
+
navigate("/", {
|
|
57730
|
+
trackingEvent: buildDashboardSurfaceTrackingEvent("side_nav", "/", rootDashboardSurface)
|
|
57731
|
+
});
|
|
57732
|
+
onMobileMenuClose?.();
|
|
57733
|
+
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent, rootDashboardSurface]);
|
|
57726
57734
|
const handleLeaderboardClick = useCallback(() => {
|
|
57727
57735
|
navigate(`/leaderboard`, {
|
|
57728
57736
|
trackingEvent: {
|
|
@@ -58028,6 +58036,7 @@ var SideNavBar = memo$1(({
|
|
|
58028
58036
|
});
|
|
58029
58037
|
onMobileMenuClose?.();
|
|
58030
58038
|
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent, rootDashboardSurface]);
|
|
58039
|
+
const homeButtonClasses = useMemo(() => getButtonClasses("/"), [getButtonClasses]);
|
|
58031
58040
|
const liveButtonClasses = useMemo(() => getButtonClasses("/live-monitor"), [getButtonClasses]);
|
|
58032
58041
|
const leaderboardButtonClasses = useMemo(() => getButtonClasses("/leaderboard"), [getButtonClasses]);
|
|
58033
58042
|
const kpisButtonClasses = useMemo(() => getButtonClasses("/kpis"), [getButtonClasses]);
|
|
@@ -58059,6 +58068,21 @@ var SideNavBar = memo$1(({
|
|
|
58059
58068
|
}
|
|
58060
58069
|
) }),
|
|
58061
58070
|
/* @__PURE__ */ jsx("div", { className: "flex-1 w-full py-6 px-4 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
58071
|
+
canAccessPath("/") && /* @__PURE__ */ jsxs(
|
|
58072
|
+
"button",
|
|
58073
|
+
{
|
|
58074
|
+
onClick: handleHomeClick,
|
|
58075
|
+
className: homeButtonClasses,
|
|
58076
|
+
"aria-label": "Home",
|
|
58077
|
+
tabIndex: 0,
|
|
58078
|
+
role: "tab",
|
|
58079
|
+
"aria-selected": isPathActive("/"),
|
|
58080
|
+
children: [
|
|
58081
|
+
/* @__PURE__ */ jsx(HomeIcon, { className: "w-5 h-5 mb-1" }),
|
|
58082
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Home" })
|
|
58083
|
+
]
|
|
58084
|
+
}
|
|
58085
|
+
),
|
|
58062
58086
|
showLiveMonitorLink && canAccessPath("/live-monitor") && /* @__PURE__ */ jsxs(
|
|
58063
58087
|
"button",
|
|
58064
58088
|
{
|
|
@@ -58187,6 +58211,18 @@ var SideNavBar = memo$1(({
|
|
|
58187
58211
|
};
|
|
58188
58212
|
};
|
|
58189
58213
|
return /* @__PURE__ */ jsxs("nav", { className: "px-5 py-6", children: [
|
|
58214
|
+
canAccessPath("/") && /* @__PURE__ */ jsxs(
|
|
58215
|
+
"button",
|
|
58216
|
+
{
|
|
58217
|
+
onClick: handleMobileNavClick(handleHomeClick),
|
|
58218
|
+
className: getMobileButtonClass("/"),
|
|
58219
|
+
"aria-label": "Home",
|
|
58220
|
+
children: [
|
|
58221
|
+
/* @__PURE__ */ jsx(HomeIcon, { className: getIconClass("/") }),
|
|
58222
|
+
/* @__PURE__ */ jsx("span", { className: "text-base font-medium", children: "Home" })
|
|
58223
|
+
]
|
|
58224
|
+
}
|
|
58225
|
+
),
|
|
58190
58226
|
showLiveMonitorLink && canAccessPath("/live-monitor") && /* @__PURE__ */ jsxs(
|
|
58191
58227
|
"button",
|
|
58192
58228
|
{
|
|
@@ -70488,12 +70524,16 @@ var KPIsOverviewView = ({
|
|
|
70488
70524
|
() => new Set(resolvedAssignedLineIds),
|
|
70489
70525
|
[resolvedAssignedLineIds]
|
|
70490
70526
|
);
|
|
70527
|
+
const loadedLineIds = React144__default.useMemo(
|
|
70528
|
+
() => lines.map((line) => line.id).filter(Boolean),
|
|
70529
|
+
[lines]
|
|
70530
|
+
);
|
|
70491
70531
|
const metricsLineIds = React144__default.useMemo(() => {
|
|
70492
70532
|
if (isSuperAdmin) {
|
|
70493
|
-
return lineIds ?? [];
|
|
70533
|
+
return loadedLineIds.length > 0 ? loadedLineIds : lineIds ?? [];
|
|
70494
70534
|
}
|
|
70495
70535
|
return resolvedAssignedLineIds;
|
|
70496
|
-
}, [isSuperAdmin, lineIds, resolvedAssignedLineIds]);
|
|
70536
|
+
}, [isSuperAdmin, loadedLineIds, lineIds, resolvedAssignedLineIds]);
|
|
70497
70537
|
const assignedLineIdsForLeaderboard = isSuperAdmin ? void 0 : resolvedAssignedLineIds;
|
|
70498
70538
|
const leaderboardLinesForView = React144__default.useMemo(() => {
|
|
70499
70539
|
const targetMode = viewType === "machine" ? "uptime" : "output";
|
|
@@ -71547,16 +71587,16 @@ var AnimatedEfficiency = memo$1(({ value }) => {
|
|
|
71547
71587
|
});
|
|
71548
71588
|
AnimatedEfficiency.displayName = "AnimatedEfficiency";
|
|
71549
71589
|
var getWorkspaceLeaderboardMetricValue = (workspace) => {
|
|
71550
|
-
if (workspace.leaderboard_metric_kind === "
|
|
71590
|
+
if (workspace.leaderboard_metric_kind === "cycle_time") {
|
|
71551
71591
|
const cycleRatio = getCycleRatio(workspace);
|
|
71552
|
-
return cycleRatio === null ? null : cycleRatio * 100;
|
|
71592
|
+
return toFiniteNumber(workspace.leaderboard_value) ?? (cycleRatio === null ? null : cycleRatio * 100);
|
|
71553
71593
|
}
|
|
71554
|
-
return toFiniteNumber(workspace.
|
|
71594
|
+
return toFiniteNumber(workspace.efficiency);
|
|
71555
71595
|
};
|
|
71556
71596
|
var getWorkspaceDisplayedMetricValue = (workspace) => getWorkspaceLeaderboardMetricValue(workspace);
|
|
71557
|
-
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "
|
|
71597
|
+
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "cycle_time" ? "Actual CT / Standard CT" : defaultLabel;
|
|
71558
71598
|
var renderWorkspaceLeaderboardMetric = (workspace) => {
|
|
71559
|
-
if (workspace.leaderboard_metric_kind === "
|
|
71599
|
+
if (workspace.leaderboard_metric_kind === "cycle_time") {
|
|
71560
71600
|
const actualCT = formatCycleTimeValue(workspace.avg_cycle_time);
|
|
71561
71601
|
const standardCT = formatCycleTimeValue(workspace.ideal_cycle_time);
|
|
71562
71602
|
return /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
@@ -72525,13 +72565,13 @@ var LeaderboardDetailView = memo$1(({
|
|
|
72525
72565
|
error.message
|
|
72526
72566
|
] }) });
|
|
72527
72567
|
}
|
|
72528
|
-
const
|
|
72529
|
-
(workspace) => workspace.leaderboard_metric_kind === "
|
|
72568
|
+
const hasCycleTimeLeaderboardRows = sortedWorkspaces.some(
|
|
72569
|
+
(workspace) => workspace.leaderboard_metric_kind === "cycle_time"
|
|
72530
72570
|
);
|
|
72531
72571
|
const hasEfficiencyLeaderboardRows = sortedWorkspaces.some(
|
|
72532
|
-
(workspace) => workspace.leaderboard_metric_kind !== "
|
|
72572
|
+
(workspace) => workspace.leaderboard_metric_kind !== "cycle_time"
|
|
72533
72573
|
);
|
|
72534
|
-
const metricLabel = viewType === "machine" ? "Utilization" :
|
|
72574
|
+
const metricLabel = viewType === "machine" ? "Utilization" : hasCycleTimeLeaderboardRows && !hasEfficiencyLeaderboardRows ? "Actual CT / Standard CT" : hasCycleTimeLeaderboardRows && hasEfficiencyLeaderboardRows ? "Performance" : "Efficiency";
|
|
72535
72575
|
const descendingSortLabel = "Highest to Lowest";
|
|
72536
72576
|
const ascendingSortLabel = "Lowest to Highest";
|
|
72537
72577
|
return /* @__PURE__ */ jsxs("div", { className: `min-h-screen bg-slate-50 flex flex-col ${className}`, style: { willChange: "contents" }, children: [
|