@optifye/dashboard-core 6.12.21 → 6.12.23
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-Hl2PFMb3.d.mts → automation-C3vudVDH.d.mts} +8 -0
- package/dist/{automation-Hl2PFMb3.d.ts → automation-C3vudVDH.d.ts} +8 -0
- package/dist/automation.d.mts +1 -1
- package/dist/automation.d.ts +1 -1
- package/dist/automation.js +18 -7
- package/dist/automation.mjs +18 -7
- package/dist/index.css +83 -22
- package/dist/index.d.mts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +1047 -385
- package/dist/index.mjs +1048 -387
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { EventEmitter } from 'events';
|
|
|
10
10
|
import { createClient, REALTIME_SUBSCRIBE_STATES } from '@supabase/supabase-js';
|
|
11
11
|
import Hls, { Events, ErrorTypes } from 'hls.js';
|
|
12
12
|
import useSWR from 'swr';
|
|
13
|
-
import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check,
|
|
13
|
+
import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, Filter, X, Coffee, Plus, ArrowUp, ArrowDown, ArrowRight, CheckCircle2, ArrowLeft, Clock, Calendar, Save, AlertCircle, Loader2, Minus, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, XCircle, HelpCircle, Activity, Wrench, UserX, Package, RefreshCw, Palette, TrendingDown, FolderOpen, Folder, ArrowDownWideNarrow, Tag, Sliders, Layers, Search, Edit2, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Video, Copy, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Settings, LifeBuoy, EyeOff, Zap, Flame, Crown, Medal } from 'lucide-react';
|
|
14
14
|
import { memo, noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
|
|
15
15
|
import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Tooltip, Legend, Bar, LabelList, ResponsiveContainer, LineChart as LineChart$1, Line, Customized, Cell, PieChart, Pie, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
|
|
16
16
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -9904,7 +9904,8 @@ var LinesService = class {
|
|
|
9904
9904
|
line.video_grid_metric_mode,
|
|
9905
9905
|
line.assembly ?? false
|
|
9906
9906
|
),
|
|
9907
|
-
recentFlowWindowMinutes: line.recent_flow_window_minutes ?? 7
|
|
9907
|
+
recentFlowWindowMinutes: line.recent_flow_window_minutes ?? 7,
|
|
9908
|
+
factoryAreaId: line.factory_area_id ?? null
|
|
9908
9909
|
}));
|
|
9909
9910
|
} catch (error) {
|
|
9910
9911
|
console.error("Error fetching lines:", error);
|
|
@@ -9963,7 +9964,8 @@ var LinesService = class {
|
|
|
9963
9964
|
line.video_grid_metric_mode,
|
|
9964
9965
|
line.assembly ?? false
|
|
9965
9966
|
),
|
|
9966
|
-
recentFlowWindowMinutes: line.recent_flow_window_minutes ?? 7
|
|
9967
|
+
recentFlowWindowMinutes: line.recent_flow_window_minutes ?? 7,
|
|
9968
|
+
factoryAreaId: line.factory_area_id ?? null
|
|
9967
9969
|
}));
|
|
9968
9970
|
} catch (error) {
|
|
9969
9971
|
console.error("Error fetching all lines:", error);
|
|
@@ -10030,7 +10032,8 @@ var LinesService = class {
|
|
|
10030
10032
|
data.video_grid_metric_mode,
|
|
10031
10033
|
data.assembly ?? false
|
|
10032
10034
|
),
|
|
10033
|
-
recentFlowWindowMinutes: data.recent_flow_window_minutes ?? 7
|
|
10035
|
+
recentFlowWindowMinutes: data.recent_flow_window_minutes ?? 7,
|
|
10036
|
+
factoryAreaId: data.factory_area_id ?? null
|
|
10034
10037
|
};
|
|
10035
10038
|
} catch (error) {
|
|
10036
10039
|
console.error("Error fetching line:", error);
|
|
@@ -11644,6 +11647,9 @@ var lineLeaderboardService = {
|
|
|
11644
11647
|
if (typeof params.limit === "number") {
|
|
11645
11648
|
searchParams.set("limit", params.limit.toString());
|
|
11646
11649
|
}
|
|
11650
|
+
if (params.includeBelowThreshold) {
|
|
11651
|
+
searchParams.set("include_below_threshold", "true");
|
|
11652
|
+
}
|
|
11647
11653
|
const data = await fetchBackendJson(
|
|
11648
11654
|
supabase,
|
|
11649
11655
|
`/api/dashboard/line-leaderboard-daily?${searchParams.toString()}`
|
|
@@ -14668,11 +14674,22 @@ var transformMonitorWorkspaceMetrics = ({
|
|
|
14668
14674
|
actionType: item.action_type,
|
|
14669
14675
|
actionName: item.action_name
|
|
14670
14676
|
}),
|
|
14677
|
+
factory_area_id: item.factory_area_id ?? null,
|
|
14678
|
+
factory_area_key: item.factory_area_key ?? null,
|
|
14679
|
+
factory_area_name: item.factory_area_name ?? null,
|
|
14680
|
+
factory_area_enabled: item.factory_area_enabled ?? null,
|
|
14681
|
+
leaderboard_metric_kind: item.leaderboard_metric_kind ?? void 0,
|
|
14682
|
+
leaderboard_value: item.leaderboard_value ?? null,
|
|
14683
|
+
avg_recent_flow: item.avg_recent_flow ?? null,
|
|
14671
14684
|
recent_flow_percent: item.recent_flow_percent ?? null,
|
|
14672
14685
|
recent_flow_window_minutes: item.recent_flow_window_minutes ?? null,
|
|
14673
14686
|
recent_flow_effective_end_at: item.recent_flow_effective_end_at ?? null,
|
|
14674
14687
|
recent_flow_computed_at: item.recent_flow_computed_at ?? null,
|
|
14675
14688
|
recent_flow_forced_zero_after_shift: item.recent_flow_forced_zero_after_shift ?? null,
|
|
14689
|
+
video_grid_green_streak_active: item.video_grid_green_streak_active ?? null,
|
|
14690
|
+
video_grid_green_streak_minutes: item.video_grid_green_streak_minutes ?? null,
|
|
14691
|
+
video_grid_green_streak_anchor_at: item.video_grid_green_streak_anchor_at ?? null,
|
|
14692
|
+
video_grid_green_streak_started_at: item.video_grid_green_streak_started_at ?? null,
|
|
14676
14693
|
scheduled_break_active: item.scheduled_break_active ?? false,
|
|
14677
14694
|
incoming_wip_current: item.incoming_wip_current ?? null,
|
|
14678
14695
|
incoming_wip_effective_at: item.incoming_wip_effective_at ?? null,
|
|
@@ -14692,12 +14709,12 @@ var logDebug = (...args) => {
|
|
|
14692
14709
|
if (!DEBUG_DASHBOARD_LOGS) return;
|
|
14693
14710
|
console.log(...args);
|
|
14694
14711
|
};
|
|
14695
|
-
var buildMetricsScopeKey = (lineId, lineIds) => {
|
|
14712
|
+
var buildMetricsScopeKey = (lineId, lineIds, blueComparisonLineIds) => {
|
|
14696
14713
|
const normalizedLineIds = Array.from(new Set((lineIds || []).filter(Boolean))).sort();
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
return lineId
|
|
14714
|
+
const normalizedBlueComparisonLineIds = Array.from(new Set((blueComparisonLineIds || []).filter(Boolean))).sort();
|
|
14715
|
+
const lineKey = normalizedLineIds.length > 0 ? normalizedLineIds.join(",") : lineId;
|
|
14716
|
+
const comparisonKey = normalizedBlueComparisonLineIds.length > 0 ? normalizedBlueComparisonLineIds.join(",") : lineKey;
|
|
14717
|
+
return `${lineId}|${lineKey}|blue:${comparisonKey}`;
|
|
14701
14718
|
};
|
|
14702
14719
|
var parseEfficiencyLegend = (legend) => {
|
|
14703
14720
|
if (!legend) return null;
|
|
@@ -14719,6 +14736,7 @@ var useDashboardMetrics = ({
|
|
|
14719
14736
|
onLineMetricsUpdate,
|
|
14720
14737
|
lineId,
|
|
14721
14738
|
lineIds,
|
|
14739
|
+
blueComparisonLineIds,
|
|
14722
14740
|
userAccessibleLineIds,
|
|
14723
14741
|
enabled = true
|
|
14724
14742
|
}) => {
|
|
@@ -14741,6 +14759,10 @@ var useDashboardMetrics = ({
|
|
|
14741
14759
|
const sourceLineIds = lineIds !== void 0 ? lineIds : userAccessibleLineIds !== void 0 ? userAccessibleLineIds : configuredLineIds;
|
|
14742
14760
|
return Array.from(new Set((sourceLineIds || []).filter(Boolean)));
|
|
14743
14761
|
}, [lineIds, userAccessibleLineIds, configuredLineIds]);
|
|
14762
|
+
const normalizedBlueComparisonLineIds = useMemo(
|
|
14763
|
+
() => Array.from(new Set((blueComparisonLineIds || []).filter(Boolean))),
|
|
14764
|
+
[blueComparisonLineIds]
|
|
14765
|
+
);
|
|
14744
14766
|
const { shiftConfig: staticShiftConfig } = useDashboardConfig();
|
|
14745
14767
|
const {
|
|
14746
14768
|
shiftConfigMap: multiLineShiftConfigMap,
|
|
@@ -14778,7 +14800,7 @@ var useDashboardMetrics = ({
|
|
|
14778
14800
|
const supabase = useSupabase();
|
|
14779
14801
|
const [metrics2, setMetrics] = useState({ workspaceMetrics: [], lineMetrics: [] });
|
|
14780
14802
|
const [metricsLineId, setMetricsLineId] = useState(lineId ?? null);
|
|
14781
|
-
const [metricsScopeKey, setMetricsScopeKey] = useState(() => buildMetricsScopeKey(lineId, lineIds));
|
|
14803
|
+
const [metricsScopeKey, setMetricsScopeKey] = useState(() => buildMetricsScopeKey(lineId, lineIds, blueComparisonLineIds));
|
|
14782
14804
|
const [isLoading, setIsLoading] = useState(true);
|
|
14783
14805
|
const [error, setError] = useState(null);
|
|
14784
14806
|
const lineIdRef = useRef(lineId);
|
|
@@ -14820,8 +14842,12 @@ var useDashboardMetrics = ({
|
|
|
14820
14842
|
[entityConfig.companyId]
|
|
14821
14843
|
);
|
|
14822
14844
|
const requestedScopeKey = useMemo(
|
|
14823
|
-
() => buildMetricsScopeKey(
|
|
14824
|
-
|
|
14845
|
+
() => buildMetricsScopeKey(
|
|
14846
|
+
lineId,
|
|
14847
|
+
isFactoryView ? targetFactoryLineIds : void 0,
|
|
14848
|
+
normalizedBlueComparisonLineIds.length ? normalizedBlueComparisonLineIds : void 0
|
|
14849
|
+
),
|
|
14850
|
+
[isFactoryView, lineId, targetFactoryLineIds, normalizedBlueComparisonLineIds]
|
|
14825
14851
|
);
|
|
14826
14852
|
useEffect(() => {
|
|
14827
14853
|
lineIdRef.current = lineId;
|
|
@@ -14851,12 +14877,15 @@ var useDashboardMetrics = ({
|
|
|
14851
14877
|
const isFactory = currentLineIdToUse === factoryViewId;
|
|
14852
14878
|
const targetLineIds = isFactory ? targetFactoryLineIds : [currentLineIdToUse];
|
|
14853
14879
|
const targetLineIdsKey = targetLineIds.slice().sort().join(",");
|
|
14880
|
+
const effectiveBlueComparisonLineIds = normalizedBlueComparisonLineIds.length ? normalizedBlueComparisonLineIds : targetLineIds;
|
|
14881
|
+
const blueComparisonLineIdsKey = effectiveBlueComparisonLineIds.slice().sort().join(",");
|
|
14854
14882
|
const usesShiftGroups = isFactory && shiftGroups.length > 0;
|
|
14855
14883
|
const singleShiftDetails = usesShiftGroups ? null : shiftConfig ? getCurrentShift(defaultTimezone, shiftConfig) : shiftGroups.length === 1 ? { date: shiftGroups[0].date, shiftId: shiftGroups[0].shiftId } : getCurrentShift(defaultTimezone, staticShiftConfig);
|
|
14856
|
-
const fetchKey = usesShiftGroups ? `factory|${companyId || "unknown"}|${shiftGroupsKey}` : isFactory ? `factory|${companyId || "unknown"}|${singleShiftDetails?.date}|${singleShiftDetails?.shiftId}|${targetLineIdsKey}` : `${currentLineIdToUse}|${companyId || "unknown"}|${singleShiftDetails?.date}|${singleShiftDetails?.shiftId}`;
|
|
14884
|
+
const fetchKey = usesShiftGroups ? `factory|${companyId || "unknown"}|${shiftGroupsKey}|blue:${blueComparisonLineIdsKey}` : isFactory ? `factory|${companyId || "unknown"}|${singleShiftDetails?.date}|${singleShiftDetails?.shiftId}|${targetLineIdsKey}|blue:${blueComparisonLineIdsKey}` : `${currentLineIdToUse}|${companyId || "unknown"}|${singleShiftDetails?.date}|${singleShiftDetails?.shiftId}|blue:${blueComparisonLineIdsKey}`;
|
|
14857
14885
|
const responseScopeKey = buildMetricsScopeKey(
|
|
14858
14886
|
currentLineIdToUse,
|
|
14859
|
-
isFactory ? targetLineIds : void 0
|
|
14887
|
+
isFactory ? targetLineIds : void 0,
|
|
14888
|
+
normalizedBlueComparisonLineIds.length ? normalizedBlueComparisonLineIds : void 0
|
|
14860
14889
|
);
|
|
14861
14890
|
logDebug("[useDashboardMetrics] Fetch key details:", {
|
|
14862
14891
|
isFactory,
|
|
@@ -14886,6 +14915,7 @@ var useDashboardMetrics = ({
|
|
|
14886
14915
|
logDebug("[useDashboardMetrics] Skipping fetch: no target line IDs after scope filtering");
|
|
14887
14916
|
setMetrics({
|
|
14888
14917
|
workspaceMetrics: [],
|
|
14918
|
+
blueComparisonWorkspaceMetrics: [],
|
|
14889
14919
|
lineMetrics: [],
|
|
14890
14920
|
metadata: void 0,
|
|
14891
14921
|
efficiencyLegend: DEFAULT_EFFICIENCY_LEGEND
|
|
@@ -14896,6 +14926,7 @@ var useDashboardMetrics = ({
|
|
|
14896
14926
|
return;
|
|
14897
14927
|
}
|
|
14898
14928
|
let allWorkspaceMetrics = [];
|
|
14929
|
+
let allBlueComparisonWorkspaceMetrics = [];
|
|
14899
14930
|
let allLineMetrics = [];
|
|
14900
14931
|
let hasFlowBuffers = false;
|
|
14901
14932
|
let idleTimeVlmByLine = {};
|
|
@@ -14903,7 +14934,8 @@ var useDashboardMetrics = ({
|
|
|
14903
14934
|
const forceParam = force ? "&force_refresh=true" : "";
|
|
14904
14935
|
const buildMetricsEndpoint = (params) => {
|
|
14905
14936
|
const lineIdsParam = isFactory ? `line_ids=${params.groupLineIds.join(",")}` : `line_id=${params.groupLineIds[0]}`;
|
|
14906
|
-
|
|
14937
|
+
const blueComparisonParam = effectiveBlueComparisonLineIds.length ? `&blue_comparison_line_ids=${effectiveBlueComparisonLineIds.join(",")}` : "";
|
|
14938
|
+
return `/api/dashboard/metrics?${lineIdsParam}${blueComparisonParam}&date=${params.date}&shift_id=${params.shiftId}&company_id=${companyId}${forceParam}`;
|
|
14907
14939
|
};
|
|
14908
14940
|
if (usesShiftGroups) {
|
|
14909
14941
|
logDebug("[useDashboardMetrics] Factory view shift groups fetch:", {
|
|
@@ -14953,10 +14985,16 @@ var useDashboardMetrics = ({
|
|
|
14953
14985
|
if (result.workspace_metrics) {
|
|
14954
14986
|
allWorkspaceMetrics.push(...result.workspace_metrics);
|
|
14955
14987
|
}
|
|
14988
|
+
if (result.blue_comparison_workspace_metrics) {
|
|
14989
|
+
allBlueComparisonWorkspaceMetrics.push(...result.blue_comparison_workspace_metrics);
|
|
14990
|
+
}
|
|
14956
14991
|
if (result.line_metrics) {
|
|
14957
14992
|
allLineMetrics.push(...result.line_metrics);
|
|
14958
14993
|
}
|
|
14959
14994
|
});
|
|
14995
|
+
if (allBlueComparisonWorkspaceMetrics.length === 0) {
|
|
14996
|
+
allBlueComparisonWorkspaceMetrics = allWorkspaceMetrics;
|
|
14997
|
+
}
|
|
14960
14998
|
logDebug(`[useDashboardMetrics] \u{1F4CA} Merged metrics from ${results.length} shift groups:`, {
|
|
14961
14999
|
workspaceCount: allWorkspaceMetrics.length,
|
|
14962
15000
|
lineMetricsCount: allLineMetrics.length
|
|
@@ -14994,6 +15032,7 @@ var useDashboardMetrics = ({
|
|
|
14994
15032
|
lineCount: backendData.line_metrics?.length || 0
|
|
14995
15033
|
});
|
|
14996
15034
|
allWorkspaceMetrics = backendData.workspace_metrics || [];
|
|
15035
|
+
allBlueComparisonWorkspaceMetrics = backendData.blue_comparison_workspace_metrics || allWorkspaceMetrics;
|
|
14997
15036
|
allLineMetrics = backendData.line_metrics || [];
|
|
14998
15037
|
hasFlowBuffers = Boolean(backendData?.metadata?.has_flow_buffers);
|
|
14999
15038
|
if (backendData?.metadata?.idle_time_vlm_by_line && typeof backendData.metadata.idle_time_vlm_by_line === "object") {
|
|
@@ -15012,8 +15051,19 @@ var useDashboardMetrics = ({
|
|
|
15012
15051
|
shouldOverrideShiftType: (metricLineId) => isFactoryView ? Boolean(multiLineShiftConfigMap.get(metricLineId)) : Boolean(shiftConfig),
|
|
15013
15052
|
fallbackShiftConfig: staticShiftConfig
|
|
15014
15053
|
});
|
|
15054
|
+
const transformedBlueComparisonWorkspaceData = allBlueComparisonWorkspaceMetrics === allWorkspaceMetrics ? transformedWorkspaceData : transformMonitorWorkspaceMetrics({
|
|
15055
|
+
rows: allBlueComparisonWorkspaceMetrics,
|
|
15056
|
+
companyId: companyId || "",
|
|
15057
|
+
workspaceConfig: effectiveWorkspaceConfig,
|
|
15058
|
+
appTimezone: detailTimezone,
|
|
15059
|
+
lineMetrics: allLineMetrics,
|
|
15060
|
+
resolveShiftConfig: (metricLineId) => isFactoryView ? multiLineShiftConfigMap.get(metricLineId) || staticShiftConfig : shiftConfig || staticShiftConfig,
|
|
15061
|
+
shouldOverrideShiftType: (metricLineId) => isFactoryView ? Boolean(multiLineShiftConfigMap.get(metricLineId)) : Boolean(shiftConfig),
|
|
15062
|
+
fallbackShiftConfig: staticShiftConfig
|
|
15063
|
+
});
|
|
15015
15064
|
const newMetricsState = {
|
|
15016
15065
|
workspaceMetrics: transformedWorkspaceData,
|
|
15066
|
+
blueComparisonWorkspaceMetrics: transformedBlueComparisonWorkspaceData.length ? transformedBlueComparisonWorkspaceData : transformedWorkspaceData,
|
|
15017
15067
|
lineMetrics: allLineMetrics || [],
|
|
15018
15068
|
metadata: { hasFlowBuffers, idleTimeVlmByLine },
|
|
15019
15069
|
efficiencyLegend: efficiencyLegend ?? DEFAULT_EFFICIENCY_LEGEND
|
|
@@ -15084,6 +15134,7 @@ var useDashboardMetrics = ({
|
|
|
15084
15134
|
shiftGroupsKey,
|
|
15085
15135
|
configuredLineIds,
|
|
15086
15136
|
targetFactoryLineIds,
|
|
15137
|
+
normalizedBlueComparisonLineIds,
|
|
15087
15138
|
isFactoryView,
|
|
15088
15139
|
multiLineShiftConfigMap,
|
|
15089
15140
|
staticShiftConfig,
|
|
@@ -15524,9 +15575,10 @@ var useDashboardMetrics = ({
|
|
|
15524
15575
|
const isCurrentScopeResolved = metricsScopeKey === requestedScopeKey;
|
|
15525
15576
|
const hasLastGoodMetrics = metrics2.workspaceMetrics.length > 0 || metrics2.lineMetrics.length > 0;
|
|
15526
15577
|
const canReuseLastGoodMetrics = hasLastGoodMetrics && !isCurrentScopeResolved && (isLoading || !!error);
|
|
15527
|
-
const safeMetrics = isCurrentScopeResolved || canReuseLastGoodMetrics ? metrics2 : { workspaceMetrics: [], lineMetrics: [], metadata: void 0, efficiencyLegend: DEFAULT_EFFICIENCY_LEGEND };
|
|
15578
|
+
const safeMetrics = isCurrentScopeResolved || canReuseLastGoodMetrics ? metrics2 : { workspaceMetrics: [], blueComparisonWorkspaceMetrics: [], lineMetrics: [], metadata: void 0, efficiencyLegend: DEFAULT_EFFICIENCY_LEGEND };
|
|
15528
15579
|
return {
|
|
15529
15580
|
workspaceMetrics: safeMetrics?.workspaceMetrics || [],
|
|
15581
|
+
blueComparisonWorkspaceMetrics: safeMetrics?.blueComparisonWorkspaceMetrics || safeMetrics?.workspaceMetrics || [],
|
|
15530
15582
|
lineMetrics: safeMetrics?.lineMetrics || [],
|
|
15531
15583
|
efficiencyLegend: safeMetrics?.efficiencyLegend || DEFAULT_EFFICIENCY_LEGEND,
|
|
15532
15584
|
metadata: safeMetrics?.metadata,
|
|
@@ -22144,6 +22196,77 @@ var buildKpiLineHierarchy = (lines) => {
|
|
|
22144
22196
|
};
|
|
22145
22197
|
};
|
|
22146
22198
|
|
|
22199
|
+
// src/lib/utils/leaderboardGrouping.ts
|
|
22200
|
+
var isFiniteNumber2 = (value) => typeof value === "number" && Number.isFinite(value);
|
|
22201
|
+
var getEnabledFactoryArea = (line) => {
|
|
22202
|
+
if (!line.factory_area_id) return null;
|
|
22203
|
+
if (line.factory_area_enabled !== true) return null;
|
|
22204
|
+
const areaName = line.factory_area_name?.trim();
|
|
22205
|
+
if (!areaName) return null;
|
|
22206
|
+
return { id: line.factory_area_id, name: areaName };
|
|
22207
|
+
};
|
|
22208
|
+
var getLineEfficiency = (lineId, efficiencyByLineId, isLoading) => {
|
|
22209
|
+
if (efficiencyByLineId.has(lineId)) {
|
|
22210
|
+
const value = efficiencyByLineId.get(lineId);
|
|
22211
|
+
return isFiniteNumber2(value) ? value : null;
|
|
22212
|
+
}
|
|
22213
|
+
if (isLoading) return null;
|
|
22214
|
+
return 0;
|
|
22215
|
+
};
|
|
22216
|
+
var buildLineLeaderboardRows = ({
|
|
22217
|
+
lines,
|
|
22218
|
+
efficiencyByLineId,
|
|
22219
|
+
fallbackEfficiencyByLineId,
|
|
22220
|
+
isLoading
|
|
22221
|
+
}) => {
|
|
22222
|
+
const rows = [];
|
|
22223
|
+
const areaGroups = /* @__PURE__ */ new Map();
|
|
22224
|
+
lines.forEach((line) => {
|
|
22225
|
+
const area = getEnabledFactoryArea(line);
|
|
22226
|
+
if (!area) {
|
|
22227
|
+
const efficiency = getLineEfficiency(line.id, efficiencyByLineId, isLoading);
|
|
22228
|
+
rows.push({
|
|
22229
|
+
rowType: "line",
|
|
22230
|
+
id: line.id,
|
|
22231
|
+
displayName: line.line_name,
|
|
22232
|
+
line,
|
|
22233
|
+
lines: [line],
|
|
22234
|
+
efficiency,
|
|
22235
|
+
sortValue: isFiniteNumber2(efficiency) ? efficiency : -1
|
|
22236
|
+
});
|
|
22237
|
+
return;
|
|
22238
|
+
}
|
|
22239
|
+
const group = areaGroups.get(area.id);
|
|
22240
|
+
if (group) {
|
|
22241
|
+
group.lines.push(line);
|
|
22242
|
+
return;
|
|
22243
|
+
}
|
|
22244
|
+
areaGroups.set(area.id, {
|
|
22245
|
+
areaId: area.id,
|
|
22246
|
+
areaName: area.name,
|
|
22247
|
+
lines: [line]
|
|
22248
|
+
});
|
|
22249
|
+
});
|
|
22250
|
+
areaGroups.forEach((group) => {
|
|
22251
|
+
const validEfficiencies = group.lines.map((line) => efficiencyByLineId.get(line.id)).filter(isFiniteNumber2);
|
|
22252
|
+
const fallbackEfficiencies = validEfficiencies.length === 0 ? group.lines.map((line) => fallbackEfficiencyByLineId?.get(line.id)).filter(isFiniteNumber2) : [];
|
|
22253
|
+
const efficiencyValues = validEfficiencies.length > 0 ? validEfficiencies : fallbackEfficiencies;
|
|
22254
|
+
const shouldRenderZeroFallback = efficiencyValues.length === 0 && !!fallbackEfficiencyByLineId && !isLoading;
|
|
22255
|
+
if (efficiencyValues.length === 0 && !shouldRenderZeroFallback) return;
|
|
22256
|
+
const efficiency = shouldRenderZeroFallback ? 0 : efficiencyValues.reduce((sum, value) => sum + value, 0) / efficiencyValues.length;
|
|
22257
|
+
rows.push({
|
|
22258
|
+
rowType: "area",
|
|
22259
|
+
id: `area:${group.areaId}`,
|
|
22260
|
+
displayName: group.areaName,
|
|
22261
|
+
areaId: group.areaId,
|
|
22262
|
+
lines: group.lines,
|
|
22263
|
+
efficiency,
|
|
22264
|
+
sortValue: efficiency
|
|
22265
|
+
});
|
|
22266
|
+
});
|
|
22267
|
+
return rows.sort((left, right) => right.sortValue - left.sortValue).map((row, index) => ({ ...row, rank: index + 1 }));
|
|
22268
|
+
};
|
|
22269
|
+
|
|
22147
22270
|
// src/lib/utils/awards.ts
|
|
22148
22271
|
var toNumber2 = (value) => {
|
|
22149
22272
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -37430,7 +37553,58 @@ HourlyOutputChart.displayName = "HourlyOutputChart";
|
|
|
37430
37553
|
// src/components/dashboard/grid/videoGridMetricUtils.ts
|
|
37431
37554
|
var VIDEO_GRID_LEGEND_LABEL = "Real-Time efficiency";
|
|
37432
37555
|
var MAP_GRID_LEGEND_LABEL = "Efficiency";
|
|
37433
|
-
var
|
|
37556
|
+
var GREEN_STREAK_FRESHNESS_GRACE_MS = 2 * 60 * 1e3;
|
|
37557
|
+
var CONFIRMED_MINUTE_DURATION_MS = 60 * 1e3;
|
|
37558
|
+
var RECENT_FLOW_COMPUTED_FRESHNESS_MS = 120 * 1e3;
|
|
37559
|
+
var isFiniteNumber3 = (value) => typeof value === "number" && Number.isFinite(value);
|
|
37560
|
+
var padTwoDigits = (value) => String(value).padStart(2, "0");
|
|
37561
|
+
var parseTimestampMs = (value) => {
|
|
37562
|
+
if (!value) {
|
|
37563
|
+
return Number.NaN;
|
|
37564
|
+
}
|
|
37565
|
+
const timestampMs = Date.parse(value);
|
|
37566
|
+
return Number.isFinite(timestampMs) ? timestampMs : Number.NaN;
|
|
37567
|
+
};
|
|
37568
|
+
var isAllGreenStreakFresh = (workspace, anchorAtMs, nowMs2) => {
|
|
37569
|
+
const computedAt = workspace.recent_flow_computed_at;
|
|
37570
|
+
if (typeof computedAt === "string" && computedAt.trim()) {
|
|
37571
|
+
const computedAtMs = parseTimestampMs(computedAt);
|
|
37572
|
+
return Number.isFinite(computedAtMs) && nowMs2 - computedAtMs <= RECENT_FLOW_COMPUTED_FRESHNESS_MS;
|
|
37573
|
+
}
|
|
37574
|
+
return Number.isFinite(anchorAtMs) && nowMs2 <= anchorAtMs + CONFIRMED_MINUTE_DURATION_MS + GREEN_STREAK_FRESHNESS_GRACE_MS;
|
|
37575
|
+
};
|
|
37576
|
+
var formatAllGreenStreakDuration = (elapsedSeconds) => {
|
|
37577
|
+
const safeElapsedSeconds = Math.max(0, Math.floor(elapsedSeconds));
|
|
37578
|
+
const hours = Math.floor(safeElapsedSeconds / 3600);
|
|
37579
|
+
const minutes = Math.floor(safeElapsedSeconds % 3600 / 60);
|
|
37580
|
+
const seconds = safeElapsedSeconds % 60;
|
|
37581
|
+
if (hours > 0) {
|
|
37582
|
+
return `${hours}h ${padTwoDigits(minutes)}m ${padTwoDigits(seconds)}s`;
|
|
37583
|
+
}
|
|
37584
|
+
if (minutes > 0) {
|
|
37585
|
+
return `${minutes}m ${padTwoDigits(seconds)}s`;
|
|
37586
|
+
}
|
|
37587
|
+
return `${seconds}s`;
|
|
37588
|
+
};
|
|
37589
|
+
var getAllGreenStreakMilestone = (elapsedSeconds) => {
|
|
37590
|
+
const safeElapsedSeconds = Math.max(0, Math.floor(elapsedSeconds));
|
|
37591
|
+
const thirtyMinutesSeconds = 30 * 60;
|
|
37592
|
+
const oneHourSeconds = 60 * 60;
|
|
37593
|
+
if (safeElapsedSeconds < thirtyMinutesSeconds) {
|
|
37594
|
+
return null;
|
|
37595
|
+
}
|
|
37596
|
+
if (safeElapsedSeconds < oneHourSeconds) {
|
|
37597
|
+
return {
|
|
37598
|
+
milestoneSeconds: thirtyMinutesSeconds,
|
|
37599
|
+
headline: "30 min"
|
|
37600
|
+
};
|
|
37601
|
+
}
|
|
37602
|
+
const hours = Math.floor(safeElapsedSeconds / oneHourSeconds);
|
|
37603
|
+
return {
|
|
37604
|
+
milestoneSeconds: hours * oneHourSeconds,
|
|
37605
|
+
headline: `${hours * 60} min`
|
|
37606
|
+
};
|
|
37607
|
+
};
|
|
37434
37608
|
var isVideoGridRecentFlowEnabled = (workspace) => isRecentFlowVideoGridMetricMode(
|
|
37435
37609
|
workspace.video_grid_metric_mode,
|
|
37436
37610
|
workspace.assembly_enabled === true
|
|
@@ -37439,11 +37613,11 @@ var isVideoGridWipGated = (workspace) => isWipGatedVideoGridMetricMode(
|
|
|
37439
37613
|
workspace.video_grid_metric_mode,
|
|
37440
37614
|
workspace.assembly_enabled === true
|
|
37441
37615
|
);
|
|
37442
|
-
var hasVideoGridRecentFlow = (workspace) => isVideoGridRecentFlowEnabled(workspace) &&
|
|
37616
|
+
var hasVideoGridRecentFlow = (workspace) => isVideoGridRecentFlowEnabled(workspace) && isFiniteNumber3(workspace.recent_flow_percent);
|
|
37443
37617
|
var isVideoGridRecentFlowUnavailable = (workspace) => isVideoGridRecentFlowEnabled(workspace) && !hasVideoGridRecentFlow(workspace);
|
|
37444
37618
|
var getRawVideoGridMetricValue = (workspace) => {
|
|
37445
37619
|
const recentFlowPercent = workspace.recent_flow_percent;
|
|
37446
|
-
if (hasVideoGridRecentFlow(workspace) &&
|
|
37620
|
+
if (hasVideoGridRecentFlow(workspace) && isFiniteNumber3(recentFlowPercent)) {
|
|
37447
37621
|
return recentFlowPercent;
|
|
37448
37622
|
}
|
|
37449
37623
|
if (isVideoGridRecentFlowUnavailable(workspace)) {
|
|
@@ -37452,9 +37626,63 @@ var getRawVideoGridMetricValue = (workspace) => {
|
|
|
37452
37626
|
return workspace.efficiency;
|
|
37453
37627
|
};
|
|
37454
37628
|
var hasIncomingWipMapping = (workspace) => Boolean(workspace.incoming_wip_buffer_name);
|
|
37629
|
+
var getVideoGridWorkspaceKey = (workspace) => workspace.workspace_uuid || `${workspace.line_id || "unknown"}:${workspace.workspace_name || "unknown"}`;
|
|
37630
|
+
var getVideoGridBlueComparisonGroupKey = (workspace) => {
|
|
37631
|
+
const factoryAreaId = typeof workspace.factory_area_id === "string" ? workspace.factory_area_id.trim() : "";
|
|
37632
|
+
if (factoryAreaId && workspace.factory_area_enabled === true) {
|
|
37633
|
+
return `area:${factoryAreaId}`;
|
|
37634
|
+
}
|
|
37635
|
+
const lineId = typeof workspace.line_id === "string" ? workspace.line_id.trim() : "";
|
|
37636
|
+
return lineId ? `line:${lineId}` : null;
|
|
37637
|
+
};
|
|
37638
|
+
var isVideoGridBlueCandidate = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => hasVideoGridRecentFlow(workspace) && isFiniteNumber3(workspace.recent_flow_percent) && workspace.recent_flow_percent >= legend.green_min;
|
|
37639
|
+
var selectVideoGridBlueWinnerIds = (workspaces, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
37640
|
+
const candidatesByGroup = /* @__PURE__ */ new Map();
|
|
37641
|
+
for (const workspace of workspaces) {
|
|
37642
|
+
if (!isVideoGridBlueCandidate(workspace, legend)) {
|
|
37643
|
+
continue;
|
|
37644
|
+
}
|
|
37645
|
+
const groupKey = getVideoGridBlueComparisonGroupKey(workspace);
|
|
37646
|
+
if (!groupKey) {
|
|
37647
|
+
continue;
|
|
37648
|
+
}
|
|
37649
|
+
const candidates = candidatesByGroup.get(groupKey) || [];
|
|
37650
|
+
candidates.push(workspace);
|
|
37651
|
+
candidatesByGroup.set(groupKey, candidates);
|
|
37652
|
+
}
|
|
37653
|
+
const winners = /* @__PURE__ */ new Set();
|
|
37654
|
+
for (const candidates of candidatesByGroup.values()) {
|
|
37655
|
+
candidates.sort((left, right) => {
|
|
37656
|
+
const leftCurrent = left.recent_flow_percent;
|
|
37657
|
+
const rightCurrent = right.recent_flow_percent;
|
|
37658
|
+
if (rightCurrent !== leftCurrent) {
|
|
37659
|
+
return rightCurrent - leftCurrent;
|
|
37660
|
+
}
|
|
37661
|
+
const leftAverage = isFiniteNumber3(left.avg_recent_flow) ? left.avg_recent_flow : Number.NEGATIVE_INFINITY;
|
|
37662
|
+
const rightAverage = isFiniteNumber3(right.avg_recent_flow) ? right.avg_recent_flow : Number.NEGATIVE_INFINITY;
|
|
37663
|
+
if (rightAverage !== leftAverage) {
|
|
37664
|
+
return rightAverage - leftAverage;
|
|
37665
|
+
}
|
|
37666
|
+
const lineCompare = (left.line_id || "").localeCompare(right.line_id || "");
|
|
37667
|
+
if (lineCompare !== 0) {
|
|
37668
|
+
return lineCompare;
|
|
37669
|
+
}
|
|
37670
|
+
const nameCompare = (left.workspace_name || "").localeCompare(right.workspace_name || "");
|
|
37671
|
+
if (nameCompare !== 0) {
|
|
37672
|
+
return nameCompare;
|
|
37673
|
+
}
|
|
37674
|
+
return getVideoGridWorkspaceKey(left).localeCompare(getVideoGridWorkspaceKey(right));
|
|
37675
|
+
});
|
|
37676
|
+
const winner = candidates[0];
|
|
37677
|
+
if (winner) {
|
|
37678
|
+
winners.add(getVideoGridWorkspaceKey(winner));
|
|
37679
|
+
}
|
|
37680
|
+
}
|
|
37681
|
+
return winners;
|
|
37682
|
+
};
|
|
37455
37683
|
var getVideoGridBaseColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
37456
37684
|
const metricValue = getRawVideoGridMetricValue(workspace);
|
|
37457
|
-
if (!
|
|
37685
|
+
if (!isFiniteNumber3(metricValue)) {
|
|
37458
37686
|
return "neutral";
|
|
37459
37687
|
}
|
|
37460
37688
|
return getEfficiencyColor(metricValue, legend);
|
|
@@ -37475,7 +37703,7 @@ var isLowWipGreenOverride = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
|
37475
37703
|
if (!hasIncomingWipMapping(workspace)) {
|
|
37476
37704
|
return false;
|
|
37477
37705
|
}
|
|
37478
|
-
return
|
|
37706
|
+
return isFiniteNumber3(workspace.incoming_wip_current) && workspace.incoming_wip_current <= 1;
|
|
37479
37707
|
};
|
|
37480
37708
|
var isHighEfficiencyRedFlowOverride = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
37481
37709
|
if (workspace.scheduled_break_active === true) {
|
|
@@ -37493,7 +37721,7 @@ var isHighEfficiencyRedFlowOverride = (workspace, legend = DEFAULT_EFFICIENCY_LE
|
|
|
37493
37721
|
if (getVideoGridBaseColorState(workspace, legend) !== "red") {
|
|
37494
37722
|
return false;
|
|
37495
37723
|
}
|
|
37496
|
-
return
|
|
37724
|
+
return isFiniteNumber3(workspace.efficiency) && workspace.efficiency > 100;
|
|
37497
37725
|
};
|
|
37498
37726
|
var getVideoGridMetricValue = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => isHighEfficiencyRedFlowOverride(workspace, legend) ? workspace.efficiency : getRawVideoGridMetricValue(workspace);
|
|
37499
37727
|
var toMinuteBucket = (minuteBucket) => Number.isFinite(minuteBucket) ? Math.floor(minuteBucket) : Math.floor(Date.now() / 6e4);
|
|
@@ -37522,7 +37750,10 @@ var getSyntheticLowWipDisplayValue = (workspace, minuteBucket) => {
|
|
|
37522
37750
|
return 100 + offset;
|
|
37523
37751
|
};
|
|
37524
37752
|
var getVideoGridDisplayValue = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND, minuteBucket) => isLowWipGreenOverride(workspace, legend) ? getSyntheticLowWipDisplayValue(workspace, minuteBucket) : getVideoGridMetricValue(workspace, legend);
|
|
37525
|
-
var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
37753
|
+
var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND, blueWinnerIds) => {
|
|
37754
|
+
if (blueWinnerIds?.has(getVideoGridWorkspaceKey(workspace)) && isVideoGridBlueCandidate(workspace, legend)) {
|
|
37755
|
+
return "blue";
|
|
37756
|
+
}
|
|
37526
37757
|
const baseColor = getVideoGridBaseColorState(workspace, legend);
|
|
37527
37758
|
if (!hasVideoGridRecentFlow(workspace)) {
|
|
37528
37759
|
return baseColor;
|
|
@@ -37542,11 +37773,56 @@ var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) =>
|
|
|
37542
37773
|
if (!hasIncomingWipMapping(workspace)) {
|
|
37543
37774
|
return baseColor;
|
|
37544
37775
|
}
|
|
37545
|
-
if (!
|
|
37776
|
+
if (!isFiniteNumber3(workspace.incoming_wip_current)) {
|
|
37546
37777
|
return "neutral";
|
|
37547
37778
|
}
|
|
37548
37779
|
return baseColor;
|
|
37549
37780
|
};
|
|
37781
|
+
var hasAllVideoGridWorkspacesGreen = (workspaces, legend = DEFAULT_EFFICIENCY_LEGEND) => {
|
|
37782
|
+
const visibleWorkspaces = workspaces.filter((workspace) => Boolean(workspace.workspace_uuid || workspace.workspace_name));
|
|
37783
|
+
return visibleWorkspaces.length > 0 && visibleWorkspaces.every((workspace) => getVideoGridColorState(workspace, legend) === "green");
|
|
37784
|
+
};
|
|
37785
|
+
var getAllVideoGridGreenStreakDisplay = (workspaces, legend = DEFAULT_EFFICIENCY_LEGEND, nowMs2 = Date.now()) => {
|
|
37786
|
+
const visibleWorkspaces = workspaces.filter((workspace) => Boolean(workspace.workspace_uuid || workspace.workspace_name));
|
|
37787
|
+
if (visibleWorkspaces.length === 0 || !hasAllVideoGridWorkspacesGreen(visibleWorkspaces, legend)) {
|
|
37788
|
+
return null;
|
|
37789
|
+
}
|
|
37790
|
+
const activeStreaks = visibleWorkspaces.map((workspace) => {
|
|
37791
|
+
const startedAt = workspace.video_grid_green_streak_started_at;
|
|
37792
|
+
const anchorAt = workspace.video_grid_green_streak_anchor_at;
|
|
37793
|
+
const streakMinutes = workspace.video_grid_green_streak_minutes;
|
|
37794
|
+
const computedAt = workspace.recent_flow_computed_at;
|
|
37795
|
+
const startedAtMs = parseTimestampMs(startedAt);
|
|
37796
|
+
const anchorAtMs = parseTimestampMs(anchorAt);
|
|
37797
|
+
const computedAtMs = typeof computedAt === "string" && computedAt.trim() ? parseTimestampMs(computedAt) : Number.NaN;
|
|
37798
|
+
const isFresh = isAllGreenStreakFresh(workspace, anchorAtMs, nowMs2);
|
|
37799
|
+
const tickOriginAtMs = Number.isFinite(computedAtMs) ? computedAtMs : anchorAtMs + CONFIRMED_MINUTE_DURATION_MS;
|
|
37800
|
+
if (workspace.video_grid_green_streak_active === true && isFiniteNumber3(streakMinutes) && streakMinutes > 0 && startedAt && anchorAt && Number.isFinite(startedAtMs) && isFresh) {
|
|
37801
|
+
return {
|
|
37802
|
+
startedAt,
|
|
37803
|
+
startedAtMs,
|
|
37804
|
+
anchorAt,
|
|
37805
|
+
streakMinutes,
|
|
37806
|
+
tickOriginAtMs
|
|
37807
|
+
};
|
|
37808
|
+
}
|
|
37809
|
+
return null;
|
|
37810
|
+
});
|
|
37811
|
+
if (activeStreaks.some((streak) => streak === null)) {
|
|
37812
|
+
return null;
|
|
37813
|
+
}
|
|
37814
|
+
const strictestStartedAt = activeStreaks.reduce((latest, current) => current.streakMinutes < latest.streakMinutes || current.streakMinutes === latest.streakMinutes && current.startedAtMs > latest.startedAtMs ? current : latest);
|
|
37815
|
+
const confirmedSeconds = Math.max(0, Math.floor(strictestStartedAt.streakMinutes * 60));
|
|
37816
|
+
return {
|
|
37817
|
+
label: "All green",
|
|
37818
|
+
elapsedSeconds: confirmedSeconds,
|
|
37819
|
+
confirmedSeconds,
|
|
37820
|
+
durationText: formatAllGreenStreakDuration(confirmedSeconds),
|
|
37821
|
+
startedAt: strictestStartedAt.startedAt,
|
|
37822
|
+
anchorAt: strictestStartedAt.anchorAt,
|
|
37823
|
+
tickOriginAtMs: strictestStartedAt.tickOriginAtMs
|
|
37824
|
+
};
|
|
37825
|
+
};
|
|
37550
37826
|
var getVideoGridLegendLabel = (workspaces) => {
|
|
37551
37827
|
const visibleWorkspaces = workspaces;
|
|
37552
37828
|
if (visibleWorkspaces.length === 0) {
|
|
@@ -37577,6 +37853,7 @@ var VideoCard = React144__default.memo(({
|
|
|
37577
37853
|
compact = false,
|
|
37578
37854
|
displayMinuteBucket,
|
|
37579
37855
|
displayName,
|
|
37856
|
+
isBlueBest = false,
|
|
37580
37857
|
lastSeenLabel,
|
|
37581
37858
|
hasRecentHealthSignal: hasRecentHealthSignal2 = false,
|
|
37582
37859
|
onMouseEnter,
|
|
@@ -37598,7 +37875,11 @@ var VideoCard = React144__default.memo(({
|
|
|
37598
37875
|
const workspaceDisplayName = displayName || workspace.displayName || workspace.workspace_name;
|
|
37599
37876
|
const videoGridMetricValue = getVideoGridMetricValue(workspace, effectiveLegend);
|
|
37600
37877
|
const videoGridDisplayValue = getVideoGridDisplayValue(workspace, effectiveLegend, displayMinuteBucket);
|
|
37601
|
-
const videoGridColorState = getVideoGridColorState(
|
|
37878
|
+
const videoGridColorState = getVideoGridColorState(
|
|
37879
|
+
workspace,
|
|
37880
|
+
effectiveLegend,
|
|
37881
|
+
isBlueBest ? /* @__PURE__ */ new Set([getVideoGridWorkspaceKey(workspace)]) : void 0
|
|
37882
|
+
);
|
|
37602
37883
|
const isRecentFlowCard = isVideoGridRecentFlowEnabled(workspace);
|
|
37603
37884
|
const isHighEfficiencyOverride = isHighEfficiencyRedFlowOverride(workspace, effectiveLegend);
|
|
37604
37885
|
const hasDisplayMetric = typeof videoGridDisplayValue === "number" && Number.isFinite(videoGridDisplayValue);
|
|
@@ -37606,9 +37887,9 @@ var VideoCard = React144__default.memo(({
|
|
|
37606
37887
|
const shouldRenderMetricBadge = hasDisplayMetric;
|
|
37607
37888
|
const badgeTitle = isHighEfficiencyOverride ? `Efficiency ${Math.round(videoGridDisplayValue ?? 0)}%` : hasVideoGridRecentFlow(workspace) ? `Flow ${Math.round(videoGridDisplayValue ?? 0)}%` : isRecentFlowCard ? "Flow unavailable" : `Efficiency ${Math.round(videoGridDisplayValue ?? 0)}%`;
|
|
37608
37889
|
const badgeLabel = `${Math.round(videoGridDisplayValue ?? 0)}%`;
|
|
37609
|
-
const efficiencyOverlayClass = videoGridColorState === "green" ? "bg-[#00D654]/25" : videoGridColorState === "yellow" ? "bg-[#FFD700]/30" : videoGridColorState === "red" ? "bg-[#FF2D0A]/30" : "bg-transparent";
|
|
37610
|
-
const efficiencyBarClass = videoGridColorState === "green" ? "bg-[#00AB45]" : videoGridColorState === "yellow" ? "bg-[#FFB020]" : videoGridColorState === "red" ? "bg-[#E34329]" : "bg-gray-500/70";
|
|
37611
|
-
const efficiencyStatus = videoGridColorState === "green" ? "High" : videoGridColorState === "yellow" ? "Medium" : videoGridColorState === "red" ? "Low" : "Neutral";
|
|
37890
|
+
const efficiencyOverlayClass = videoGridColorState === "green" ? "bg-[#00D654]/25" : videoGridColorState === "blue" ? "bg-[#0EA5E9]/30" : videoGridColorState === "yellow" ? "bg-[#FFD700]/30" : videoGridColorState === "red" ? "bg-[#FF2D0A]/30" : "bg-transparent";
|
|
37891
|
+
const efficiencyBarClass = videoGridColorState === "green" ? "bg-[#00AB45]" : videoGridColorState === "blue" ? "bg-[#0EA5E9]" : videoGridColorState === "yellow" ? "bg-[#FFB020]" : videoGridColorState === "red" ? "bg-[#E34329]" : "bg-gray-500/70";
|
|
37892
|
+
const efficiencyStatus = videoGridColorState === "green" ? "High" : videoGridColorState === "blue" ? "Best" : videoGridColorState === "yellow" ? "Medium" : videoGridColorState === "red" ? "Low" : "Neutral";
|
|
37612
37893
|
const trendInfo = workspace.trend !== void 0 ? getTrendArrowAndColor(workspace.trend) : null;
|
|
37613
37894
|
const handleClick = useCallback(() => {
|
|
37614
37895
|
trackCoreEvent("Workspace Card Clicked", {
|
|
@@ -37729,6 +38010,9 @@ var VideoCard = React144__default.memo(({
|
|
|
37729
38010
|
if (prevProps.displayName !== nextProps.displayName) {
|
|
37730
38011
|
return false;
|
|
37731
38012
|
}
|
|
38013
|
+
if (prevProps.isBlueBest !== nextProps.isBlueBest) {
|
|
38014
|
+
return false;
|
|
38015
|
+
}
|
|
37732
38016
|
if (prevProps.lastSeenLabel !== nextProps.lastSeenLabel) {
|
|
37733
38017
|
return false;
|
|
37734
38018
|
}
|
|
@@ -37770,6 +38054,7 @@ var hasRecentHealthSignal = (lastHeartbeat) => {
|
|
|
37770
38054
|
};
|
|
37771
38055
|
var VideoGridView = React144__default.memo(({
|
|
37772
38056
|
workspaces,
|
|
38057
|
+
blueComparisonWorkspaces,
|
|
37773
38058
|
selectedLine,
|
|
37774
38059
|
className = "",
|
|
37775
38060
|
legend,
|
|
@@ -37898,6 +38183,7 @@ var VideoGridView = React144__default.memo(({
|
|
|
37898
38183
|
return a.workspace_name.localeCompare(b.workspace_name);
|
|
37899
38184
|
});
|
|
37900
38185
|
}, [filteredWorkspaces]);
|
|
38186
|
+
const blueWinnerIds = useMemo(() => selectVideoGridBlueWinnerIds(blueComparisonWorkspaces || sortedWorkspaces, effectiveLegend), [blueComparisonWorkspaces, sortedWorkspaces, effectiveLegend]);
|
|
37901
38187
|
const streamsResolvedForWorkspaceSet = resolvedStreamWorkspaceKey === workspaceIdsKey;
|
|
37902
38188
|
const resolveWorkspaceDisplayName = useCallback((workspace) => {
|
|
37903
38189
|
return workspace.displayName || displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || workspace.workspace_name;
|
|
@@ -38106,11 +38392,13 @@ var VideoGridView = React144__default.memo(({
|
|
|
38106
38392
|
isR2Stream,
|
|
38107
38393
|
shouldPlay,
|
|
38108
38394
|
lastSeenLabel,
|
|
38109
|
-
hasRecentHealthSignal: hasRecentHealthSignal(workspaceHealth?.lastHeartbeat)
|
|
38395
|
+
hasRecentHealthSignal: hasRecentHealthSignal(workspaceHealth?.lastHeartbeat),
|
|
38396
|
+
isBlueBest: blueWinnerIds.has(getVideoGridWorkspaceKey(workspace))
|
|
38110
38397
|
};
|
|
38111
38398
|
});
|
|
38112
38399
|
}, [
|
|
38113
38400
|
sortedWorkspaces,
|
|
38401
|
+
blueWinnerIds,
|
|
38114
38402
|
visibleWorkspaces,
|
|
38115
38403
|
getWorkspaceCropping,
|
|
38116
38404
|
videoStreamsByWorkspaceId,
|
|
@@ -38157,6 +38445,7 @@ var VideoGridView = React144__default.memo(({
|
|
|
38157
38445
|
useRAF: effectiveUseRAF,
|
|
38158
38446
|
displayMinuteBucket,
|
|
38159
38447
|
compact: !selectedLine,
|
|
38448
|
+
isBlueBest: card.isBlueBest,
|
|
38160
38449
|
onMouseEnter: onWorkspaceHover ? () => onWorkspaceHover(card.workspaceId) : void 0,
|
|
38161
38450
|
onMouseLeave: onWorkspaceHoverEnd ? () => onWorkspaceHoverEnd(card.workspaceId) : void 0
|
|
38162
38451
|
}
|
|
@@ -39790,7 +40079,7 @@ var BreakNotificationPopup = ({
|
|
|
39790
40079
|
return null;
|
|
39791
40080
|
}
|
|
39792
40081
|
const currentBreak = visibleBreaks[currentIndex];
|
|
39793
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs("div", { className: `fixed right-4 top-24 z-
|
|
40082
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs("div", { className: `fixed right-4 top-24 z-[110] max-w-xs w-full ${className}`, children: [
|
|
39794
40083
|
visibleBreaks.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39795
40084
|
/* @__PURE__ */ jsx(
|
|
39796
40085
|
"div",
|
|
@@ -54714,6 +55003,10 @@ var Legend5 = ({
|
|
|
54714
55003
|
":"
|
|
54715
55004
|
] }),
|
|
54716
55005
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:gap-4", children: [
|
|
55006
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
55007
|
+
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 sm:w-2.5 sm:h-2.5 rounded-full bg-[#0EA5E9]" }),
|
|
55008
|
+
/* @__PURE__ */ jsx("span", { children: "Best" })
|
|
55009
|
+
] }),
|
|
54717
55010
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
54718
55011
|
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 sm:w-2.5 sm:h-2.5 rounded-full bg-[#00AB45]" }),
|
|
54719
55012
|
/* @__PURE__ */ jsx("span", { children: formatPercentRange(effectiveLegend.green_min, effectiveLegend.green_max) })
|
|
@@ -54832,6 +55125,7 @@ var WorkspaceGridItem = React144__default.memo(({
|
|
|
54832
55125
|
WorkspaceGridItem.displayName = "WorkspaceGridItem";
|
|
54833
55126
|
var WorkspaceGrid = React144__default.memo(({
|
|
54834
55127
|
workspaces,
|
|
55128
|
+
blueComparisonWorkspaces,
|
|
54835
55129
|
isPdfMode = false,
|
|
54836
55130
|
customWorkspacePositions,
|
|
54837
55131
|
lineNames = {},
|
|
@@ -54848,13 +55142,8 @@ var WorkspaceGrid = React144__default.memo(({
|
|
|
54848
55142
|
onWorkspaceHoverEnd,
|
|
54849
55143
|
toolbarRightContent
|
|
54850
55144
|
}) => {
|
|
54851
|
-
const
|
|
54852
|
-
const mapViewEnabled = dashboardConfig?.mapViewConfig?.enabled ?? false;
|
|
55145
|
+
const mapViewEnabled = false;
|
|
54853
55146
|
const [viewMode, setViewMode] = useState(() => {
|
|
54854
|
-
if (typeof window !== "undefined" && mapViewEnabled) {
|
|
54855
|
-
const saved = localStorage.getItem("home-view-mode");
|
|
54856
|
-
return saved === "map" || saved === "video" ? saved : "video";
|
|
54857
|
-
}
|
|
54858
55147
|
return "video";
|
|
54859
55148
|
});
|
|
54860
55149
|
useEffect(() => {
|
|
@@ -54863,7 +55152,7 @@ var WorkspaceGrid = React144__default.memo(({
|
|
|
54863
55152
|
total_workspaces: workspaces.length
|
|
54864
55153
|
});
|
|
54865
55154
|
}, [workspaces.length]);
|
|
54866
|
-
|
|
55155
|
+
useCallback(() => {
|
|
54867
55156
|
const newMode = viewMode === "video" ? "map" : "video";
|
|
54868
55157
|
setViewMode(newMode);
|
|
54869
55158
|
if (typeof window !== "undefined") {
|
|
@@ -54877,8 +55166,8 @@ var WorkspaceGrid = React144__default.memo(({
|
|
|
54877
55166
|
}, [viewMode]);
|
|
54878
55167
|
const { VideoGridView: VideoGridViewComponent, MapGridView: MapGridViewComponent } = useRegistry();
|
|
54879
55168
|
const legendMetricLabel = useMemo(
|
|
54880
|
-
() =>
|
|
54881
|
-
[
|
|
55169
|
+
() => getVideoGridLegendLabel(workspaces),
|
|
55170
|
+
[workspaces]
|
|
54882
55171
|
);
|
|
54883
55172
|
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col w-full h-full overflow-hidden bg-slate-50/50 ${className}`, children: [
|
|
54884
55173
|
/* @__PURE__ */ jsxs(
|
|
@@ -54890,21 +55179,7 @@ var WorkspaceGrid = React144__default.memo(({
|
|
|
54890
55179
|
/* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx("div", { className: "inline-flex bg-white/95 rounded-lg shadow-sm px-4 py-2 border border-slate-200/60 backdrop-blur-sm", children: /* @__PURE__ */ jsx(Legend5, { legend, metricLabel: legendMetricLabel }) }) }),
|
|
54891
55180
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-3 shrink-0", children: [
|
|
54892
55181
|
toolbarRightContent,
|
|
54893
|
-
mapViewEnabled
|
|
54894
|
-
"button",
|
|
54895
|
-
{
|
|
54896
|
-
onClick: handleViewModeToggle,
|
|
54897
|
-
className: "flex items-center gap-2 px-3 py-1.5 bg-white border border-slate-200 rounded-md shadow-sm hover:bg-slate-50 transition-colors duration-200 text-slate-700",
|
|
54898
|
-
title: viewMode === "video" ? "Switch to Map View" : "Switch to Video View",
|
|
54899
|
-
children: viewMode === "video" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54900
|
-
/* @__PURE__ */ jsx(Map$1, { className: "w-4 h-4 text-slate-500" }),
|
|
54901
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline text-sm font-medium", children: "Map View" })
|
|
54902
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54903
|
-
/* @__PURE__ */ jsx(Video, { className: "w-4 h-4 text-slate-500" }),
|
|
54904
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline text-sm font-medium", children: "Video View" })
|
|
54905
|
-
] })
|
|
54906
|
-
}
|
|
54907
|
-
)
|
|
55182
|
+
mapViewEnabled
|
|
54908
55183
|
] })
|
|
54909
55184
|
]
|
|
54910
55185
|
}
|
|
@@ -54922,6 +55197,7 @@ var WorkspaceGrid = React144__default.memo(({
|
|
|
54922
55197
|
VideoGridViewComponent,
|
|
54923
55198
|
{
|
|
54924
55199
|
workspaces,
|
|
55200
|
+
blueComparisonWorkspaces,
|
|
54925
55201
|
lineNames,
|
|
54926
55202
|
lineOrder,
|
|
54927
55203
|
videoSources,
|
|
@@ -57218,12 +57494,25 @@ var SideNavBar = memo$1(({
|
|
|
57218
57494
|
console.log("\u{1F50D} [SideNavBar] ticketsConfig:", dashboardConfig?.ticketsConfig);
|
|
57219
57495
|
console.log("\u{1F50D} [SideNavBar] ticketsEnabled:", ticketsEnabled);
|
|
57220
57496
|
const pathname = propPathname || router.pathname;
|
|
57497
|
+
const rawCurrentTabQuery = currentQuery?.tab ?? router.query?.tab;
|
|
57498
|
+
const currentTabQuery = Array.isArray(rawCurrentTabQuery) ? rawCurrentTabQuery[0] : rawCurrentTabQuery;
|
|
57499
|
+
const isKpisLeaderboardRoute = pathname === "/kpis" && currentTabQuery === "leaderboard";
|
|
57500
|
+
const isPathActive = useCallback((path) => {
|
|
57501
|
+
if (path === "/") return pathname === "/";
|
|
57502
|
+
if (path === "/leaderboard") {
|
|
57503
|
+
return pathname === "/leaderboard" || pathname.startsWith("/leaderboard/");
|
|
57504
|
+
}
|
|
57505
|
+
if (path === "/kpis") {
|
|
57506
|
+
return pathname === "/kpis" || pathname.startsWith("/kpis/");
|
|
57507
|
+
}
|
|
57508
|
+
return pathname === path || pathname.startsWith(path + "/");
|
|
57509
|
+
}, [pathname]);
|
|
57221
57510
|
const getButtonClasses = useCallback((path) => {
|
|
57222
|
-
const isActive =
|
|
57511
|
+
const isActive = isPathActive(path);
|
|
57223
57512
|
return `w-full flex flex-col items-center justify-center py-4 sm:py-3 px-2 sm:px-1 rounded-lg relative group min-h-[44px] sm:min-h-0
|
|
57224
57513
|
${isActive ? "bg-blue-50/80 text-blue-600 font-medium" : "hover:bg-gray-50 text-gray-500 hover:text-gray-700 font-medium active:bg-gray-100"}
|
|
57225
57514
|
transition-all duration-200 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2`;
|
|
57226
|
-
}, [
|
|
57515
|
+
}, [isPathActive]);
|
|
57227
57516
|
const buildDashboardSurfaceTrackingEvent = useCallback((source, destinationPath, dashboardSurface) => ({
|
|
57228
57517
|
name: ROOT_DASHBOARD_EVENT_NAMES[dashboardSurface],
|
|
57229
57518
|
properties: {
|
|
@@ -57256,17 +57545,24 @@ var SideNavBar = memo$1(({
|
|
|
57256
57545
|
onMobileMenuClose?.();
|
|
57257
57546
|
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent]);
|
|
57258
57547
|
const handleKPIsClick = useCallback(() => {
|
|
57259
|
-
|
|
57260
|
-
|
|
57261
|
-
|
|
57262
|
-
|
|
57263
|
-
|
|
57264
|
-
page_type: "overview"
|
|
57265
|
-
}
|
|
57548
|
+
const trackingEvent = {
|
|
57549
|
+
name: "KPI Page Clicked",
|
|
57550
|
+
properties: {
|
|
57551
|
+
source: "side_nav",
|
|
57552
|
+
page_type: "overview"
|
|
57266
57553
|
}
|
|
57554
|
+
};
|
|
57555
|
+
if (isKpisLeaderboardRoute) {
|
|
57556
|
+
trackCoreEvent(trackingEvent.name, trackingEvent.properties);
|
|
57557
|
+
void router.replace("/kpis", void 0, { shallow: false });
|
|
57558
|
+
onMobileMenuClose?.();
|
|
57559
|
+
return;
|
|
57560
|
+
}
|
|
57561
|
+
navigate(`/kpis`, {
|
|
57562
|
+
trackingEvent
|
|
57267
57563
|
});
|
|
57268
57564
|
onMobileMenuClose?.();
|
|
57269
|
-
}, [navigate, onMobileMenuClose]);
|
|
57565
|
+
}, [isKpisLeaderboardRoute, navigate, onMobileMenuClose, router]);
|
|
57270
57566
|
const handleImprovementClick = useCallback(() => {
|
|
57271
57567
|
navigate("/improvement-center", {
|
|
57272
57568
|
trackingEvent: {
|
|
@@ -57536,14 +57832,14 @@ var SideNavBar = memo$1(({
|
|
|
57536
57832
|
});
|
|
57537
57833
|
onMobileMenuClose?.();
|
|
57538
57834
|
}, [navigate, onMobileMenuClose, buildDashboardSurfaceTrackingEvent, rootDashboardSurface]);
|
|
57539
|
-
const homeButtonClasses = useMemo(() => getButtonClasses("/"), [getButtonClasses
|
|
57540
|
-
const liveButtonClasses = useMemo(() => getButtonClasses("/live-monitor"), [getButtonClasses
|
|
57541
|
-
const leaderboardButtonClasses = useMemo(() => getButtonClasses("/leaderboard"), [getButtonClasses
|
|
57542
|
-
const kpisButtonClasses = useMemo(() => getButtonClasses("/kpis"), [getButtonClasses
|
|
57543
|
-
const improvementButtonClasses = useMemo(() => getButtonClasses("/improvement-center"), [getButtonClasses
|
|
57544
|
-
useMemo(() => getButtonClasses("/supervisor-management"), [getButtonClasses
|
|
57545
|
-
const skusButtonClasses = useMemo(() => getButtonClasses("/skus"), [getButtonClasses
|
|
57546
|
-
const healthButtonClasses = useMemo(() => getButtonClasses("/health"), [getButtonClasses
|
|
57835
|
+
const homeButtonClasses = useMemo(() => getButtonClasses("/"), [getButtonClasses]);
|
|
57836
|
+
const liveButtonClasses = useMemo(() => getButtonClasses("/live-monitor"), [getButtonClasses]);
|
|
57837
|
+
const leaderboardButtonClasses = useMemo(() => getButtonClasses("/leaderboard"), [getButtonClasses]);
|
|
57838
|
+
const kpisButtonClasses = useMemo(() => getButtonClasses("/kpis"), [getButtonClasses]);
|
|
57839
|
+
const improvementButtonClasses = useMemo(() => getButtonClasses("/improvement-center"), [getButtonClasses]);
|
|
57840
|
+
useMemo(() => getButtonClasses("/supervisor-management"), [getButtonClasses]);
|
|
57841
|
+
const skusButtonClasses = useMemo(() => getButtonClasses("/skus"), [getButtonClasses]);
|
|
57842
|
+
const healthButtonClasses = useMemo(() => getButtonClasses("/health"), [getButtonClasses]);
|
|
57547
57843
|
const settingsButtonClasses = useMemo(() => {
|
|
57548
57844
|
const isAnyItemActive = settingsItems.some((item) => item.isActive);
|
|
57549
57845
|
const isActive = isSettingsOpen || isAnyItemActive;
|
|
@@ -57577,7 +57873,7 @@ var SideNavBar = memo$1(({
|
|
|
57577
57873
|
"aria-label": "Home",
|
|
57578
57874
|
tabIndex: 0,
|
|
57579
57875
|
role: "tab",
|
|
57580
|
-
"aria-selected":
|
|
57876
|
+
"aria-selected": isPathActive("/"),
|
|
57581
57877
|
children: [
|
|
57582
57878
|
/* @__PURE__ */ jsx(HomeIcon, { className: "w-5 h-5 mb-1" }),
|
|
57583
57879
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Home" })
|
|
@@ -57592,7 +57888,7 @@ var SideNavBar = memo$1(({
|
|
|
57592
57888
|
"aria-label": "Monitor",
|
|
57593
57889
|
tabIndex: 0,
|
|
57594
57890
|
role: "tab",
|
|
57595
|
-
"aria-selected":
|
|
57891
|
+
"aria-selected": isPathActive("/live-monitor"),
|
|
57596
57892
|
children: [
|
|
57597
57893
|
/* @__PURE__ */ jsx(VideoCameraIcon, { className: "w-5 h-5 mb-1" }),
|
|
57598
57894
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Monitor" })
|
|
@@ -57609,7 +57905,7 @@ var SideNavBar = memo$1(({
|
|
|
57609
57905
|
"aria-label": "Leaderboard",
|
|
57610
57906
|
tabIndex: 0,
|
|
57611
57907
|
role: "tab",
|
|
57612
|
-
"aria-selected":
|
|
57908
|
+
"aria-selected": isPathActive("/leaderboard"),
|
|
57613
57909
|
children: [
|
|
57614
57910
|
/* @__PURE__ */ jsx(TrophyIcon, { className: "w-5 h-5 mb-1" }),
|
|
57615
57911
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Leaders" })
|
|
@@ -57624,7 +57920,7 @@ var SideNavBar = memo$1(({
|
|
|
57624
57920
|
"aria-label": "Lines",
|
|
57625
57921
|
tabIndex: 0,
|
|
57626
57922
|
role: "tab",
|
|
57627
|
-
"aria-selected":
|
|
57923
|
+
"aria-selected": isPathActive("/kpis"),
|
|
57628
57924
|
children: [
|
|
57629
57925
|
/* @__PURE__ */ jsx(ChartBarIcon, { className: "w-5 h-5 mb-1" }),
|
|
57630
57926
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Lines" })
|
|
@@ -57639,7 +57935,7 @@ var SideNavBar = memo$1(({
|
|
|
57639
57935
|
"aria-label": "Improvement Center",
|
|
57640
57936
|
tabIndex: 0,
|
|
57641
57937
|
role: "tab",
|
|
57642
|
-
"aria-selected":
|
|
57938
|
+
"aria-selected": isPathActive("/improvement-center"),
|
|
57643
57939
|
children: [
|
|
57644
57940
|
/* @__PURE__ */ jsx(LightBulbIcon, { className: "w-5 h-5 mb-1" }),
|
|
57645
57941
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight text-center", children: "Improve" })
|
|
@@ -57655,7 +57951,7 @@ var SideNavBar = memo$1(({
|
|
|
57655
57951
|
"aria-label": "SKU Management",
|
|
57656
57952
|
tabIndex: 0,
|
|
57657
57953
|
role: "tab",
|
|
57658
|
-
"aria-selected":
|
|
57954
|
+
"aria-selected": isPathActive("/skus"),
|
|
57659
57955
|
children: [
|
|
57660
57956
|
/* @__PURE__ */ jsx(CubeIcon, { className: "w-5 h-5 mb-1" }),
|
|
57661
57957
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "SKUs" })
|
|
@@ -57670,7 +57966,7 @@ var SideNavBar = memo$1(({
|
|
|
57670
57966
|
"aria-label": "System Health",
|
|
57671
57967
|
tabIndex: 0,
|
|
57672
57968
|
role: "tab",
|
|
57673
|
-
"aria-selected":
|
|
57969
|
+
"aria-selected": isPathActive("/health"),
|
|
57674
57970
|
children: [
|
|
57675
57971
|
/* @__PURE__ */ jsx(HeartIcon, { className: "w-5 h-5 mb-1" }),
|
|
57676
57972
|
/* @__PURE__ */ jsx("span", { className: "text-xs sm:text-[10px] font-medium leading-tight", children: "Health" })
|
|
@@ -57700,17 +57996,12 @@ var SideNavBar = memo$1(({
|
|
|
57700
57996
|
) })
|
|
57701
57997
|
] });
|
|
57702
57998
|
const MobileNavigationContent = () => {
|
|
57703
|
-
const isActive = (path) => {
|
|
57704
|
-
if (path === "/" && pathname === "/") return true;
|
|
57705
|
-
if (path !== "/" && pathname.startsWith(path)) return true;
|
|
57706
|
-
return false;
|
|
57707
|
-
};
|
|
57708
57999
|
const getMobileButtonClass = (path) => {
|
|
57709
|
-
const active =
|
|
58000
|
+
const active = isPathActive(path);
|
|
57710
58001
|
return `w-full flex items-center gap-3 px-5 py-3.5 rounded-lg transition-colors active:scale-[0.98] ${active ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-100 active:bg-gray-200"}`;
|
|
57711
58002
|
};
|
|
57712
58003
|
const getIconClass = (path) => {
|
|
57713
|
-
const active =
|
|
58004
|
+
const active = isPathActive(path);
|
|
57714
58005
|
return `w-7 h-7 ${active ? "text-blue-600" : "text-gray-600"}`;
|
|
57715
58006
|
};
|
|
57716
58007
|
const handleMobileNavClick = (handler) => {
|
|
@@ -63667,6 +63958,7 @@ var createEmptyState = () => ({
|
|
|
63667
63958
|
scopeKey: null,
|
|
63668
63959
|
lines: [],
|
|
63669
63960
|
workspaceMetrics: [],
|
|
63961
|
+
blueComparisonWorkspaceMetrics: [],
|
|
63670
63962
|
lineMetrics: [],
|
|
63671
63963
|
kpiTrend: null,
|
|
63672
63964
|
activeBreaks: [],
|
|
@@ -63683,6 +63975,7 @@ var normalizeMetadata = (metadata) => ({
|
|
|
63683
63975
|
});
|
|
63684
63976
|
var useLiveMonitorBootstrap = ({
|
|
63685
63977
|
lineIds,
|
|
63978
|
+
blueComparisonLineIds,
|
|
63686
63979
|
companyId,
|
|
63687
63980
|
enabled = true,
|
|
63688
63981
|
appTimezone,
|
|
@@ -63697,13 +63990,18 @@ var useLiveMonitorBootstrap = ({
|
|
|
63697
63990
|
const effectiveWorkspaceConfig = workspaceConfig || DEFAULT_WORKSPACE_CONFIG;
|
|
63698
63991
|
const effectiveTimezone = appTimezone || "Asia/Kolkata";
|
|
63699
63992
|
const rawLineIdsKey = (lineIds || []).filter(Boolean).join(",");
|
|
63993
|
+
const rawBlueComparisonLineIdsKey = (blueComparisonLineIds || lineIds || []).filter(Boolean).join(",");
|
|
63700
63994
|
const normalizedLineIds = useMemo(
|
|
63701
63995
|
() => Array.from(new Set(rawLineIdsKey ? rawLineIdsKey.split(",") : [])),
|
|
63702
63996
|
[rawLineIdsKey]
|
|
63703
63997
|
);
|
|
63998
|
+
const normalizedBlueComparisonLineIds = useMemo(
|
|
63999
|
+
() => Array.from(new Set(rawBlueComparisonLineIdsKey ? rawBlueComparisonLineIdsKey.split(",") : [])),
|
|
64000
|
+
[rawBlueComparisonLineIdsKey]
|
|
64001
|
+
);
|
|
63704
64002
|
const requestKey = useMemo(
|
|
63705
|
-
() => normalizedLineIds.slice().sort().join(","),
|
|
63706
|
-
[normalizedLineIds]
|
|
64003
|
+
() => `${normalizedLineIds.slice().sort().join(",")}|blue:${normalizedBlueComparisonLineIds.slice().sort().join(",")}`,
|
|
64004
|
+
[normalizedLineIds, normalizedBlueComparisonLineIds]
|
|
63707
64005
|
);
|
|
63708
64006
|
const [state, setState] = useState(() => createEmptyState());
|
|
63709
64007
|
const [rawState, setRawState] = useState(null);
|
|
@@ -63721,6 +64019,9 @@ var useLiveMonitorBootstrap = ({
|
|
|
63721
64019
|
const searchParams = new URLSearchParams();
|
|
63722
64020
|
searchParams.set("company_id", resolvedCompanyId);
|
|
63723
64021
|
searchParams.set("line_ids", normalizedLineIds.join(","));
|
|
64022
|
+
if (normalizedBlueComparisonLineIds.length) {
|
|
64023
|
+
searchParams.set("blue_comparison_line_ids", normalizedBlueComparisonLineIds.join(","));
|
|
64024
|
+
}
|
|
63724
64025
|
if (force) {
|
|
63725
64026
|
searchParams.set("force_refresh", "true");
|
|
63726
64027
|
}
|
|
@@ -63752,6 +64053,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
63752
64053
|
extras: {
|
|
63753
64054
|
company_id: resolvedCompanyId,
|
|
63754
64055
|
line_ids: normalizedLineIds,
|
|
64056
|
+
blue_comparison_line_ids: normalizedBlueComparisonLineIds,
|
|
63755
64057
|
force_refresh: force,
|
|
63756
64058
|
pathname: typeof window !== "undefined" ? window.location.pathname : "unknown"
|
|
63757
64059
|
}
|
|
@@ -63767,6 +64069,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
63767
64069
|
supabase,
|
|
63768
64070
|
resolvedCompanyId,
|
|
63769
64071
|
normalizedLineIds,
|
|
64072
|
+
normalizedBlueComparisonLineIds,
|
|
63770
64073
|
requestKey
|
|
63771
64074
|
]);
|
|
63772
64075
|
useEffect(() => {
|
|
@@ -63785,6 +64088,16 @@ var useLiveMonitorBootstrap = ({
|
|
|
63785
64088
|
fallbackShiftConfig
|
|
63786
64089
|
});
|
|
63787
64090
|
const activeBreaks = transformActiveBreaks(rawState.response.active_breaks_by_line);
|
|
64091
|
+
const blueComparisonWorkspaceMetrics = rawState.response.blue_comparison_workspace_metrics ? transformMonitorWorkspaceMetrics({
|
|
64092
|
+
rows: rawState.response.blue_comparison_workspace_metrics,
|
|
64093
|
+
companyId: resolvedCompanyId,
|
|
64094
|
+
workspaceConfig: effectiveWorkspaceConfig,
|
|
64095
|
+
appTimezone: effectiveTimezone,
|
|
64096
|
+
lineMetrics: rawState.response.line_metrics || [],
|
|
64097
|
+
resolveShiftConfig: (lineId) => lineShiftConfigs?.get(lineId) || fallbackShiftConfig,
|
|
64098
|
+
shouldOverrideShiftType: (lineId) => Boolean(lineShiftConfigs?.get(lineId)),
|
|
64099
|
+
fallbackShiftConfig
|
|
64100
|
+
}) : workspaceMetrics;
|
|
63788
64101
|
const metadata = normalizeMetadata(rawState.response.metadata);
|
|
63789
64102
|
const workspaceIds = workspaceMetrics.map((metric) => metric.workspace_uuid).filter((workspaceId) => Boolean(workspaceId));
|
|
63790
64103
|
const videoStreamsByWorkspaceId = rawState.response.video_streams_by_workspace_id || {};
|
|
@@ -63802,6 +64115,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
63802
64115
|
scopeKey: rawState.response.scope_key || null,
|
|
63803
64116
|
lines: rawState.response.lines || [],
|
|
63804
64117
|
workspaceMetrics,
|
|
64118
|
+
blueComparisonWorkspaceMetrics: blueComparisonWorkspaceMetrics.length ? blueComparisonWorkspaceMetrics : workspaceMetrics,
|
|
63805
64119
|
lineMetrics: rawState.response.line_metrics || [],
|
|
63806
64120
|
kpiTrend: rawState.response.kpi_trend || null,
|
|
63807
64121
|
activeBreaks,
|
|
@@ -63869,6 +64183,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
63869
64183
|
scopeKey: state.scopeKey,
|
|
63870
64184
|
lines: state.lines,
|
|
63871
64185
|
workspaceMetrics: state.workspaceMetrics,
|
|
64186
|
+
blueComparisonWorkspaceMetrics: state.blueComparisonWorkspaceMetrics,
|
|
63872
64187
|
lineMetrics: state.lineMetrics,
|
|
63873
64188
|
kpiTrend: state.kpiTrend,
|
|
63874
64189
|
activeBreaks: state.activeBreaks,
|
|
@@ -64139,6 +64454,22 @@ var logDebug3 = (...args) => {
|
|
|
64139
64454
|
};
|
|
64140
64455
|
var EMPTY_LINE_IDS = [];
|
|
64141
64456
|
var EMPTY_WORKSPACES = [];
|
|
64457
|
+
var ALL_GREEN_CELEBRATION_DURATION_MS = 6e3;
|
|
64458
|
+
var ALL_GREEN_MILESTONE_DURATION_MS = 6e3;
|
|
64459
|
+
var ALL_GREEN_STREAK_LOCAL_SECOND_CAP = 59;
|
|
64460
|
+
var formatAllGreenCelebrationTimer = (elapsedSeconds) => {
|
|
64461
|
+
const safeElapsedSeconds = Math.max(1, Math.floor(elapsedSeconds));
|
|
64462
|
+
const minutes = Math.floor(safeElapsedSeconds / 60);
|
|
64463
|
+
const seconds = safeElapsedSeconds % 60;
|
|
64464
|
+
return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}s`;
|
|
64465
|
+
};
|
|
64466
|
+
var getAllGreenBackendVisibleSeconds = (confirmedSeconds, tickOriginAtMs, nowMs2) => {
|
|
64467
|
+
const localSecondOffset = Math.min(
|
|
64468
|
+
ALL_GREEN_STREAK_LOCAL_SECOND_CAP,
|
|
64469
|
+
Math.max(0, Math.floor((nowMs2 - tickOriginAtMs) / 1e3))
|
|
64470
|
+
);
|
|
64471
|
+
return confirmedSeconds + localSecondOffset;
|
|
64472
|
+
};
|
|
64142
64473
|
var LoadingPageCmp = LoadingPage_default;
|
|
64143
64474
|
var LoadingOverlayCmp = LoadingOverlay_default;
|
|
64144
64475
|
function HomeView({
|
|
@@ -64280,6 +64611,31 @@ function HomeView({
|
|
|
64280
64611
|
() => new Set(selectedLineIds),
|
|
64281
64612
|
[selectedLineIds]
|
|
64282
64613
|
);
|
|
64614
|
+
const blueComparisonLineIds = useMemo(() => {
|
|
64615
|
+
const selectedFactoryAreaIds = /* @__PURE__ */ new Set();
|
|
64616
|
+
for (const line of dbLines) {
|
|
64617
|
+
if (!selectedLineIdSet.has(line.id)) {
|
|
64618
|
+
continue;
|
|
64619
|
+
}
|
|
64620
|
+
const factoryAreaId = typeof line.factory_area_id === "string" ? line.factory_area_id.trim() : "";
|
|
64621
|
+
if (factoryAreaId) {
|
|
64622
|
+
selectedFactoryAreaIds.add(factoryAreaId);
|
|
64623
|
+
}
|
|
64624
|
+
}
|
|
64625
|
+
if (selectedFactoryAreaIds.size === 0) {
|
|
64626
|
+
return selectedLineIds;
|
|
64627
|
+
}
|
|
64628
|
+
const dbLinesById = new Map(dbLines.map((line) => [line.id, line]));
|
|
64629
|
+
const selectedIds = new Set(selectedLineIds);
|
|
64630
|
+
return visibleLineIds.filter((lineId) => {
|
|
64631
|
+
if (selectedIds.has(lineId)) {
|
|
64632
|
+
return true;
|
|
64633
|
+
}
|
|
64634
|
+
const line = dbLinesById.get(lineId);
|
|
64635
|
+
const factoryAreaId = typeof line?.factory_area_id === "string" ? line.factory_area_id.trim() : "";
|
|
64636
|
+
return factoryAreaId ? selectedFactoryAreaIds.has(factoryAreaId) : false;
|
|
64637
|
+
});
|
|
64638
|
+
}, [dbLines, selectedLineIdSet, selectedLineIds, visibleLineIds]);
|
|
64283
64639
|
const metricsScopeLineId = isMultiLineSelection ? factoryViewId : primarySelectedLineId;
|
|
64284
64640
|
const userCompanyId = useMemo(() => {
|
|
64285
64641
|
return user?.properties?.company_id || user?.company_id || entityConfig.companyId;
|
|
@@ -64320,6 +64676,7 @@ function HomeView({
|
|
|
64320
64676
|
}, []);
|
|
64321
64677
|
const {
|
|
64322
64678
|
workspaceMetrics: legacyWorkspaceMetrics,
|
|
64679
|
+
blueComparisonWorkspaceMetrics: legacyMetricsBlueComparisonWorkspaceMetrics,
|
|
64323
64680
|
lineMetrics: legacyLineMetrics,
|
|
64324
64681
|
efficiencyLegend: legacyEfficiencyLegend,
|
|
64325
64682
|
metadata: legacyMetricsMetadata,
|
|
@@ -64330,6 +64687,7 @@ function HomeView({
|
|
|
64330
64687
|
} = useDashboardMetrics({
|
|
64331
64688
|
lineId: metricsScopeLineId,
|
|
64332
64689
|
lineIds: selectedLineIds,
|
|
64690
|
+
blueComparisonLineIds,
|
|
64333
64691
|
onLineMetricsUpdate: handleLineMetricsUpdate,
|
|
64334
64692
|
userAccessibleLineIds: visibleLineIds,
|
|
64335
64693
|
enabled: shouldEnableMetricsFetch && !isBootstrapMonitorMode
|
|
@@ -64384,6 +64742,7 @@ function HomeView({
|
|
|
64384
64742
|
const { trend: legacyKpiTrend } = useKpiTrends(legacyTrendOptions);
|
|
64385
64743
|
const bootstrapMonitor = useLiveMonitorBootstrap({
|
|
64386
64744
|
lineIds: selectedLineIds,
|
|
64745
|
+
blueComparisonLineIds,
|
|
64387
64746
|
companyId: userCompanyId,
|
|
64388
64747
|
enabled: shouldEnableMetricsFetch && !isLegacyMonitorMode,
|
|
64389
64748
|
appTimezone: timezone,
|
|
@@ -64392,6 +64751,7 @@ function HomeView({
|
|
|
64392
64751
|
lineShiftConfigs
|
|
64393
64752
|
});
|
|
64394
64753
|
const currentWorkspaceMetrics = isBootstrapMonitorMode ? bootstrapMonitor.workspaceMetrics : legacyWorkspaceMetrics;
|
|
64754
|
+
const currentBlueComparisonWorkspaceMetrics = isBootstrapMonitorMode ? bootstrapMonitor.blueComparisonWorkspaceMetrics : legacyMetricsBlueComparisonWorkspaceMetrics;
|
|
64395
64755
|
const currentLineMetrics = isBootstrapMonitorMode ? bootstrapMonitor.lineMetrics : legacyLineMetrics;
|
|
64396
64756
|
const currentEfficiencyLegend = isBootstrapMonitorMode ? bootstrapMonitor.efficiencyLegend : legacyEfficiencyLegend;
|
|
64397
64757
|
const currentMetricsMetadata = isBootstrapMonitorMode ? bootstrapMonitor.metadata : legacyMetricsMetadata;
|
|
@@ -64529,6 +64889,218 @@ function HomeView({
|
|
|
64529
64889
|
setBreakNotificationsDismissed(false);
|
|
64530
64890
|
}
|
|
64531
64891
|
}, [currentActiveBreaks.length]);
|
|
64892
|
+
const effectiveEfficiencyLegend = currentEfficiencyLegend || DEFAULT_EFFICIENCY_LEGEND;
|
|
64893
|
+
useMemo(
|
|
64894
|
+
() => workspaceMetricsWithBreakState.filter((workspace) => Boolean(workspace.workspace_uuid || workspace.workspace_name)).length,
|
|
64895
|
+
[workspaceMetricsWithBreakState]
|
|
64896
|
+
);
|
|
64897
|
+
const allGreenCelebrationSignature = useMemo(() => {
|
|
64898
|
+
const workspaceSignature = workspaceMetricsWithBreakState.map((workspace) => workspace.workspace_uuid || `${workspace.line_id}:${workspace.workspace_name}`).filter(Boolean).sort().join(",");
|
|
64899
|
+
return `${selectedLineIds.join(",")}::${workspaceSignature}`;
|
|
64900
|
+
}, [selectedLineIds, workspaceMetricsWithBreakState]);
|
|
64901
|
+
const allGreenTransitionRef = useRef({ signature: null, previousValidStreakIdentity: null });
|
|
64902
|
+
const allGreenCelebrationTimerRef = useRef(null);
|
|
64903
|
+
const allGreenMilestoneTimerRef = useRef(null);
|
|
64904
|
+
const allGreenMilestoneTrackingRef = useRef({ identity: null, lastMilestoneSeconds: null });
|
|
64905
|
+
const allGreenStreakTimerBaselineRef = useRef(null);
|
|
64906
|
+
const [showAllGreenCelebration, setShowAllGreenCelebration] = useState(false);
|
|
64907
|
+
const [allGreenCelebrationStartedAtMs, setAllGreenCelebrationStartedAtMs] = useState(null);
|
|
64908
|
+
const [greenStreakMilestoneBanner, setGreenStreakMilestoneBanner] = useState(null);
|
|
64909
|
+
const [allGreenStreakNowMs, setAllGreenStreakNowMs] = useState(() => Date.now());
|
|
64910
|
+
const currentAllGreenStreakNowMs = Math.max(allGreenStreakNowMs, Date.now());
|
|
64911
|
+
const allGreenStreakDisplay = useMemo(
|
|
64912
|
+
() => getAllVideoGridGreenStreakDisplay(
|
|
64913
|
+
workspaceMetricsWithBreakState,
|
|
64914
|
+
effectiveEfficiencyLegend,
|
|
64915
|
+
currentAllGreenStreakNowMs
|
|
64916
|
+
),
|
|
64917
|
+
[currentAllGreenStreakNowMs, effectiveEfficiencyLegend, workspaceMetricsWithBreakState]
|
|
64918
|
+
);
|
|
64919
|
+
const allGreenMilestoneIdentity = useMemo(() => allGreenStreakDisplay ? `${allGreenCelebrationSignature}::${allGreenStreakDisplay.startedAt}` : null, [allGreenCelebrationSignature, allGreenStreakDisplay]);
|
|
64920
|
+
const visibleAllGreenStreakDisplay = useMemo(() => {
|
|
64921
|
+
if (!allGreenStreakDisplay || !allGreenMilestoneIdentity) {
|
|
64922
|
+
allGreenStreakTimerBaselineRef.current = null;
|
|
64923
|
+
return null;
|
|
64924
|
+
}
|
|
64925
|
+
const confirmedSeconds = allGreenStreakDisplay.confirmedSeconds;
|
|
64926
|
+
const backendVisibleSeconds = getAllGreenBackendVisibleSeconds(
|
|
64927
|
+
confirmedSeconds,
|
|
64928
|
+
allGreenStreakDisplay.tickOriginAtMs,
|
|
64929
|
+
currentAllGreenStreakNowMs
|
|
64930
|
+
);
|
|
64931
|
+
const backendMaxVisibleSeconds = confirmedSeconds + ALL_GREEN_STREAK_LOCAL_SECOND_CAP;
|
|
64932
|
+
const currentBaseline = allGreenStreakTimerBaselineRef.current;
|
|
64933
|
+
if (!currentBaseline || currentBaseline.identity !== allGreenMilestoneIdentity) {
|
|
64934
|
+
allGreenStreakTimerBaselineRef.current = {
|
|
64935
|
+
identity: allGreenMilestoneIdentity,
|
|
64936
|
+
baseSeconds: backendVisibleSeconds,
|
|
64937
|
+
baseReceivedAtMs: currentAllGreenStreakNowMs,
|
|
64938
|
+
maxVisibleSeconds: backendMaxVisibleSeconds
|
|
64939
|
+
};
|
|
64940
|
+
} else {
|
|
64941
|
+
currentBaseline.maxVisibleSeconds = Math.max(
|
|
64942
|
+
currentBaseline.maxVisibleSeconds,
|
|
64943
|
+
backendMaxVisibleSeconds
|
|
64944
|
+
);
|
|
64945
|
+
const visibleSeconds = Math.min(
|
|
64946
|
+
currentBaseline.maxVisibleSeconds,
|
|
64947
|
+
currentBaseline.baseSeconds + Math.max(0, Math.floor((currentAllGreenStreakNowMs - currentBaseline.baseReceivedAtMs) / 1e3))
|
|
64948
|
+
);
|
|
64949
|
+
if (backendVisibleSeconds > visibleSeconds) {
|
|
64950
|
+
allGreenStreakTimerBaselineRef.current = {
|
|
64951
|
+
identity: allGreenMilestoneIdentity,
|
|
64952
|
+
baseSeconds: backendVisibleSeconds,
|
|
64953
|
+
baseReceivedAtMs: currentAllGreenStreakNowMs,
|
|
64954
|
+
maxVisibleSeconds: currentBaseline.maxVisibleSeconds
|
|
64955
|
+
};
|
|
64956
|
+
}
|
|
64957
|
+
}
|
|
64958
|
+
const baseline = allGreenStreakTimerBaselineRef.current;
|
|
64959
|
+
const elapsedSeconds = baseline ? Math.min(
|
|
64960
|
+
baseline.maxVisibleSeconds,
|
|
64961
|
+
baseline.baseSeconds + Math.max(0, Math.floor((currentAllGreenStreakNowMs - baseline.baseReceivedAtMs) / 1e3))
|
|
64962
|
+
) : backendVisibleSeconds;
|
|
64963
|
+
return {
|
|
64964
|
+
...allGreenStreakDisplay,
|
|
64965
|
+
elapsedSeconds,
|
|
64966
|
+
durationText: formatAllGreenStreakDuration(elapsedSeconds)
|
|
64967
|
+
};
|
|
64968
|
+
}, [allGreenMilestoneIdentity, allGreenStreakDisplay, currentAllGreenStreakNowMs]);
|
|
64969
|
+
const allGreenCelebrationTimerText = useMemo(() => {
|
|
64970
|
+
if (!showAllGreenCelebration || allGreenCelebrationStartedAtMs === null) {
|
|
64971
|
+
return null;
|
|
64972
|
+
}
|
|
64973
|
+
return formatAllGreenCelebrationTimer(
|
|
64974
|
+
Math.max(0, Math.floor((currentAllGreenStreakNowMs - allGreenCelebrationStartedAtMs) / 1e3))
|
|
64975
|
+
);
|
|
64976
|
+
}, [allGreenCelebrationStartedAtMs, currentAllGreenStreakNowMs, showAllGreenCelebration]);
|
|
64977
|
+
useEffect(() => {
|
|
64978
|
+
const hasPossibleStreakTimer = showAllGreenCelebration || Boolean(allGreenStreakDisplay) || workspaceMetricsWithBreakState.some((workspace) => workspace.video_grid_green_streak_active === true);
|
|
64979
|
+
if (!hasPossibleStreakTimer) {
|
|
64980
|
+
return void 0;
|
|
64981
|
+
}
|
|
64982
|
+
const timerId = setInterval(() => {
|
|
64983
|
+
setAllGreenStreakNowMs(Date.now());
|
|
64984
|
+
}, 1e3);
|
|
64985
|
+
return () => {
|
|
64986
|
+
clearInterval(timerId);
|
|
64987
|
+
};
|
|
64988
|
+
}, [allGreenStreakDisplay, showAllGreenCelebration, workspaceMetricsWithBreakState]);
|
|
64989
|
+
const dismissAllGreenCelebration = useCallback(() => {
|
|
64990
|
+
if (allGreenCelebrationTimerRef.current) {
|
|
64991
|
+
clearTimeout(allGreenCelebrationTimerRef.current);
|
|
64992
|
+
allGreenCelebrationTimerRef.current = null;
|
|
64993
|
+
}
|
|
64994
|
+
setShowAllGreenCelebration(false);
|
|
64995
|
+
setAllGreenCelebrationStartedAtMs(null);
|
|
64996
|
+
}, []);
|
|
64997
|
+
const triggerAllGreenCelebration = useCallback(() => {
|
|
64998
|
+
setAllGreenCelebrationStartedAtMs(Date.now());
|
|
64999
|
+
setShowAllGreenCelebration(true);
|
|
65000
|
+
if (allGreenCelebrationTimerRef.current) {
|
|
65001
|
+
clearTimeout(allGreenCelebrationTimerRef.current);
|
|
65002
|
+
}
|
|
65003
|
+
allGreenCelebrationTimerRef.current = setTimeout(() => {
|
|
65004
|
+
setShowAllGreenCelebration(false);
|
|
65005
|
+
setAllGreenCelebrationStartedAtMs(null);
|
|
65006
|
+
allGreenCelebrationTimerRef.current = null;
|
|
65007
|
+
}, ALL_GREEN_CELEBRATION_DURATION_MS);
|
|
65008
|
+
}, []);
|
|
65009
|
+
const dismissGreenStreakMilestoneBanner = useCallback(() => {
|
|
65010
|
+
if (allGreenMilestoneTimerRef.current) {
|
|
65011
|
+
clearTimeout(allGreenMilestoneTimerRef.current);
|
|
65012
|
+
allGreenMilestoneTimerRef.current = null;
|
|
65013
|
+
}
|
|
65014
|
+
setGreenStreakMilestoneBanner(null);
|
|
65015
|
+
}, []);
|
|
65016
|
+
const triggerGreenStreakMilestoneBanner = useCallback((milestone) => {
|
|
65017
|
+
setGreenStreakMilestoneBanner(milestone);
|
|
65018
|
+
if (allGreenMilestoneTimerRef.current) {
|
|
65019
|
+
clearTimeout(allGreenMilestoneTimerRef.current);
|
|
65020
|
+
}
|
|
65021
|
+
allGreenMilestoneTimerRef.current = setTimeout(() => {
|
|
65022
|
+
setGreenStreakMilestoneBanner(null);
|
|
65023
|
+
allGreenMilestoneTimerRef.current = null;
|
|
65024
|
+
}, ALL_GREEN_MILESTONE_DURATION_MS);
|
|
65025
|
+
}, []);
|
|
65026
|
+
useEffect(() => {
|
|
65027
|
+
return () => {
|
|
65028
|
+
if (allGreenCelebrationTimerRef.current) {
|
|
65029
|
+
clearTimeout(allGreenCelebrationTimerRef.current);
|
|
65030
|
+
}
|
|
65031
|
+
if (allGreenMilestoneTimerRef.current) {
|
|
65032
|
+
clearTimeout(allGreenMilestoneTimerRef.current);
|
|
65033
|
+
}
|
|
65034
|
+
};
|
|
65035
|
+
}, []);
|
|
65036
|
+
useEffect(() => {
|
|
65037
|
+
const milestoneTracking = allGreenMilestoneTrackingRef.current;
|
|
65038
|
+
if (currentMetricsLoading) {
|
|
65039
|
+
return;
|
|
65040
|
+
}
|
|
65041
|
+
if (!visibleAllGreenStreakDisplay || !allGreenMilestoneIdentity) {
|
|
65042
|
+
milestoneTracking.identity = null;
|
|
65043
|
+
milestoneTracking.lastMilestoneSeconds = null;
|
|
65044
|
+
dismissGreenStreakMilestoneBanner();
|
|
65045
|
+
return;
|
|
65046
|
+
}
|
|
65047
|
+
const currentMilestone = getAllGreenStreakMilestone(visibleAllGreenStreakDisplay.elapsedSeconds);
|
|
65048
|
+
const currentMilestoneSeconds = currentMilestone?.milestoneSeconds ?? null;
|
|
65049
|
+
if (milestoneTracking.identity !== allGreenMilestoneIdentity) {
|
|
65050
|
+
milestoneTracking.identity = allGreenMilestoneIdentity;
|
|
65051
|
+
milestoneTracking.lastMilestoneSeconds = currentMilestoneSeconds;
|
|
65052
|
+
dismissGreenStreakMilestoneBanner();
|
|
65053
|
+
return;
|
|
65054
|
+
}
|
|
65055
|
+
if (!currentMilestone) {
|
|
65056
|
+
milestoneTracking.lastMilestoneSeconds = null;
|
|
65057
|
+
return;
|
|
65058
|
+
}
|
|
65059
|
+
if ((milestoneTracking.lastMilestoneSeconds ?? 0) < currentMilestone.milestoneSeconds) {
|
|
65060
|
+
milestoneTracking.lastMilestoneSeconds = currentMilestone.milestoneSeconds;
|
|
65061
|
+
triggerGreenStreakMilestoneBanner(currentMilestone);
|
|
65062
|
+
}
|
|
65063
|
+
}, [
|
|
65064
|
+
allGreenMilestoneIdentity,
|
|
65065
|
+
currentMetricsLoading,
|
|
65066
|
+
dismissGreenStreakMilestoneBanner,
|
|
65067
|
+
triggerGreenStreakMilestoneBanner,
|
|
65068
|
+
visibleAllGreenStreakDisplay
|
|
65069
|
+
]);
|
|
65070
|
+
useEffect(() => {
|
|
65071
|
+
if (currentMetricsLoading) {
|
|
65072
|
+
return;
|
|
65073
|
+
}
|
|
65074
|
+
const currentValidStreakIdentity = visibleAllGreenStreakDisplay && allGreenMilestoneIdentity ? allGreenMilestoneIdentity : null;
|
|
65075
|
+
const transitionState = allGreenTransitionRef.current;
|
|
65076
|
+
if (transitionState.signature !== allGreenCelebrationSignature) {
|
|
65077
|
+
transitionState.signature = allGreenCelebrationSignature;
|
|
65078
|
+
transitionState.previousValidStreakIdentity = currentValidStreakIdentity;
|
|
65079
|
+
dismissAllGreenCelebration();
|
|
65080
|
+
return;
|
|
65081
|
+
}
|
|
65082
|
+
if (!currentValidStreakIdentity) {
|
|
65083
|
+
transitionState.previousValidStreakIdentity = null;
|
|
65084
|
+
dismissAllGreenCelebration();
|
|
65085
|
+
return;
|
|
65086
|
+
}
|
|
65087
|
+
if (transitionState.previousValidStreakIdentity === null) {
|
|
65088
|
+
transitionState.previousValidStreakIdentity = currentValidStreakIdentity;
|
|
65089
|
+
triggerAllGreenCelebration();
|
|
65090
|
+
return;
|
|
65091
|
+
}
|
|
65092
|
+
if (transitionState.previousValidStreakIdentity !== currentValidStreakIdentity) {
|
|
65093
|
+
transitionState.previousValidStreakIdentity = currentValidStreakIdentity;
|
|
65094
|
+
dismissAllGreenCelebration();
|
|
65095
|
+
}
|
|
65096
|
+
}, [
|
|
65097
|
+
allGreenCelebrationSignature,
|
|
65098
|
+
allGreenMilestoneIdentity,
|
|
65099
|
+
currentMetricsLoading,
|
|
65100
|
+
dismissAllGreenCelebration,
|
|
65101
|
+
triggerAllGreenCelebration,
|
|
65102
|
+
visibleAllGreenStreakDisplay
|
|
65103
|
+
]);
|
|
64532
65104
|
const {
|
|
64533
65105
|
streamsByWorkspaceId: legacyVideoStreamsByWorkspaceId,
|
|
64534
65106
|
isLoading: legacyVideoStreamsLoading
|
|
@@ -65095,6 +65667,28 @@ function HomeView({
|
|
|
65095
65667
|
updateSelectedLineIds,
|
|
65096
65668
|
isAllLinesSelection
|
|
65097
65669
|
]);
|
|
65670
|
+
const gridToolbarControls = useMemo(() => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
65671
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: visibleAllGreenStreakDisplay ? /* @__PURE__ */ jsxs(
|
|
65672
|
+
motion.div,
|
|
65673
|
+
{
|
|
65674
|
+
initial: { opacity: 0, y: -4 },
|
|
65675
|
+
animate: { opacity: 1, y: 0 },
|
|
65676
|
+
exit: { opacity: 0, y: -4 },
|
|
65677
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
65678
|
+
className: "inline-flex items-center gap-1.5 rounded-md border border-[#00AB45]/20 bg-[#00AB45]/10 px-3 py-1.5 text-sm font-semibold text-[#00AB45] shadow-sm",
|
|
65679
|
+
"aria-label": "All green streak",
|
|
65680
|
+
children: [
|
|
65681
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4" }),
|
|
65682
|
+
/* @__PURE__ */ jsx("span", { children: `${visibleAllGreenStreakDisplay.label} \xB7 ${visibleAllGreenStreakDisplay.durationText}` })
|
|
65683
|
+
]
|
|
65684
|
+
},
|
|
65685
|
+
visibleAllGreenStreakDisplay.startedAt
|
|
65686
|
+
) : null }),
|
|
65687
|
+
lineSelectorComponent
|
|
65688
|
+
] }), [
|
|
65689
|
+
lineSelectorComponent,
|
|
65690
|
+
visibleAllGreenStreakDisplay
|
|
65691
|
+
]);
|
|
65098
65692
|
const useSmoothLoading = (isLoading, minDuration = 400) => {
|
|
65099
65693
|
const [showLoading, setShowLoading] = useState(isLoading);
|
|
65100
65694
|
const loadingStartRef2 = useRef(null);
|
|
@@ -65267,17 +65861,18 @@ function HomeView({
|
|
|
65267
65861
|
className: "h-full",
|
|
65268
65862
|
children: React144__default.createElement(WorkspaceGrid, {
|
|
65269
65863
|
workspaces: workspaceMetricsWithBreakState,
|
|
65864
|
+
blueComparisonWorkspaces: currentBlueComparisonWorkspaceMetrics || workspaceMetricsWithBreakState,
|
|
65270
65865
|
lineNames: mergedLineNames,
|
|
65271
65866
|
lineOrder: selectedLineIds,
|
|
65272
65867
|
factoryView: factoryViewId,
|
|
65273
|
-
legend:
|
|
65868
|
+
legend: effectiveEfficiencyLegend,
|
|
65274
65869
|
videoSources,
|
|
65275
65870
|
videoStreamsByWorkspaceId: currentVideoStreamsByWorkspaceId,
|
|
65276
65871
|
videoStreamsLoading: currentVideoStreamsLoading,
|
|
65277
65872
|
displayNames: metricsDisplayNames,
|
|
65278
65873
|
hasFlowBuffers,
|
|
65279
65874
|
className: "h-full",
|
|
65280
|
-
toolbarRightContent:
|
|
65875
|
+
toolbarRightContent: gridToolbarControls,
|
|
65281
65876
|
onWorkspaceHover: handleWorkspaceHover,
|
|
65282
65877
|
onWorkspaceHoverEnd: handleWorkspaceHoverEnd
|
|
65283
65878
|
})
|
|
@@ -65300,17 +65895,18 @@ function HomeView({
|
|
|
65300
65895
|
children: React144__default.createElement(WorkspaceGrid, {
|
|
65301
65896
|
workspaces: [],
|
|
65302
65897
|
// Show empty grid while loading
|
|
65898
|
+
blueComparisonWorkspaces: [],
|
|
65303
65899
|
lineNames: mergedLineNames,
|
|
65304
65900
|
lineOrder: selectedLineIds,
|
|
65305
65901
|
factoryView: factoryViewId,
|
|
65306
|
-
legend:
|
|
65902
|
+
legend: effectiveEfficiencyLegend,
|
|
65307
65903
|
videoSources,
|
|
65308
65904
|
videoStreamsByWorkspaceId: currentVideoStreamsByWorkspaceId,
|
|
65309
65905
|
videoStreamsLoading: currentVideoStreamsLoading,
|
|
65310
65906
|
displayNames: metricsDisplayNames,
|
|
65311
65907
|
hasFlowBuffers,
|
|
65312
65908
|
className: "h-full",
|
|
65313
|
-
toolbarRightContent:
|
|
65909
|
+
toolbarRightContent: gridToolbarControls,
|
|
65314
65910
|
onWorkspaceHover: handleWorkspaceHover,
|
|
65315
65911
|
onWorkspaceHoverEnd: handleWorkspaceHoverEnd
|
|
65316
65912
|
})
|
|
@@ -65343,6 +65939,149 @@ function HomeView({
|
|
|
65343
65939
|
contentVariant: "plain"
|
|
65344
65940
|
}
|
|
65345
65941
|
),
|
|
65942
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: showAllGreenCelebration ? /* @__PURE__ */ jsxs(React144__default.Fragment, { children: [
|
|
65943
|
+
/* @__PURE__ */ jsx(
|
|
65944
|
+
motion.div,
|
|
65945
|
+
{
|
|
65946
|
+
initial: { opacity: 0 },
|
|
65947
|
+
animate: { opacity: 1 },
|
|
65948
|
+
exit: { opacity: 0 },
|
|
65949
|
+
transition: { duration: 0.4 },
|
|
65950
|
+
className: "pointer-events-none fixed inset-0 z-[9998] bg-slate-900/40 backdrop-blur-sm",
|
|
65951
|
+
"aria-hidden": "true"
|
|
65952
|
+
},
|
|
65953
|
+
"all-green-backdrop"
|
|
65954
|
+
),
|
|
65955
|
+
/* @__PURE__ */ jsxs(
|
|
65956
|
+
motion.div,
|
|
65957
|
+
{
|
|
65958
|
+
initial: { opacity: 0 },
|
|
65959
|
+
animate: { opacity: 1 },
|
|
65960
|
+
exit: { opacity: 0, y: -50, scale: 0.9, filter: "blur(10px)" },
|
|
65961
|
+
transition: { duration: 0.4 },
|
|
65962
|
+
className: "pointer-events-none fixed inset-0 z-[10000] flex flex-col items-center justify-center px-4",
|
|
65963
|
+
role: "status",
|
|
65964
|
+
"aria-live": "polite",
|
|
65965
|
+
"aria-label": "All green celebration",
|
|
65966
|
+
children: [
|
|
65967
|
+
/* @__PURE__ */ jsxs(
|
|
65968
|
+
motion.div,
|
|
65969
|
+
{
|
|
65970
|
+
initial: { opacity: 0, y: 8, filter: "blur(6px)" },
|
|
65971
|
+
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
65972
|
+
transition: { duration: 0.28, ease: [0.16, 1, 0.3, 1] },
|
|
65973
|
+
className: "flex flex-wrap items-center justify-center gap-x-4 sm:gap-x-8",
|
|
65974
|
+
children: [
|
|
65975
|
+
/* @__PURE__ */ jsx(
|
|
65976
|
+
"span",
|
|
65977
|
+
{
|
|
65978
|
+
className: "text-[100px] font-black uppercase leading-none tracking-tight text-white drop-shadow-2xl sm:text-[140px]",
|
|
65979
|
+
style: { textShadow: "0 18px 36px rgba(0,0,0,0.34)" },
|
|
65980
|
+
children: "ALL"
|
|
65981
|
+
}
|
|
65982
|
+
),
|
|
65983
|
+
/* @__PURE__ */ jsx(
|
|
65984
|
+
"span",
|
|
65985
|
+
{
|
|
65986
|
+
className: "text-[100px] font-black uppercase leading-none tracking-tight text-[#00AB45] drop-shadow-2xl sm:text-[140px]",
|
|
65987
|
+
style: { filter: "drop-shadow(0 18px 36px rgba(0,171,69,0.28))" },
|
|
65988
|
+
children: "GREEN"
|
|
65989
|
+
}
|
|
65990
|
+
)
|
|
65991
|
+
]
|
|
65992
|
+
}
|
|
65993
|
+
),
|
|
65994
|
+
/* @__PURE__ */ jsx(
|
|
65995
|
+
motion.div,
|
|
65996
|
+
{
|
|
65997
|
+
initial: { opacity: 0, scaleX: 0 },
|
|
65998
|
+
animate: { opacity: 1, scaleX: 1 },
|
|
65999
|
+
transition: { delay: 0.18, duration: 0.45, ease: [0.16, 1, 0.3, 1] },
|
|
66000
|
+
className: "mt-4 h-1 w-44 origin-left rounded-full bg-[#00AB45] shadow-[0_0_16px_rgba(0,171,69,0.44)] sm:w-64"
|
|
66001
|
+
}
|
|
66002
|
+
),
|
|
66003
|
+
allGreenCelebrationTimerText && /* @__PURE__ */ jsxs(
|
|
66004
|
+
motion.div,
|
|
66005
|
+
{
|
|
66006
|
+
initial: { opacity: 0, y: 4 },
|
|
66007
|
+
animate: { opacity: 1, y: 0 },
|
|
66008
|
+
transition: { delay: 0.28, duration: 0.18, ease: "easeOut" },
|
|
66009
|
+
className: "mt-3 flex items-center justify-center gap-2 text-2xl font-semibold tracking-tight text-white drop-shadow-[0_4px_18px_rgba(0,0,0,0.45)] sm:mt-4 sm:text-3xl",
|
|
66010
|
+
children: [
|
|
66011
|
+
/* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[#00AB45] shadow-[0_0_10px_rgba(0,171,69,0.72)]" }),
|
|
66012
|
+
/* @__PURE__ */ jsx("span", { children: allGreenCelebrationTimerText })
|
|
66013
|
+
]
|
|
66014
|
+
}
|
|
66015
|
+
)
|
|
66016
|
+
]
|
|
66017
|
+
},
|
|
66018
|
+
"all-green-center-toast"
|
|
66019
|
+
)
|
|
66020
|
+
] }, "all-green-celebration") : null }),
|
|
66021
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: greenStreakMilestoneBanner ? /* @__PURE__ */ jsxs(React144__default.Fragment, { children: [
|
|
66022
|
+
/* @__PURE__ */ jsx(
|
|
66023
|
+
motion.div,
|
|
66024
|
+
{
|
|
66025
|
+
initial: { opacity: 0 },
|
|
66026
|
+
animate: { opacity: 1 },
|
|
66027
|
+
exit: { opacity: 0 },
|
|
66028
|
+
transition: { duration: 0.4 },
|
|
66029
|
+
className: "pointer-events-none fixed inset-0 z-[9998] bg-slate-900/40 backdrop-blur-sm",
|
|
66030
|
+
"aria-hidden": "true"
|
|
66031
|
+
},
|
|
66032
|
+
`green-streak-backdrop-${greenStreakMilestoneBanner.milestoneSeconds}`
|
|
66033
|
+
),
|
|
66034
|
+
/* @__PURE__ */ jsx(
|
|
66035
|
+
motion.div,
|
|
66036
|
+
{
|
|
66037
|
+
initial: { opacity: 0 },
|
|
66038
|
+
animate: { opacity: 1 },
|
|
66039
|
+
exit: { opacity: 0, y: -50, scale: 0.9, filter: "blur(10px)" },
|
|
66040
|
+
transition: { duration: 0.4 },
|
|
66041
|
+
className: "pointer-events-none fixed inset-0 z-[10000] flex flex-col items-center justify-center px-4",
|
|
66042
|
+
role: "status",
|
|
66043
|
+
"aria-live": "polite",
|
|
66044
|
+
"aria-label": `Green streak milestone: ${greenStreakMilestoneBanner.headline}`,
|
|
66045
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-y-4", children: [
|
|
66046
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
66047
|
+
motion.div,
|
|
66048
|
+
{
|
|
66049
|
+
initial: { opacity: 0, y: 8, filter: "blur(6px)" },
|
|
66050
|
+
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
66051
|
+
transition: { delay: 0.08, duration: 0.28, ease: [0.16, 1, 0.3, 1] },
|
|
66052
|
+
className: "text-[80px] font-black uppercase leading-none tracking-tight text-white drop-shadow-2xl sm:text-[120px]",
|
|
66053
|
+
style: { textShadow: "0 18px 36px rgba(0,0,0,0.34)" },
|
|
66054
|
+
children: greenStreakMilestoneBanner.headline
|
|
66055
|
+
}
|
|
66056
|
+
) }),
|
|
66057
|
+
/* @__PURE__ */ jsx(
|
|
66058
|
+
motion.div,
|
|
66059
|
+
{
|
|
66060
|
+
initial: { opacity: 0, scaleX: 0 },
|
|
66061
|
+
animate: { opacity: 1, scaleX: 1 },
|
|
66062
|
+
transition: { delay: 0.22, duration: 0.45, ease: [0.16, 1, 0.3, 1] },
|
|
66063
|
+
className: "h-1 w-40 origin-left rounded-full bg-[#00AB45] shadow-[0_0_16px_rgba(0,171,69,0.44)] sm:w-56"
|
|
66064
|
+
}
|
|
66065
|
+
),
|
|
66066
|
+
/* @__PURE__ */ jsxs(
|
|
66067
|
+
motion.div,
|
|
66068
|
+
{
|
|
66069
|
+
initial: { opacity: 0, y: 8, filter: "blur(6px)" },
|
|
66070
|
+
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
66071
|
+
transition: { delay: 0.28, duration: 0.28, ease: [0.16, 1, 0.3, 1] },
|
|
66072
|
+
className: "flex flex-wrap items-center justify-center gap-x-4 text-[60px] font-black uppercase leading-none tracking-tight text-[#00AB45] drop-shadow-2xl sm:gap-x-8 sm:text-[90px]",
|
|
66073
|
+
style: { filter: "drop-shadow(0 18px 36px rgba(0,171,69,0.28))" },
|
|
66074
|
+
children: [
|
|
66075
|
+
/* @__PURE__ */ jsx("span", { children: "ALL" }),
|
|
66076
|
+
/* @__PURE__ */ jsx("span", { children: "GREEN" })
|
|
66077
|
+
]
|
|
66078
|
+
}
|
|
66079
|
+
)
|
|
66080
|
+
] })
|
|
66081
|
+
},
|
|
66082
|
+
`green-streak-milestone-${greenStreakMilestoneBanner.milestoneSeconds}`
|
|
66083
|
+
)
|
|
66084
|
+
] }, `green-streak-milestone-wrapper-${greenStreakMilestoneBanner.milestoneSeconds}`) : null }),
|
|
65346
66085
|
diagnosisModalOpen && bottleneckModalData?.clipId && /* @__PURE__ */ jsx(
|
|
65347
66086
|
DiagnosisVideoModal,
|
|
65348
66087
|
{
|
|
@@ -68737,6 +69476,7 @@ var LinesLeaderboard = ({
|
|
|
68737
69476
|
timeRange,
|
|
68738
69477
|
setTimeRange,
|
|
68739
69478
|
todayEfficiencyByLineId,
|
|
69479
|
+
dailyFallbackEfficiencyByLineId,
|
|
68740
69480
|
monthlyEfficiencyByLineId,
|
|
68741
69481
|
supervisorsByLineId,
|
|
68742
69482
|
supervisorNamesByLineId,
|
|
@@ -68772,8 +69512,12 @@ var LinesLeaderboard = ({
|
|
|
68772
69512
|
});
|
|
68773
69513
|
setTimeRange(newRange);
|
|
68774
69514
|
}, [timeRange, lines.length, monthlyEfficiencyByLineId, setTimeRange]);
|
|
69515
|
+
const canClickLeaderboardRow = React144__default.useCallback(
|
|
69516
|
+
(item) => item.rowType === "line" && !!item.line && canClickLine(item.line.id),
|
|
69517
|
+
[canClickLine]
|
|
69518
|
+
);
|
|
68775
69519
|
const handleLeaderboardLineClick = React144__default.useCallback((item, clickSource) => {
|
|
68776
|
-
if (!
|
|
69520
|
+
if (!canClickLeaderboardRow(item) || !item.line) return;
|
|
68777
69521
|
trackCoreEvent("Leaderboard Line Clicked", {
|
|
68778
69522
|
line_id: item.line.id,
|
|
68779
69523
|
line_name: item.line.line_name,
|
|
@@ -68785,33 +69529,46 @@ var LinesLeaderboard = ({
|
|
|
68785
69529
|
supervisor_name: item.supervisorName || "Unassigned"
|
|
68786
69530
|
});
|
|
68787
69531
|
onLineClick(item.line);
|
|
68788
|
-
}, [
|
|
69532
|
+
}, [canClickLeaderboardRow, onLineClick, timeRange]);
|
|
68789
69533
|
const viewLoadedTrackedRef = React144__default.useRef(null);
|
|
68790
69534
|
const leaderboardData = React144__default.useMemo(() => {
|
|
68791
69535
|
const loading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
|
|
68792
69536
|
const efficiencyMap = timeRange === "today" ? todayEfficiencyByLineId : monthlyEfficiencyByLineId;
|
|
68793
|
-
|
|
68794
|
-
|
|
69537
|
+
const fallbackEfficiencyMap = timeRange === "today" ? dailyFallbackEfficiencyByLineId : void 0;
|
|
69538
|
+
return buildLineLeaderboardRows({
|
|
69539
|
+
lines,
|
|
69540
|
+
efficiencyByLineId: efficiencyMap,
|
|
69541
|
+
fallbackEfficiencyByLineId: fallbackEfficiencyMap,
|
|
69542
|
+
isLoading: loading
|
|
69543
|
+
}).map((row, index) => {
|
|
69544
|
+
const supervisorByUserId = /* @__PURE__ */ new Map();
|
|
69545
|
+
const fallbackSupervisorNames = [];
|
|
69546
|
+
row.lines.forEach((line) => {
|
|
69547
|
+
(supervisorsByLineId?.get(line.id) || []).forEach((supervisor) => {
|
|
69548
|
+
supervisorByUserId.set(supervisor.userId, supervisor);
|
|
69549
|
+
});
|
|
69550
|
+
const fallbackName = supervisorNamesByLineId.get(line.id);
|
|
69551
|
+
if (fallbackName && !fallbackSupervisorNames.includes(fallbackName)) {
|
|
69552
|
+
fallbackSupervisorNames.push(fallbackName);
|
|
69553
|
+
}
|
|
69554
|
+
});
|
|
69555
|
+
const supervisors = Array.from(supervisorByUserId.values());
|
|
68795
69556
|
const primarySupervisor = supervisors[0];
|
|
68796
|
-
const supervisorName =
|
|
69557
|
+
const supervisorName = supervisors.length > 1 ? `${supervisors.length} supervisors` : primarySupervisor?.displayName || fallbackSupervisorNames[0] || "Unassigned";
|
|
68797
69558
|
const supervisorImage = primarySupervisor?.profilePhotoUrl || null;
|
|
68798
|
-
const hasEfficiency = efficiencyMap.has(line.id);
|
|
68799
|
-
const efficiency = hasEfficiency ? efficiencyMap.get(line.id) ?? 0 : loading ? null : timeRange === "monthly" ? 0 : null;
|
|
68800
|
-
const sortValue = typeof efficiency === "number" ? efficiency : -1;
|
|
68801
69559
|
return {
|
|
68802
|
-
|
|
68803
|
-
|
|
69560
|
+
...row,
|
|
69561
|
+
rank: row.rank ?? index + 1,
|
|
68804
69562
|
supervisorName,
|
|
68805
69563
|
supervisorImage,
|
|
68806
|
-
supervisors
|
|
68807
|
-
efficiency,
|
|
68808
|
-
sortValue
|
|
69564
|
+
supervisors
|
|
68809
69565
|
};
|
|
68810
|
-
})
|
|
69566
|
+
});
|
|
68811
69567
|
}, [
|
|
68812
69568
|
lines,
|
|
68813
69569
|
timeRange,
|
|
68814
69570
|
todayEfficiencyByLineId,
|
|
69571
|
+
dailyFallbackEfficiencyByLineId,
|
|
68815
69572
|
monthlyEfficiencyByLineId,
|
|
68816
69573
|
supervisorsByLineId,
|
|
68817
69574
|
supervisorNamesByLineId,
|
|
@@ -68828,11 +69585,11 @@ var LinesLeaderboard = ({
|
|
|
68828
69585
|
trackCoreEvent("Leaderboard View Loaded", {
|
|
68829
69586
|
time_range: timeRange,
|
|
68830
69587
|
lines_count: leaderboardData.length,
|
|
68831
|
-
top_line_id: topLine?.line.id,
|
|
68832
|
-
top_line_name: topLine?.
|
|
69588
|
+
top_line_id: topLine?.rowType === "line" ? topLine.line?.id : topLine?.areaId,
|
|
69589
|
+
top_line_name: topLine?.displayName,
|
|
68833
69590
|
top_efficiency: topLine?.efficiency,
|
|
68834
|
-
bottom_line_id: bottomLine?.line.id,
|
|
68835
|
-
bottom_line_name: bottomLine?.
|
|
69591
|
+
bottom_line_id: bottomLine?.rowType === "line" ? bottomLine.line?.id : bottomLine?.areaId,
|
|
69592
|
+
bottom_line_name: bottomLine?.displayName,
|
|
68836
69593
|
bottom_efficiency: bottomLine?.efficiency,
|
|
68837
69594
|
efficiency_spread: topLine && bottomLine && topLine.efficiency !== null && bottomLine.efficiency !== null ? (topLine.efficiency - bottomLine.efficiency).toFixed(1) : null,
|
|
68838
69595
|
from_page: "kpis_overview"
|
|
@@ -68939,7 +69696,7 @@ var LinesLeaderboard = ({
|
|
|
68939
69696
|
const isFirst = item.rank === 1;
|
|
68940
69697
|
const isSecond = item.rank === 2;
|
|
68941
69698
|
item.rank === 3;
|
|
68942
|
-
const isClickable =
|
|
69699
|
+
const isClickable = canClickLeaderboardRow(item);
|
|
68943
69700
|
return /* @__PURE__ */ jsxs(
|
|
68944
69701
|
"div",
|
|
68945
69702
|
{
|
|
@@ -68982,7 +69739,11 @@ var LinesLeaderboard = ({
|
|
|
68982
69739
|
className: `flex flex-col items-center w-32 md:w-40 lg:w-48 xl:w-60 px-2 md:px-3 xl:px-4 pb-3 md:pb-4 pt-8 md:pt-10 rounded-2xl border bg-gradient-to-b shadow-2xl backdrop-blur-sm ${getRankColor(item.rank)} ${isFirst ? "h-44 md:h-52 lg:h-60 xl:h-64" : isSecond ? "h-36 md:h-44 lg:h-52 xl:h-56" : "h-28 md:h-36 lg:h-44 xl:h-48"}`,
|
|
68983
69740
|
children: /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center justify-center w-full", children: [
|
|
68984
69741
|
/* @__PURE__ */ jsx("h3", { className: `font-bold text-gray-900 text-center line-clamp-1 mb-1 ${isFirst ? "text-xs md:text-sm lg:text-base xl:text-lg" : "text-[10px] md:text-xs lg:text-sm xl:text-base"}`, children: item.supervisorName }),
|
|
68985
|
-
/* @__PURE__ */ jsx("p", { className: `text-gray-600 text-center line-clamp-1 font-medium opacity-80 bg-white/50 px-2 md:px-3 py-0.5 rounded-full ${isFirst ? "text-[9px] md:text-[10px] lg:text-xs xl:text-sm mb-2 md:mb-3" : "text-[8px] md:text-[9px] lg:text-[10px] xl:text-xs mb-1 md:mb-2"}`, children: item.
|
|
69742
|
+
/* @__PURE__ */ jsx("p", { className: `text-gray-600 text-center line-clamp-1 font-medium opacity-80 bg-white/50 px-2 md:px-3 py-0.5 rounded-full ${isFirst ? "text-[9px] md:text-[10px] lg:text-xs xl:text-sm mb-2 md:mb-3" : "text-[8px] md:text-[9px] lg:text-[10px] xl:text-xs mb-1 md:mb-2"}`, children: item.displayName }),
|
|
69743
|
+
item.rowType === "area" && /* @__PURE__ */ jsxs("span", { className: "mb-1 text-[8px] md:text-[9px] lg:text-[10px] xl:text-xs font-semibold uppercase text-gray-500", children: [
|
|
69744
|
+
item.lines.length,
|
|
69745
|
+
" lines"
|
|
69746
|
+
] }),
|
|
68986
69747
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center mt-auto", children: [
|
|
68987
69748
|
/* @__PURE__ */ jsx("span", { className: `font-bold uppercase tracking-widest mb-0.5 ${isFirst ? "text-yellow-700/70 text-[8px] md:text-[9px] lg:text-[10px] xl:text-xs" : isSecond ? "text-gray-600/70 text-[7px] md:text-[8px] lg:text-[9px] xl:text-[10px]" : "text-orange-700/70 text-[7px] md:text-[8px] lg:text-[9px] xl:text-[10px]"}`, children: viewType === "machine" ? "Utilization" : "Efficiency" }),
|
|
68988
69749
|
/* @__PURE__ */ jsx("span", { className: `font-black tracking-tight leading-none ${isFirst ? "text-lg md:text-xl lg:text-2xl xl:text-3xl text-transparent bg-clip-text bg-gradient-to-br from-yellow-600 to-yellow-800 drop-shadow-sm" : isSecond ? "text-base md:text-lg lg:text-xl xl:text-2xl text-transparent bg-clip-text bg-gradient-to-br from-gray-600 to-gray-800 drop-shadow-sm" : "text-sm md:text-base lg:text-lg xl:text-xl text-transparent bg-clip-text bg-gradient-to-br from-orange-600 to-orange-800 drop-shadow-sm"}`, children: formatEfficiency(item.efficiency) })
|
|
@@ -69005,7 +69766,7 @@ var LinesLeaderboard = ({
|
|
|
69005
69766
|
] }) }),
|
|
69006
69767
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-100", children: leaderboardData.map((item) => {
|
|
69007
69768
|
const isTopThree = item.rank <= 3;
|
|
69008
|
-
const isClickable =
|
|
69769
|
+
const isClickable = canClickLeaderboardRow(item);
|
|
69009
69770
|
return /* @__PURE__ */ jsxs(
|
|
69010
69771
|
"tr",
|
|
69011
69772
|
{
|
|
@@ -69037,7 +69798,13 @@ var LinesLeaderboard = ({
|
|
|
69037
69798
|
] }) : /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center text-gray-500 overflow-hidden border border-gray-200 flex-shrink-0", children: item.supervisorImage ? /* @__PURE__ */ jsx("img", { src: item.supervisorImage, alt: item.supervisorName, className: "w-full h-full object-cover" }) : /* @__PURE__ */ jsx("span", { className: "text-xs font-bold", children: getInitials(item.supervisorName) }) }),
|
|
69038
69799
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-900", children: item.supervisorName })
|
|
69039
69800
|
] }) }),
|
|
69040
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 whitespace-nowrap text-sm text-gray-500", children:
|
|
69801
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 whitespace-nowrap text-sm text-gray-500", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
69802
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-gray-700", children: item.displayName }),
|
|
69803
|
+
item.rowType === "area" && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-400", children: [
|
|
69804
|
+
item.lines.length,
|
|
69805
|
+
" lines"
|
|
69806
|
+
] })
|
|
69807
|
+
] }) }),
|
|
69041
69808
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 whitespace-nowrap text-right", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-end", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900", children: formatEfficiency(item.efficiency) }) }) })
|
|
69042
69809
|
]
|
|
69043
69810
|
},
|
|
@@ -69315,17 +70082,6 @@ var KPIsOverviewView = ({
|
|
|
69315
70082
|
const filterRef = useRef(null);
|
|
69316
70083
|
const filterButtonRef = useRef(null);
|
|
69317
70084
|
const [error, setError] = useState(null);
|
|
69318
|
-
const [topPerformer, setTopPerformer] = useState({
|
|
69319
|
-
name: "Top Performer",
|
|
69320
|
-
role: "Sup.",
|
|
69321
|
-
unit: "Line",
|
|
69322
|
-
periodLabel: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { month: "long", year: "numeric" }),
|
|
69323
|
-
efficiency: null,
|
|
69324
|
-
imageUrl: null,
|
|
69325
|
-
initials: "TP"
|
|
69326
|
-
});
|
|
69327
|
-
const [topPerformerLoading, setTopPerformerLoading] = useState(true);
|
|
69328
|
-
const [topPerformerImageError, setTopPerformerImageError] = useState(false);
|
|
69329
70085
|
const [todayEfficiencyByLineId, setTodayEfficiencyByLineId] = useState(/* @__PURE__ */ new Map());
|
|
69330
70086
|
const [dailyLoading, setDailyLoading] = useState(false);
|
|
69331
70087
|
const [dailyError, setDailyError] = useState(null);
|
|
@@ -69334,6 +70090,9 @@ var KPIsOverviewView = ({
|
|
|
69334
70090
|
const [monthlyError, setMonthlyError] = useState(null);
|
|
69335
70091
|
const dailyRequestKeyRef = useRef(null);
|
|
69336
70092
|
const monthlyRequestKeyRef = useRef(null);
|
|
70093
|
+
const dailyFallbackRequestKeyRef = useRef(null);
|
|
70094
|
+
const pendingTabRouteSyncRef = useRef(null);
|
|
70095
|
+
const [scopedDailyFallbackEfficiencyByLineId, setScopedDailyFallbackEfficiencyByLineId] = useState(/* @__PURE__ */ new Map());
|
|
69337
70096
|
const supabase = useSupabase();
|
|
69338
70097
|
const { user } = useAuth();
|
|
69339
70098
|
const dashboardConfig = useDashboardConfig();
|
|
@@ -69378,8 +70137,23 @@ var KPIsOverviewView = ({
|
|
|
69378
70137
|
const assignedLineIdsForLeaderboard = isSuperAdmin ? void 0 : resolvedAssignedLineIds;
|
|
69379
70138
|
const leaderboardLinesForView = React144__default.useMemo(() => {
|
|
69380
70139
|
const targetMode = viewType === "machine" ? "uptime" : "output";
|
|
69381
|
-
|
|
69382
|
-
|
|
70140
|
+
const metadataByLineId = new Map(lines.map((line) => [line.id, line]));
|
|
70141
|
+
return leaderboardLines.map((line) => {
|
|
70142
|
+
const metadata = metadataByLineId.get(line.id);
|
|
70143
|
+
return metadata ? {
|
|
70144
|
+
...line,
|
|
70145
|
+
factory_id: line.factory_id || metadata.factory_id,
|
|
70146
|
+
factory_name: line.factory_name || metadata.factory_name,
|
|
70147
|
+
company_name: line.company_name || metadata.company_name,
|
|
70148
|
+
monitoring_mode: line.monitoring_mode ?? metadata.monitoring_mode,
|
|
70149
|
+
factory_area_id: line.factory_area_id ?? metadata.factory_area_id ?? null,
|
|
70150
|
+
factory_area_key: line.factory_area_key ?? metadata.factory_area_key ?? null,
|
|
70151
|
+
factory_area_name: line.factory_area_name ?? metadata.factory_area_name ?? null,
|
|
70152
|
+
factory_area_sort_order: line.factory_area_sort_order ?? metadata.factory_area_sort_order ?? null,
|
|
70153
|
+
factory_area_enabled: line.factory_area_enabled ?? metadata.factory_area_enabled ?? null
|
|
70154
|
+
} : line;
|
|
70155
|
+
}).filter((line) => (line.monitoring_mode ?? "output") === targetMode);
|
|
70156
|
+
}, [leaderboardLines, lines, viewType]);
|
|
69383
70157
|
const linesForView = React144__default.useMemo(() => {
|
|
69384
70158
|
const targetMode = viewType === "machine" ? "uptime" : "output";
|
|
69385
70159
|
return lines.filter((line) => (line.monitoring_mode ?? "output") === targetMode);
|
|
@@ -69499,12 +70273,19 @@ var KPIsOverviewView = ({
|
|
|
69499
70273
|
useEffect(() => {
|
|
69500
70274
|
if (!router.isReady || !hasHydratedLeaderboardRouteState) return;
|
|
69501
70275
|
if (activeTab === "today" && loading) return;
|
|
70276
|
+
const currentTab = typeof router.query.tab === "string" ? router.query.tab : void 0;
|
|
70277
|
+
const currentRouteTab = currentTab === "leaderboard" ? "leaderboard" : "today";
|
|
70278
|
+
if (currentRouteTab !== activeTab) {
|
|
70279
|
+
if (pendingTabRouteSyncRef.current !== activeTab) {
|
|
70280
|
+
return;
|
|
70281
|
+
}
|
|
70282
|
+
pendingTabRouteSyncRef.current = null;
|
|
70283
|
+
}
|
|
69502
70284
|
const expectedTab = activeTab === "leaderboard" ? "leaderboard" : void 0;
|
|
69503
70285
|
const expectedDate = activeTab === "leaderboard" && timeRange === "today" && isHistoricalLeaderboardDaily ? effectiveLeaderboardDate : void 0;
|
|
69504
70286
|
const expectedShift = expectedDate !== void 0 ? effectiveLeaderboardShiftId.toString() : void 0;
|
|
69505
70287
|
const expectedFactory = activeTab === "today" && selectedFactoryNode ? selectedFactoryNode.id : void 0;
|
|
69506
70288
|
const expectedFactoryArea = activeTab === "today" && selectedFactoryNode && selectedFactoryAreaNode ? selectedFactoryAreaNode.id : void 0;
|
|
69507
|
-
const currentTab = typeof router.query.tab === "string" ? router.query.tab : void 0;
|
|
69508
70289
|
const currentDateQuery = typeof router.query.date === "string" ? router.query.date : void 0;
|
|
69509
70290
|
const currentShiftQuery = typeof router.query.shift === "string" ? router.query.shift : void 0;
|
|
69510
70291
|
const currentFactoryQuery = getSingleQueryValue(router.query[KPI_FACTORY_QUERY_PARAM]);
|
|
@@ -69564,6 +70345,35 @@ var KPIsOverviewView = ({
|
|
|
69564
70345
|
});
|
|
69565
70346
|
return map;
|
|
69566
70347
|
}, [lineMetrics, lineModeById]);
|
|
70348
|
+
const liveDailyFallbackEfficiencyByLineId = React144__default.useMemo(() => {
|
|
70349
|
+
const map = /* @__PURE__ */ new Map();
|
|
70350
|
+
lineMetricRowsByLineId.forEach((row, lineId) => {
|
|
70351
|
+
const value = Number(row?.avg_efficiency);
|
|
70352
|
+
if (!Number.isFinite(value)) return;
|
|
70353
|
+
const rowDate = typeof row?.date === "string" ? row.date : typeof row?.operational_date === "string" ? row.operational_date : void 0;
|
|
70354
|
+
const rawShiftId = row?.shift_id ?? row?.shiftId;
|
|
70355
|
+
const parsedShiftId = typeof rawShiftId === "number" ? rawShiftId : Number.parseInt(String(rawShiftId ?? ""), 10);
|
|
70356
|
+
const hasScopedRow = rowDate !== void 0 || rawShiftId !== void 0;
|
|
70357
|
+
const matchesSelectedScope = rowDate === effectiveLeaderboardDate && Number.isFinite(parsedShiftId) && parsedShiftId === effectiveLeaderboardShiftId;
|
|
70358
|
+
const canUseUnscopedLiveFallback = !isHistoricalLeaderboardDaily && !hasScopedRow;
|
|
70359
|
+
if (matchesSelectedScope || canUseUnscopedLiveFallback) {
|
|
70360
|
+
map.set(lineId, value);
|
|
70361
|
+
}
|
|
70362
|
+
});
|
|
70363
|
+
return map;
|
|
70364
|
+
}, [
|
|
70365
|
+
effectiveLeaderboardDate,
|
|
70366
|
+
effectiveLeaderboardShiftId,
|
|
70367
|
+
isHistoricalLeaderboardDaily,
|
|
70368
|
+
lineMetricRowsByLineId
|
|
70369
|
+
]);
|
|
70370
|
+
const dailyFallbackEfficiencyByLineId = React144__default.useMemo(() => {
|
|
70371
|
+
const map = new Map(liveDailyFallbackEfficiencyByLineId);
|
|
70372
|
+
scopedDailyFallbackEfficiencyByLineId.forEach((value, lineId) => {
|
|
70373
|
+
map.set(lineId, value);
|
|
70374
|
+
});
|
|
70375
|
+
return map;
|
|
70376
|
+
}, [liveDailyFallbackEfficiencyByLineId, scopedDailyFallbackEfficiencyByLineId]);
|
|
69567
70377
|
const kpisByLineId = React144__default.useMemo(() => {
|
|
69568
70378
|
const map = /* @__PURE__ */ new Map();
|
|
69569
70379
|
lineMetricRowsByLineId.forEach((row, lineId) => {
|
|
@@ -69585,32 +70395,11 @@ var KPIsOverviewView = ({
|
|
|
69585
70395
|
() => (leaderboardLines.length > 0 ? leaderboardLines : lines).map((l) => l.id),
|
|
69586
70396
|
[leaderboardLines, lines]
|
|
69587
70397
|
);
|
|
69588
|
-
const { supervisorNamesByLineId, supervisorsByLineId
|
|
70398
|
+
const { supervisorNamesByLineId, supervisorsByLineId } = useSupervisorsByLineIds(supervisorLineIds, {
|
|
69589
70399
|
enabled: supervisorEnabled && supervisorLineIds.length > 0,
|
|
69590
70400
|
companyId: resolvedCompanyId,
|
|
69591
70401
|
useBackend: true
|
|
69592
70402
|
});
|
|
69593
|
-
useEffect(() => {
|
|
69594
|
-
let isMounted = true;
|
|
69595
|
-
const loadTopPerformer = async () => {
|
|
69596
|
-
try {
|
|
69597
|
-
const record = await awardsService.getTopPerformer(supabase, resolvedCompanyId);
|
|
69598
|
-
if (!isMounted) return;
|
|
69599
|
-
if (record) {
|
|
69600
|
-
setTopPerformer(buildTopPerformerDisplay(record));
|
|
69601
|
-
setTopPerformerImageError(false);
|
|
69602
|
-
}
|
|
69603
|
-
} catch (err) {
|
|
69604
|
-
console.error("[KPIsOverviewView] Failed to load top performer:", err);
|
|
69605
|
-
} finally {
|
|
69606
|
-
if (isMounted) setTopPerformerLoading(false);
|
|
69607
|
-
}
|
|
69608
|
-
};
|
|
69609
|
-
loadTopPerformer();
|
|
69610
|
-
return () => {
|
|
69611
|
-
isMounted = false;
|
|
69612
|
-
};
|
|
69613
|
-
}, [supabase, resolvedCompanyId]);
|
|
69614
70403
|
useEffect(() => {
|
|
69615
70404
|
trackCorePageView("KPIs Overview");
|
|
69616
70405
|
}, []);
|
|
@@ -69660,16 +70449,25 @@ var KPIsOverviewView = ({
|
|
|
69660
70449
|
`/api/dashboard/leaderboard-lines?company_id=${encodeURIComponent(resolvedCompanyId)}`
|
|
69661
70450
|
);
|
|
69662
70451
|
if (!isMounted) return;
|
|
69663
|
-
const
|
|
69664
|
-
|
|
69665
|
-
|
|
69666
|
-
|
|
69667
|
-
|
|
69668
|
-
|
|
69669
|
-
|
|
69670
|
-
|
|
69671
|
-
|
|
69672
|
-
|
|
70452
|
+
const metadataByLineId = new Map(lines.map((line) => [line.id, line]));
|
|
70453
|
+
const transformed = (data.lines || []).filter((line) => line.enable !== false).map((line) => {
|
|
70454
|
+
const metadata = metadataByLineId.get(line.id);
|
|
70455
|
+
return {
|
|
70456
|
+
id: line.id,
|
|
70457
|
+
line_name: line.line_name,
|
|
70458
|
+
factory_id: line.factory_id || metadata?.factory_id || "",
|
|
70459
|
+
factory_name: metadata?.factory_name || "N/A",
|
|
70460
|
+
company_id: line.company_id,
|
|
70461
|
+
company_name: metadata?.company_name || "",
|
|
70462
|
+
enable: line.enable ?? true,
|
|
70463
|
+
monitoring_mode: line.monitoring_mode ?? metadata?.monitoring_mode ?? "output",
|
|
70464
|
+
factory_area_id: line.factory_area_id ?? metadata?.factory_area_id ?? null,
|
|
70465
|
+
factory_area_key: line.factory_area_key ?? metadata?.factory_area_key ?? null,
|
|
70466
|
+
factory_area_name: line.factory_area_name ?? metadata?.factory_area_name ?? null,
|
|
70467
|
+
factory_area_sort_order: line.factory_area_sort_order ?? metadata?.factory_area_sort_order ?? null,
|
|
70468
|
+
factory_area_enabled: line.factory_area_enabled ?? metadata?.factory_area_enabled ?? null
|
|
70469
|
+
};
|
|
70470
|
+
});
|
|
69673
70471
|
setLeaderboardLines(transformed);
|
|
69674
70472
|
} catch (err) {
|
|
69675
70473
|
console.error("[KPIsOverviewView] Failed to load leaderboard lines:", err);
|
|
@@ -69684,6 +70482,58 @@ var KPIsOverviewView = ({
|
|
|
69684
70482
|
isMounted = false;
|
|
69685
70483
|
};
|
|
69686
70484
|
}, [supabase, resolvedCompanyId, lines]);
|
|
70485
|
+
useEffect(() => {
|
|
70486
|
+
if (activeTab !== "leaderboard" || timeRange !== "today") return;
|
|
70487
|
+
if (!supabase || !resolvedCompanyId || !effectiveLeaderboardDate || leaderboardLinesForView.length === 0) {
|
|
70488
|
+
setScopedDailyFallbackEfficiencyByLineId(/* @__PURE__ */ new Map());
|
|
70489
|
+
return;
|
|
70490
|
+
}
|
|
70491
|
+
const targetLineIds = leaderboardLinesForView.map((line) => line.id);
|
|
70492
|
+
const lineIdsKey = targetLineIds.slice().sort().join(",");
|
|
70493
|
+
const requestKey = `${effectiveLeaderboardDate}|${effectiveLeaderboardShiftId}|${lineIdsKey}`;
|
|
70494
|
+
if (dailyFallbackRequestKeyRef.current === requestKey) return;
|
|
70495
|
+
dailyFallbackRequestKeyRef.current = requestKey;
|
|
70496
|
+
let isMounted = true;
|
|
70497
|
+
const fetchScopedFallbackEfficiencies = async () => {
|
|
70498
|
+
try {
|
|
70499
|
+
const entries = await lineLeaderboardService.getDailyLineLeaderboard(supabase, {
|
|
70500
|
+
companyId: resolvedCompanyId,
|
|
70501
|
+
date: effectiveLeaderboardDate,
|
|
70502
|
+
shiftId: effectiveLeaderboardShiftId,
|
|
70503
|
+
lineIds: targetLineIds,
|
|
70504
|
+
lineMode: viewType === "machine" ? "uptime" : "output",
|
|
70505
|
+
includeBelowThreshold: true
|
|
70506
|
+
});
|
|
70507
|
+
if (!isMounted) return;
|
|
70508
|
+
const nextMap = /* @__PURE__ */ new Map();
|
|
70509
|
+
entries.forEach((entry) => {
|
|
70510
|
+
const value = Number(entry.avg_efficiency);
|
|
70511
|
+
if (Number.isFinite(value)) {
|
|
70512
|
+
nextMap.set(entry.line_id, value);
|
|
70513
|
+
}
|
|
70514
|
+
});
|
|
70515
|
+
setScopedDailyFallbackEfficiencyByLineId(nextMap);
|
|
70516
|
+
} catch (err) {
|
|
70517
|
+
if (!isMounted) return;
|
|
70518
|
+
console.warn("[KPIsOverviewView] Failed to load daily fallback line efficiencies:", err);
|
|
70519
|
+
setScopedDailyFallbackEfficiencyByLineId(/* @__PURE__ */ new Map());
|
|
70520
|
+
dailyFallbackRequestKeyRef.current = null;
|
|
70521
|
+
}
|
|
70522
|
+
};
|
|
70523
|
+
void fetchScopedFallbackEfficiencies();
|
|
70524
|
+
return () => {
|
|
70525
|
+
isMounted = false;
|
|
70526
|
+
};
|
|
70527
|
+
}, [
|
|
70528
|
+
activeTab,
|
|
70529
|
+
effectiveLeaderboardDate,
|
|
70530
|
+
effectiveLeaderboardShiftId,
|
|
70531
|
+
leaderboardLinesForView,
|
|
70532
|
+
resolvedCompanyId,
|
|
70533
|
+
supabase,
|
|
70534
|
+
timeRange,
|
|
70535
|
+
viewType
|
|
70536
|
+
]);
|
|
69687
70537
|
const fetchMonthlyLeaderboard = useCallback(async () => {
|
|
69688
70538
|
if (!supabase || !resolvedCompanyId || leaderboardLinesForView.length === 0) return;
|
|
69689
70539
|
const targetLineIds = leaderboardLinesForView.map((line) => line.id);
|
|
@@ -69705,10 +70555,11 @@ var KPIsOverviewView = ({
|
|
|
69705
70555
|
lineMode: viewType === "machine" ? "uptime" : "output"
|
|
69706
70556
|
});
|
|
69707
70557
|
const nextMap = /* @__PURE__ */ new Map();
|
|
69708
|
-
targetLineIds.forEach((lineId) => nextMap.set(lineId, 0));
|
|
69709
70558
|
entries.forEach((entry) => {
|
|
69710
70559
|
const value = Number(entry.avg_efficiency);
|
|
69711
|
-
|
|
70560
|
+
if (Number.isFinite(value)) {
|
|
70561
|
+
nextMap.set(entry.line_id, value);
|
|
70562
|
+
}
|
|
69712
70563
|
});
|
|
69713
70564
|
setMonthlyEfficiencyByLineId(nextMap);
|
|
69714
70565
|
trackCoreEvent("Leaderboard Monthly Data Fetched", {
|
|
@@ -69755,10 +70606,11 @@ var KPIsOverviewView = ({
|
|
|
69755
70606
|
lineMode: viewType === "machine" ? "uptime" : "output"
|
|
69756
70607
|
});
|
|
69757
70608
|
const nextMap = /* @__PURE__ */ new Map();
|
|
69758
|
-
targetLineIds.forEach((lineId) => nextMap.set(lineId, 0));
|
|
69759
70609
|
entries.forEach((entry) => {
|
|
69760
70610
|
const value = Number(entry.avg_efficiency);
|
|
69761
|
-
|
|
70611
|
+
if (Number.isFinite(value)) {
|
|
70612
|
+
nextMap.set(entry.line_id, value);
|
|
70613
|
+
}
|
|
69762
70614
|
});
|
|
69763
70615
|
setTodayEfficiencyByLineId(nextMap);
|
|
69764
70616
|
} catch (err) {
|
|
@@ -69798,69 +70650,6 @@ var KPIsOverviewView = ({
|
|
|
69798
70650
|
factoryAreaId: selectedFactoryAreaNode?.id
|
|
69799
70651
|
});
|
|
69800
70652
|
}, [activeTab, selectedFactoryNode, selectedFactoryAreaNode]);
|
|
69801
|
-
const formatTopPerformerWeek = (periodStart, periodEnd) => {
|
|
69802
|
-
const dateToUse = periodStart ? /* @__PURE__ */ new Date(`${periodStart}T00:00:00`) : /* @__PURE__ */ new Date();
|
|
69803
|
-
if (Number.isNaN(dateToUse.getTime())) {
|
|
69804
|
-
return (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { month: "long", year: "numeric" });
|
|
69805
|
-
}
|
|
69806
|
-
return dateToUse.toLocaleDateString("en-US", { month: "long", year: "numeric" });
|
|
69807
|
-
};
|
|
69808
|
-
const buildTopPerformerDisplay = (record) => {
|
|
69809
|
-
const supervisorAvatars = [];
|
|
69810
|
-
if (record.supervisors && record.supervisors.length > 0) {
|
|
69811
|
-
for (const s of record.supervisors) {
|
|
69812
|
-
let supervisorName = "Supervisor";
|
|
69813
|
-
if (s.first_name) {
|
|
69814
|
-
supervisorName = s.last_name ? `${s.first_name} ${s.last_name}` : s.first_name;
|
|
69815
|
-
}
|
|
69816
|
-
supervisorAvatars.push({
|
|
69817
|
-
userId: s.user_id,
|
|
69818
|
-
name: supervisorName,
|
|
69819
|
-
imageUrl: s.profile_photo_url || null,
|
|
69820
|
-
initials: getInitials(supervisorName)
|
|
69821
|
-
});
|
|
69822
|
-
}
|
|
69823
|
-
}
|
|
69824
|
-
let displayName = record.recipient_name || "Supervisor";
|
|
69825
|
-
if (record.first_name) {
|
|
69826
|
-
displayName = record.last_name ? `${record.first_name} ${record.last_name}` : record.first_name;
|
|
69827
|
-
} else if (record.recipient_user_id && allSupervisorsMap?.has(record.recipient_user_id)) {
|
|
69828
|
-
const supervisor = allSupervisorsMap.get(record.recipient_user_id);
|
|
69829
|
-
if (supervisor) {
|
|
69830
|
-
displayName = supervisor.displayName;
|
|
69831
|
-
}
|
|
69832
|
-
} else if (displayName.includes(".") || displayName.includes("@")) {
|
|
69833
|
-
const parts = displayName.split(/[.@]/);
|
|
69834
|
-
if (parts.length >= 2) {
|
|
69835
|
-
const firstName = parts[0].charAt(0).toUpperCase() + parts[0].slice(1);
|
|
69836
|
-
const lastName = parts[1].charAt(0).toUpperCase() + parts[1].slice(1);
|
|
69837
|
-
displayName = `${firstName} ${lastName}`;
|
|
69838
|
-
} else if (parts.length === 1) {
|
|
69839
|
-
displayName = parts[0].charAt(0).toUpperCase() + parts[0].slice(1);
|
|
69840
|
-
}
|
|
69841
|
-
}
|
|
69842
|
-
if (supervisorAvatars.length === 0 && record.recipient_user_id) {
|
|
69843
|
-
supervisorAvatars.push({
|
|
69844
|
-
userId: record.recipient_user_id,
|
|
69845
|
-
name: displayName,
|
|
69846
|
-
imageUrl: record.profile_photo_url || null,
|
|
69847
|
-
initials: getInitials(displayName)
|
|
69848
|
-
});
|
|
69849
|
-
}
|
|
69850
|
-
const efficiencyValue = typeof record.avg_efficiency === "number" ? record.avg_efficiency : Number.parseFloat(String(record.avg_efficiency));
|
|
69851
|
-
const efficiency = Number.isFinite(efficiencyValue) ? efficiencyValue : null;
|
|
69852
|
-
const unitLabel = record.winning_line_name || record.unit || "Line";
|
|
69853
|
-
return {
|
|
69854
|
-
name: displayName,
|
|
69855
|
-
role: "Sup.",
|
|
69856
|
-
unit: unitLabel,
|
|
69857
|
-
periodLabel: formatTopPerformerWeek(record.period_start, record.period_end),
|
|
69858
|
-
efficiency,
|
|
69859
|
-
imageUrl: record.profile_photo_url || null,
|
|
69860
|
-
initials: getInitials(displayName),
|
|
69861
|
-
supervisors: supervisorAvatars.length > 0 ? supervisorAvatars : void 0
|
|
69862
|
-
};
|
|
69863
|
-
};
|
|
69864
70653
|
const handleLineClick = (line, kpis) => {
|
|
69865
70654
|
if (!isSuperAdmin && !assignedLineIdSet.has(line.id)) {
|
|
69866
70655
|
return;
|
|
@@ -69908,6 +70697,7 @@ var KPIsOverviewView = ({
|
|
|
69908
70697
|
from_page: "kpis_overview",
|
|
69909
70698
|
lines_count: trackedLineCount
|
|
69910
70699
|
});
|
|
70700
|
+
pendingTabRouteSyncRef.current = newTab;
|
|
69911
70701
|
setActiveTab(newTab);
|
|
69912
70702
|
}, [activeTab, leaderboardLines.length, lines.length]);
|
|
69913
70703
|
const formatLocalDate2 = useCallback((dateKey) => {
|
|
@@ -69932,10 +70722,8 @@ var KPIsOverviewView = ({
|
|
|
69932
70722
|
const isMonthlyMode = activeTab === "leaderboard" && timeRange === "monthly";
|
|
69933
70723
|
const isLeaderboardLoading = timeRange === "today" ? dailyLoading : monthlyLoading;
|
|
69934
70724
|
const currentEfficiencyMap = timeRange === "today" ? todayEfficiencyByLineId : monthlyEfficiencyByLineId;
|
|
69935
|
-
const
|
|
69936
|
-
const
|
|
69937
|
-
typeof topPerformer.efficiency === "number" && Number.isFinite(topPerformer.efficiency);
|
|
69938
|
-
topPerformerLoading ? "--" : typeof topPerformer.efficiency === "number" && Number.isFinite(topPerformer.efficiency) ? `${topPerformer.efficiency.toFixed(1)}%` : "--";
|
|
70725
|
+
const currentFallbackEfficiencyMap = timeRange === "today" ? dailyFallbackEfficiencyByLineId : void 0;
|
|
70726
|
+
const showLeaderboardLoader = activeTab === "leaderboard" && (leaderboardLinesLoading || isLeaderboardLoading && currentEfficiencyMap.size === 0 && (currentFallbackEfficiencyMap?.size ?? 0) === 0);
|
|
69939
70727
|
const showHistoricalLeaderboardHeader = activeTab === "leaderboard" && timeRange === "today" && isHistoricalLeaderboardDaily;
|
|
69940
70728
|
const headerDateKey = activeTab === "leaderboard" && timeRange === "today" ? effectiveLeaderboardDate : monthEndDateKey;
|
|
69941
70729
|
const headerShiftId = showHistoricalLeaderboardHeader ? effectiveLeaderboardShiftId : currentShiftDetails.shiftId;
|
|
@@ -70140,72 +70928,6 @@ var KPIsOverviewView = ({
|
|
|
70140
70928
|
] }) : /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-green-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-700", children: /* @__PURE__ */ jsx(ISTTimer_default, {}) }) })
|
|
70141
70929
|
] })
|
|
70142
70930
|
] }),
|
|
70143
|
-
activeTab !== "leaderboard" && /* @__PURE__ */ jsx("div", { className: "mt-4 bg-white shadow-md hover:shadow-lg transition-all duration-300 ease-out hover:scale-[1.01] relative rounded-2xl border border-amber-100 pl-2 pr-4 py-1.5 flex items-center justify-between group", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
70144
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex-shrink-0", children: [
|
|
70145
|
-
(!topPerformer.supervisors || topPerformer.supervisors.length <= 1) && /* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-full border-2 border-amber-100 overflow-hidden bg-amber-50 shadow-sm transition-transform group-hover:scale-105", children: showTopPerformerImage ? /* @__PURE__ */ jsx(
|
|
70146
|
-
"img",
|
|
70147
|
-
{
|
|
70148
|
-
src: topPerformer.imageUrl || "",
|
|
70149
|
-
alt: "Top Performer",
|
|
70150
|
-
className: "w-full h-full object-cover",
|
|
70151
|
-
onError: () => setTopPerformerImageError(true)
|
|
70152
|
-
}
|
|
70153
|
-
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center bg-amber-50 text-sm font-bold text-amber-600", children: topPerformer.initials }) }),
|
|
70154
|
-
topPerformer.supervisors && topPerformer.supervisors.length > 1 && /* @__PURE__ */ jsxs("div", { className: "flex -space-x-2", children: [
|
|
70155
|
-
topPerformer.supervisors.slice(0, 3).map((supervisor, idx) => /* @__PURE__ */ jsxs(
|
|
70156
|
-
"div",
|
|
70157
|
-
{
|
|
70158
|
-
className: "relative inline-block w-9 h-9 rounded-full ring-2 ring-white bg-amber-50 shadow-sm z-0 hover:z-10 transition-all hover:scale-110 group/avatar",
|
|
70159
|
-
style: { zIndex: 3 - idx },
|
|
70160
|
-
children: [
|
|
70161
|
-
supervisor.imageUrl ? /* @__PURE__ */ jsx(
|
|
70162
|
-
"img",
|
|
70163
|
-
{
|
|
70164
|
-
src: supervisor.imageUrl,
|
|
70165
|
-
alt: supervisor.name,
|
|
70166
|
-
className: "w-full h-full object-cover rounded-full"
|
|
70167
|
-
}
|
|
70168
|
-
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-xs font-bold text-amber-600 uppercase rounded-full", children: supervisor.initials }),
|
|
70169
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-[10px] font-medium rounded shadow-lg opacity-0 group-hover/avatar:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-20", children: [
|
|
70170
|
-
supervisor.name,
|
|
70171
|
-
/* @__PURE__ */ jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 -mt-[1px] border-4 border-transparent border-t-gray-900" })
|
|
70172
|
-
] })
|
|
70173
|
-
]
|
|
70174
|
-
},
|
|
70175
|
-
supervisor.userId
|
|
70176
|
-
)),
|
|
70177
|
-
topPerformer.supervisors.length > 3 && /* @__PURE__ */ jsxs("div", { className: "inline-flex w-9 h-9 rounded-full ring-2 ring-white bg-amber-100 items-center justify-center text-xs font-medium text-amber-700 z-0", children: [
|
|
70178
|
-
"+",
|
|
70179
|
-
topPerformer.supervisors.length - 3
|
|
70180
|
-
] })
|
|
70181
|
-
] })
|
|
70182
|
-
] }),
|
|
70183
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
70184
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 leading-none mb-1", children: [
|
|
70185
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-amber-600 uppercase tracking-widest", children: "Performer of the month" }),
|
|
70186
|
-
/* @__PURE__ */ jsx("span", { className: "w-1 h-1 bg-amber-200 rounded-full" }),
|
|
70187
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-semibold text-gray-400", children: topPerformerLoading ? "Loading" : topPerformer.periodLabel })
|
|
70188
|
-
] }),
|
|
70189
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 leading-none", children: [
|
|
70190
|
-
/* @__PURE__ */ jsx("div", { className: "max-w-[140px]", children: /* @__PURE__ */ jsx(
|
|
70191
|
-
FittingTitle,
|
|
70192
|
-
{
|
|
70193
|
-
title: topPerformer.name,
|
|
70194
|
-
as: "span",
|
|
70195
|
-
className: "text-sm text-gray-900 font-bold"
|
|
70196
|
-
}
|
|
70197
|
-
) }),
|
|
70198
|
-
/* @__PURE__ */ jsx("span", { className: "w-px h-3 bg-gray-200 flex-shrink-0" }),
|
|
70199
|
-
/* @__PURE__ */ jsx("div", { className: "max-w-[120px]", children: /* @__PURE__ */ jsx(
|
|
70200
|
-
FittingTitle,
|
|
70201
|
-
{
|
|
70202
|
-
title: topPerformer.unit,
|
|
70203
|
-
className: "text-xs font-medium text-gray-500"
|
|
70204
|
-
}
|
|
70205
|
-
) })
|
|
70206
|
-
] })
|
|
70207
|
-
] })
|
|
70208
|
-
] }) }),
|
|
70209
70931
|
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex bg-gray-100/80 p-1 rounded-xl w-full", children: [
|
|
70210
70932
|
/* @__PURE__ */ jsx(
|
|
70211
70933
|
"button",
|
|
@@ -70240,86 +70962,18 @@ var KPIsOverviewView = ({
|
|
|
70240
70962
|
/* @__PURE__ */ jsx("h1", { className: "text-2xl md:text-3xl lg:text-4xl font-semibold text-gray-900 tracking-tight", children: activeTab === "leaderboard" ? "Leaderboard" : "Overview" }),
|
|
70241
70963
|
!showHistoricalLeaderboardHeader && /* @__PURE__ */ jsx("div", { className: "h-2.5 w-2.5 rounded-full ring-4 flex-shrink-0 bg-emerald-500 animate-pulse ring-emerald-500/10" })
|
|
70242
70964
|
] }),
|
|
70243
|
-
/* @__PURE__ */
|
|
70244
|
-
|
|
70245
|
-
|
|
70246
|
-
|
|
70247
|
-
|
|
70248
|
-
|
|
70249
|
-
|
|
70250
|
-
|
|
70251
|
-
|
|
70252
|
-
|
|
70253
|
-
|
|
70254
|
-
|
|
70255
|
-
topPerformer.supervisors && topPerformer.supervisors.length > 1 && /* @__PURE__ */ jsxs("div", { className: "flex -space-x-2", children: [
|
|
70256
|
-
topPerformer.supervisors.slice(0, 3).map((supervisor, idx) => /* @__PURE__ */ jsxs(
|
|
70257
|
-
"div",
|
|
70258
|
-
{
|
|
70259
|
-
className: "relative inline-block w-10 h-10 rounded-full ring-2 ring-white bg-amber-50 shadow-sm z-0 hover:z-10 transition-all hover:scale-110 group/avatar",
|
|
70260
|
-
style: { zIndex: 3 - idx },
|
|
70261
|
-
children: [
|
|
70262
|
-
supervisor.imageUrl ? /* @__PURE__ */ jsx(
|
|
70263
|
-
"img",
|
|
70264
|
-
{
|
|
70265
|
-
src: supervisor.imageUrl,
|
|
70266
|
-
alt: supervisor.name,
|
|
70267
|
-
className: "w-full h-full object-cover rounded-full"
|
|
70268
|
-
}
|
|
70269
|
-
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-sm font-bold text-amber-600 uppercase rounded-full", children: supervisor.initials }),
|
|
70270
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-gray-900 text-white text-[10px] font-medium rounded shadow-lg opacity-0 group-hover/avatar:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-20", children: [
|
|
70271
|
-
supervisor.name,
|
|
70272
|
-
/* @__PURE__ */ jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 -mt-[1px] border-4 border-transparent border-t-gray-900" })
|
|
70273
|
-
] })
|
|
70274
|
-
]
|
|
70275
|
-
},
|
|
70276
|
-
supervisor.userId
|
|
70277
|
-
)),
|
|
70278
|
-
topPerformer.supervisors.length > 3 && /* @__PURE__ */ jsxs("div", { className: "inline-flex w-10 h-10 rounded-full ring-2 ring-white bg-amber-100 items-center justify-center text-sm font-medium text-amber-700 z-0", children: [
|
|
70279
|
-
"+",
|
|
70280
|
-
topPerformer.supervisors.length - 3
|
|
70281
|
-
] })
|
|
70282
|
-
] })
|
|
70283
|
-
] }),
|
|
70284
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
70285
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[10px] leading-tight mb-1", children: [
|
|
70286
|
-
/* @__PURE__ */ jsx("span", { className: "font-bold text-amber-600 uppercase tracking-widest", children: "Performer of the month" }),
|
|
70287
|
-
/* @__PURE__ */ jsx("span", { className: "text-amber-200 opacity-50", children: "\u2022" }),
|
|
70288
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-400", children: topPerformer.periodLabel })
|
|
70289
|
-
] }),
|
|
70290
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 leading-tight", children: [
|
|
70291
|
-
/* @__PURE__ */ jsx("div", { className: "max-w-[140px]", children: /* @__PURE__ */ jsx(
|
|
70292
|
-
FittingTitle,
|
|
70293
|
-
{
|
|
70294
|
-
title: topPerformer.name,
|
|
70295
|
-
as: "span",
|
|
70296
|
-
className: "text-sm text-gray-900 font-bold"
|
|
70297
|
-
}
|
|
70298
|
-
) }),
|
|
70299
|
-
/* @__PURE__ */ jsx("span", { className: "w-px h-3.5 bg-gray-200 flex-shrink-0" }),
|
|
70300
|
-
/* @__PURE__ */ jsx("div", { className: "max-w-[150px]", children: /* @__PURE__ */ jsx(
|
|
70301
|
-
FittingTitle,
|
|
70302
|
-
{
|
|
70303
|
-
title: topPerformer.unit,
|
|
70304
|
-
className: "text-xs font-medium text-gray-500"
|
|
70305
|
-
}
|
|
70306
|
-
) })
|
|
70307
|
-
] })
|
|
70308
|
-
] })
|
|
70309
|
-
] }),
|
|
70310
|
-
activeTab === "leaderboard" && isHistoricalLeaderboardDaily && /* @__PURE__ */ jsx(
|
|
70311
|
-
"button",
|
|
70312
|
-
{
|
|
70313
|
-
type: "button",
|
|
70314
|
-
onClick: () => {
|
|
70315
|
-
setSelectedLeaderboardDate(currentShiftDate);
|
|
70316
|
-
setSelectedLeaderboardShiftId(currentShiftId);
|
|
70317
|
-
},
|
|
70318
|
-
className: "text-xs sm:text-sm font-medium text-blue-600 bg-blue-50 border border-blue-100 hover:bg-blue-100 hover:text-blue-700 px-3 py-1.5 rounded-lg transition-colors shadow-sm ml-4 whitespace-nowrap",
|
|
70319
|
-
children: "Return to Live"
|
|
70320
|
-
}
|
|
70321
|
-
)
|
|
70322
|
-
] })
|
|
70965
|
+
/* @__PURE__ */ jsx("div", { className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 flex items-center", children: activeTab === "leaderboard" && isHistoricalLeaderboardDaily && /* @__PURE__ */ jsx(
|
|
70966
|
+
"button",
|
|
70967
|
+
{
|
|
70968
|
+
type: "button",
|
|
70969
|
+
onClick: () => {
|
|
70970
|
+
setSelectedLeaderboardDate(currentShiftDate);
|
|
70971
|
+
setSelectedLeaderboardShiftId(currentShiftId);
|
|
70972
|
+
},
|
|
70973
|
+
className: "text-xs sm:text-sm font-medium text-blue-600 bg-blue-50 border border-blue-100 hover:bg-blue-100 hover:text-blue-700 px-3 py-1.5 rounded-lg transition-colors shadow-sm ml-4 whitespace-nowrap",
|
|
70974
|
+
children: "Return to Live"
|
|
70975
|
+
}
|
|
70976
|
+
) })
|
|
70323
70977
|
] }),
|
|
70324
70978
|
/* @__PURE__ */ jsx("div", { className: "bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-6", children: [
|
|
70325
70979
|
!isMonthlyMode && !showHistoricalLeaderboardHeader && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -70494,6 +71148,7 @@ var KPIsOverviewView = ({
|
|
|
70494
71148
|
timeRange,
|
|
70495
71149
|
setTimeRange,
|
|
70496
71150
|
todayEfficiencyByLineId,
|
|
71151
|
+
dailyFallbackEfficiencyByLineId,
|
|
70497
71152
|
monthlyEfficiencyByLineId,
|
|
70498
71153
|
supervisorsByLineId,
|
|
70499
71154
|
supervisorNamesByLineId,
|
|
@@ -70526,13 +71181,23 @@ var AnimatedEfficiency = memo$1(({ value }) => {
|
|
|
70526
71181
|
AnimatedEfficiency.displayName = "AnimatedEfficiency";
|
|
70527
71182
|
var getWorkspaceLeaderboardMetricValue = (workspace) => {
|
|
70528
71183
|
if (workspace.leaderboard_metric_kind === "recent_flow_shift_average") {
|
|
70529
|
-
|
|
71184
|
+
const cycleRatio = getCycleRatio(workspace);
|
|
71185
|
+
return cycleRatio === null ? null : cycleRatio * 100;
|
|
70530
71186
|
}
|
|
70531
71187
|
return toFiniteNumber(workspace.leaderboard_value) ?? toFiniteNumber(workspace.efficiency);
|
|
70532
71188
|
};
|
|
70533
71189
|
var getWorkspaceDisplayedMetricValue = (workspace) => getWorkspaceLeaderboardMetricValue(workspace);
|
|
70534
|
-
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "recent_flow_shift_average" ? "
|
|
71190
|
+
var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "recent_flow_shift_average" ? "Actual CT / Standard CT" : defaultLabel;
|
|
70535
71191
|
var renderWorkspaceLeaderboardMetric = (workspace) => {
|
|
71192
|
+
if (workspace.leaderboard_metric_kind === "recent_flow_shift_average") {
|
|
71193
|
+
const actualCT = formatCycleTimeValue(workspace.avg_cycle_time);
|
|
71194
|
+
const standardCT = formatCycleTimeValue(workspace.ideal_cycle_time);
|
|
71195
|
+
return /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
71196
|
+
actualCT,
|
|
71197
|
+
" / ",
|
|
71198
|
+
standardCT
|
|
71199
|
+
] });
|
|
71200
|
+
}
|
|
70536
71201
|
const displayedMetricValue = getWorkspaceDisplayedMetricValue(workspace);
|
|
70537
71202
|
if (displayedMetricValue === null) {
|
|
70538
71203
|
return /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: "--" });
|
|
@@ -70810,12 +71475,8 @@ var LeaderboardDetailView = memo$1(({
|
|
|
70810
71475
|
return `Line ${lineId2.substring(0, 8)}`;
|
|
70811
71476
|
}, [dbLineNames, configuredLineNames, lineNames, line1Id, line2Id]);
|
|
70812
71477
|
const configuredLineIds = useMemo(() => {
|
|
70813
|
-
|
|
70814
|
-
|
|
70815
|
-
return allLineIds.filter((id3) => userAccessibleLineIds.includes(id3));
|
|
70816
|
-
}
|
|
70817
|
-
return allLineIds;
|
|
70818
|
-
}, [entityConfig, userAccessibleLineIds]);
|
|
71478
|
+
return getConfiguredLineIds(entityConfig);
|
|
71479
|
+
}, [entityConfig]);
|
|
70819
71480
|
const accessibleLineIdSet = useMemo(
|
|
70820
71481
|
() => new Set((userAccessibleLineIds || []).filter(Boolean)),
|
|
70821
71482
|
[userAccessibleLineIds]
|
|
@@ -71503,7 +72164,7 @@ var LeaderboardDetailView = memo$1(({
|
|
|
71503
72164
|
const hasEfficiencyLeaderboardRows = sortedWorkspaces.some(
|
|
71504
72165
|
(workspace) => workspace.leaderboard_metric_kind !== "recent_flow_shift_average"
|
|
71505
72166
|
);
|
|
71506
|
-
const metricLabel = viewType === "machine" ? "Utilization" : hasRecentFlowLeaderboardRows && !hasEfficiencyLeaderboardRows ? "
|
|
72167
|
+
const metricLabel = viewType === "machine" ? "Utilization" : hasRecentFlowLeaderboardRows && !hasEfficiencyLeaderboardRows ? "Actual CT / Standard CT" : hasRecentFlowLeaderboardRows && hasEfficiencyLeaderboardRows ? "Performance" : "Efficiency";
|
|
71507
72168
|
const descendingSortLabel = "Highest to Lowest";
|
|
71508
72169
|
const ascendingSortLabel = "Lowest to Highest";
|
|
71509
72170
|
return /* @__PURE__ */ jsxs("div", { className: `min-h-screen bg-slate-50 flex flex-col ${className}`, style: { willChange: "contents" }, children: [
|
|
@@ -86173,4 +86834,4 @@ var RecentFlowSnapshotGrid = ({
|
|
|
86173
86834
|
);
|
|
86174
86835
|
};
|
|
86175
86836
|
|
|
86176
|
-
export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLineSkuBreakdown, buildShiftGroupsKey, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };
|
|
86837
|
+
export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLineLeaderboardRows, buildLineSkuBreakdown, buildShiftGroupsKey, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };
|