@optifye/dashboard-core 6.12.34 → 6.12.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +3 -0
- package/dist/index.js +25 -15
- package/dist/index.mjs +25 -15
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -4473,6 +4473,9 @@ body {
|
|
|
4473
4473
|
--tw-numeric-spacing: tabular-nums;
|
|
4474
4474
|
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
|
|
4475
4475
|
}
|
|
4476
|
+
.leading-4 {
|
|
4477
|
+
line-height: 1rem;
|
|
4478
|
+
}
|
|
4476
4479
|
.leading-5 {
|
|
4477
4480
|
line-height: 1.25rem;
|
|
4478
4481
|
}
|
package/dist/index.js
CHANGED
|
@@ -59619,6 +59619,11 @@ var isLeaderboardRoute = (asPath) => {
|
|
|
59619
59619
|
if (path !== "/kpis") return false;
|
|
59620
59620
|
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59621
59621
|
};
|
|
59622
|
+
var isAuthRoute = (asPath) => {
|
|
59623
|
+
const { path } = getRoutePathAndQuery(asPath);
|
|
59624
|
+
return path === "/login" || path === "/debug-auth" || path === "/accept-invite" || path === "/auth/callback";
|
|
59625
|
+
};
|
|
59626
|
+
var isSuppressedRoute = (asPath) => isLeaderboardRoute(asPath) || isAuthRoute(asPath);
|
|
59622
59627
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59623
59628
|
if (typeof window === "undefined") return null;
|
|
59624
59629
|
if (process.env.NODE_ENV === "production") return null;
|
|
@@ -59668,16 +59673,19 @@ var buildSnapshotRows = (entries, lines) => {
|
|
|
59668
59673
|
}));
|
|
59669
59674
|
};
|
|
59670
59675
|
var formatCrossedLineNames = (event) => {
|
|
59671
|
-
|
|
59672
|
-
|
|
59673
|
-
|
|
59674
|
-
return `${
|
|
59676
|
+
const names = event.crossedLines.map((line) => line.lineName).filter(Boolean);
|
|
59677
|
+
if (names.length === 0) return "another line";
|
|
59678
|
+
if (names.length === 1) return names[0];
|
|
59679
|
+
if (names.length === 2) return `${names[0]} and ${names[1]}`;
|
|
59680
|
+
return `${names[0]}, ${names[1]} +${names.length - 2} more`;
|
|
59675
59681
|
};
|
|
59676
59682
|
var getDirectionCopy = (direction, event) => {
|
|
59677
59683
|
const crossedNames = formatCrossedLineNames(event);
|
|
59678
59684
|
const rankChange = Math.abs(event.previousRank - event.currentRank);
|
|
59685
|
+
const movementLabel = direction === "up" ? "moved up" : "moved down";
|
|
59679
59686
|
return direction === "up" ? {
|
|
59680
|
-
title:
|
|
59687
|
+
title: `${event.crossingLineName} ${movementLabel}`,
|
|
59688
|
+
context: `You passed ${crossedNames}`,
|
|
59681
59689
|
accent: "border-l-emerald-500",
|
|
59682
59690
|
iconBg: "bg-emerald-100",
|
|
59683
59691
|
iconText: "text-emerald-600",
|
|
@@ -59685,7 +59693,8 @@ var getDirectionCopy = (direction, event) => {
|
|
|
59685
59693
|
action: "text-emerald-700 hover:text-emerald-800",
|
|
59686
59694
|
rankChange
|
|
59687
59695
|
} : {
|
|
59688
|
-
title: `${
|
|
59696
|
+
title: `${event.crossingLineName} ${movementLabel}`,
|
|
59697
|
+
context: `${crossedNames} crossed you`,
|
|
59689
59698
|
accent: "border-l-red-500",
|
|
59690
59699
|
iconBg: "bg-red-100",
|
|
59691
59700
|
iconText: "text-red-600",
|
|
@@ -59786,6 +59795,7 @@ var LineOvertakeNotificationPopup = ({
|
|
|
59786
59795
|
) }) }),
|
|
59787
59796
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
59788
59797
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start gap-2 mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold text-sm text-gray-900 leading-5", children: directionCopy.title }) }),
|
|
59798
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-3 text-xs font-medium leading-4 text-slate-500", children: directionCopy.context }),
|
|
59789
59799
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
59790
59800
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[15px] font-semibold text-slate-500", children: "New rank:" }),
|
|
59791
59801
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: `inline-flex items-center rounded-full border px-2.5 py-0.5 text-[15px] font-bold ${directionCopy.pill}`, children: [
|
|
@@ -59805,7 +59815,7 @@ var LineOvertakeNotificationPopup = ({
|
|
|
59805
59815
|
onClick: onOpenLeaderboard,
|
|
59806
59816
|
className: `inline-flex items-center gap-1.5 text-xs font-semibold transition-colors ${directionCopy.action}`,
|
|
59807
59817
|
children: [
|
|
59808
|
-
"
|
|
59818
|
+
"Open leaderboard",
|
|
59809
59819
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "w-3.5 h-3.5" })
|
|
59810
59820
|
]
|
|
59811
59821
|
}
|
|
@@ -59868,7 +59878,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59868
59878
|
const [visibleLines, setVisibleLines] = React146.useState([]);
|
|
59869
59879
|
const [linesLoaded, setLinesLoaded] = React146.useState(false);
|
|
59870
59880
|
const [notificationEvents, setNotificationEvents] = React146.useState([]);
|
|
59871
|
-
const
|
|
59881
|
+
const isOnSuppressedRoute = isSuppressedRoute(router$1.asPath);
|
|
59872
59882
|
const qaSimulationMode = getLocalQaSimulationMode(router$1.asPath);
|
|
59873
59883
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59874
59884
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
@@ -59945,17 +59955,17 @@ var LineOvertakeNotificationManager = ({
|
|
|
59945
59955
|
scopeKeyRef.current = scopeKey;
|
|
59946
59956
|
}, [scopeKey]);
|
|
59947
59957
|
React146.useEffect(() => {
|
|
59948
|
-
if (!
|
|
59958
|
+
if (!isOnSuppressedRoute) return;
|
|
59949
59959
|
previousSnapshotRef.current = null;
|
|
59950
59960
|
notificationEventsRef.current = [];
|
|
59951
59961
|
setNotificationEvents([]);
|
|
59952
59962
|
setVisibleLines([]);
|
|
59953
59963
|
setLinesLoaded(false);
|
|
59954
|
-
}, [
|
|
59964
|
+
}, [isOnSuppressedRoute]);
|
|
59955
59965
|
React146.useEffect(() => {
|
|
59956
59966
|
let cancelled = false;
|
|
59957
59967
|
const loadLines = async () => {
|
|
59958
|
-
if (
|
|
59968
|
+
if (isOnSuppressedRoute) {
|
|
59959
59969
|
setVisibleLines([]);
|
|
59960
59970
|
setLinesLoaded(false);
|
|
59961
59971
|
return;
|
|
@@ -59994,7 +60004,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59994
60004
|
return () => {
|
|
59995
60005
|
cancelled = true;
|
|
59996
60006
|
};
|
|
59997
|
-
}, [companyId,
|
|
60007
|
+
}, [companyId, isOnSuppressedRoute, qaSimulationEnabled, roleMode, supabase]);
|
|
59998
60008
|
const openLeaderboard = React146.useCallback(() => {
|
|
59999
60009
|
notificationEventsRef.current = [];
|
|
60000
60010
|
setNotificationEvents([]);
|
|
@@ -60040,7 +60050,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60040
60050
|
});
|
|
60041
60051
|
}, [dedupeScopeKey]);
|
|
60042
60052
|
const pollLeaderboard = React146.useCallback(async () => {
|
|
60043
|
-
if (
|
|
60053
|
+
if (isOnSuppressedRoute) return;
|
|
60044
60054
|
if (qaSimulationEnabled) {
|
|
60045
60055
|
if (pollInFlightRef.current) return;
|
|
60046
60056
|
pollInFlightRef.current = true;
|
|
@@ -60099,7 +60109,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60099
60109
|
companyId,
|
|
60100
60110
|
currentShift.date,
|
|
60101
60111
|
currentShift.shiftId,
|
|
60102
|
-
|
|
60112
|
+
isOnSuppressedRoute,
|
|
60103
60113
|
linesLoaded,
|
|
60104
60114
|
qaSimulationEnabled,
|
|
60105
60115
|
qaSimulationMode,
|
|
@@ -60121,7 +60131,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60121
60131
|
window.clearInterval(intervalId);
|
|
60122
60132
|
};
|
|
60123
60133
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60124
|
-
if (
|
|
60134
|
+
if (isOnSuppressedRoute) return null;
|
|
60125
60135
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60126
60136
|
LineOvertakeNotificationPopup,
|
|
60127
60137
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -59590,6 +59590,11 @@ var isLeaderboardRoute = (asPath) => {
|
|
|
59590
59590
|
if (path !== "/kpis") return false;
|
|
59591
59591
|
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59592
59592
|
};
|
|
59593
|
+
var isAuthRoute = (asPath) => {
|
|
59594
|
+
const { path } = getRoutePathAndQuery(asPath);
|
|
59595
|
+
return path === "/login" || path === "/debug-auth" || path === "/accept-invite" || path === "/auth/callback";
|
|
59596
|
+
};
|
|
59597
|
+
var isSuppressedRoute = (asPath) => isLeaderboardRoute(asPath) || isAuthRoute(asPath);
|
|
59593
59598
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59594
59599
|
if (typeof window === "undefined") return null;
|
|
59595
59600
|
if (process.env.NODE_ENV === "production") return null;
|
|
@@ -59639,16 +59644,19 @@ var buildSnapshotRows = (entries, lines) => {
|
|
|
59639
59644
|
}));
|
|
59640
59645
|
};
|
|
59641
59646
|
var formatCrossedLineNames = (event) => {
|
|
59642
|
-
|
|
59643
|
-
|
|
59644
|
-
|
|
59645
|
-
return `${
|
|
59647
|
+
const names = event.crossedLines.map((line) => line.lineName).filter(Boolean);
|
|
59648
|
+
if (names.length === 0) return "another line";
|
|
59649
|
+
if (names.length === 1) return names[0];
|
|
59650
|
+
if (names.length === 2) return `${names[0]} and ${names[1]}`;
|
|
59651
|
+
return `${names[0]}, ${names[1]} +${names.length - 2} more`;
|
|
59646
59652
|
};
|
|
59647
59653
|
var getDirectionCopy = (direction, event) => {
|
|
59648
59654
|
const crossedNames = formatCrossedLineNames(event);
|
|
59649
59655
|
const rankChange = Math.abs(event.previousRank - event.currentRank);
|
|
59656
|
+
const movementLabel = direction === "up" ? "moved up" : "moved down";
|
|
59650
59657
|
return direction === "up" ? {
|
|
59651
|
-
title:
|
|
59658
|
+
title: `${event.crossingLineName} ${movementLabel}`,
|
|
59659
|
+
context: `You passed ${crossedNames}`,
|
|
59652
59660
|
accent: "border-l-emerald-500",
|
|
59653
59661
|
iconBg: "bg-emerald-100",
|
|
59654
59662
|
iconText: "text-emerald-600",
|
|
@@ -59656,7 +59664,8 @@ var getDirectionCopy = (direction, event) => {
|
|
|
59656
59664
|
action: "text-emerald-700 hover:text-emerald-800",
|
|
59657
59665
|
rankChange
|
|
59658
59666
|
} : {
|
|
59659
|
-
title: `${
|
|
59667
|
+
title: `${event.crossingLineName} ${movementLabel}`,
|
|
59668
|
+
context: `${crossedNames} crossed you`,
|
|
59660
59669
|
accent: "border-l-red-500",
|
|
59661
59670
|
iconBg: "bg-red-100",
|
|
59662
59671
|
iconText: "text-red-600",
|
|
@@ -59757,6 +59766,7 @@ var LineOvertakeNotificationPopup = ({
|
|
|
59757
59766
|
) }) }),
|
|
59758
59767
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
59759
59768
|
/* @__PURE__ */ jsx("div", { className: "flex items-start gap-2 mb-2", children: /* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm text-gray-900 leading-5", children: directionCopy.title }) }),
|
|
59769
|
+
/* @__PURE__ */ jsx("p", { className: "mb-3 text-xs font-medium leading-4 text-slate-500", children: directionCopy.context }),
|
|
59760
59770
|
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
59761
59771
|
/* @__PURE__ */ jsx("span", { className: "text-[15px] font-semibold text-slate-500", children: "New rank:" }),
|
|
59762
59772
|
/* @__PURE__ */ jsxs("span", { className: `inline-flex items-center rounded-full border px-2.5 py-0.5 text-[15px] font-bold ${directionCopy.pill}`, children: [
|
|
@@ -59776,7 +59786,7 @@ var LineOvertakeNotificationPopup = ({
|
|
|
59776
59786
|
onClick: onOpenLeaderboard,
|
|
59777
59787
|
className: `inline-flex items-center gap-1.5 text-xs font-semibold transition-colors ${directionCopy.action}`,
|
|
59778
59788
|
children: [
|
|
59779
|
-
"
|
|
59789
|
+
"Open leaderboard",
|
|
59780
59790
|
/* @__PURE__ */ jsx(ArrowRight, { className: "w-3.5 h-3.5" })
|
|
59781
59791
|
]
|
|
59782
59792
|
}
|
|
@@ -59839,7 +59849,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59839
59849
|
const [visibleLines, setVisibleLines] = useState([]);
|
|
59840
59850
|
const [linesLoaded, setLinesLoaded] = useState(false);
|
|
59841
59851
|
const [notificationEvents, setNotificationEvents] = useState([]);
|
|
59842
|
-
const
|
|
59852
|
+
const isOnSuppressedRoute = isSuppressedRoute(router.asPath);
|
|
59843
59853
|
const qaSimulationMode = getLocalQaSimulationMode(router.asPath);
|
|
59844
59854
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59845
59855
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
@@ -59916,17 +59926,17 @@ var LineOvertakeNotificationManager = ({
|
|
|
59916
59926
|
scopeKeyRef.current = scopeKey;
|
|
59917
59927
|
}, [scopeKey]);
|
|
59918
59928
|
useEffect(() => {
|
|
59919
|
-
if (!
|
|
59929
|
+
if (!isOnSuppressedRoute) return;
|
|
59920
59930
|
previousSnapshotRef.current = null;
|
|
59921
59931
|
notificationEventsRef.current = [];
|
|
59922
59932
|
setNotificationEvents([]);
|
|
59923
59933
|
setVisibleLines([]);
|
|
59924
59934
|
setLinesLoaded(false);
|
|
59925
|
-
}, [
|
|
59935
|
+
}, [isOnSuppressedRoute]);
|
|
59926
59936
|
useEffect(() => {
|
|
59927
59937
|
let cancelled = false;
|
|
59928
59938
|
const loadLines = async () => {
|
|
59929
|
-
if (
|
|
59939
|
+
if (isOnSuppressedRoute) {
|
|
59930
59940
|
setVisibleLines([]);
|
|
59931
59941
|
setLinesLoaded(false);
|
|
59932
59942
|
return;
|
|
@@ -59965,7 +59975,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59965
59975
|
return () => {
|
|
59966
59976
|
cancelled = true;
|
|
59967
59977
|
};
|
|
59968
|
-
}, [companyId,
|
|
59978
|
+
}, [companyId, isOnSuppressedRoute, qaSimulationEnabled, roleMode, supabase]);
|
|
59969
59979
|
const openLeaderboard = useCallback(() => {
|
|
59970
59980
|
notificationEventsRef.current = [];
|
|
59971
59981
|
setNotificationEvents([]);
|
|
@@ -60011,7 +60021,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60011
60021
|
});
|
|
60012
60022
|
}, [dedupeScopeKey]);
|
|
60013
60023
|
const pollLeaderboard = useCallback(async () => {
|
|
60014
|
-
if (
|
|
60024
|
+
if (isOnSuppressedRoute) return;
|
|
60015
60025
|
if (qaSimulationEnabled) {
|
|
60016
60026
|
if (pollInFlightRef.current) return;
|
|
60017
60027
|
pollInFlightRef.current = true;
|
|
@@ -60070,7 +60080,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60070
60080
|
companyId,
|
|
60071
60081
|
currentShift.date,
|
|
60072
60082
|
currentShift.shiftId,
|
|
60073
|
-
|
|
60083
|
+
isOnSuppressedRoute,
|
|
60074
60084
|
linesLoaded,
|
|
60075
60085
|
qaSimulationEnabled,
|
|
60076
60086
|
qaSimulationMode,
|
|
@@ -60092,7 +60102,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60092
60102
|
window.clearInterval(intervalId);
|
|
60093
60103
|
};
|
|
60094
60104
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60095
|
-
if (
|
|
60105
|
+
if (isOnSuppressedRoute) return null;
|
|
60096
60106
|
return /* @__PURE__ */ jsx(
|
|
60097
60107
|
LineOvertakeNotificationPopup,
|
|
60098
60108
|
{
|