@sentinel-nvr/web 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +13 -0
- package/README.md +25 -8
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +13 -1
- package/dist/{chunk-LADO3WMJ.js → chunk-LN4VXI2V.js} +80 -15
- package/dist/chunk-LN4VXI2V.js.map +1 -0
- package/dist/{chunk-Z22KWFHI.js → chunk-MAUN6MNY.js} +172 -24
- package/dist/chunk-MAUN6MNY.js.map +1 -0
- package/dist/{client-Dtfs8TX2.d.ts → client-yrngvMAK.d.ts} +38 -7
- package/dist/{controller-C01h-VeS.d.ts → controller-B0mPOQml.d.ts} +17 -1
- package/dist/player/index.d.ts +2 -2
- package/dist/player/index.js +2 -1
- package/dist/ui/index.d.ts +6 -4
- package/dist/ui/index.js +106 -70
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/locales/de.json +2 -0
- package/dist/ui/locales/en.json +2 -0
- package/dist/ui/locales/es.json +2 -0
- package/dist/ui/locales/fr.json +2 -0
- package/dist/ui/locales/it.json +2 -0
- package/dist/ui/locales/pt.json +2 -0
- package/dist/ui/locales/sv.json +2 -0
- package/package.json +15 -3
- package/dist/chunk-LADO3WMJ.js.map +0 -1
- package/dist/chunk-Z22KWFHI.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PlayerController,
|
|
3
|
+
rlog
|
|
4
|
+
} from "../chunk-MAUN6MNY.js";
|
|
1
5
|
import {
|
|
2
6
|
SENTINEL_DAY_MS,
|
|
3
7
|
SENTINEL_EVENT_CLASSES,
|
|
@@ -6,20 +10,21 @@ import {
|
|
|
6
10
|
fmtTime,
|
|
7
11
|
fmtTimeSec,
|
|
8
12
|
hhmmInput,
|
|
13
|
+
sentinelAddDays,
|
|
14
|
+
sentinelAtTime,
|
|
9
15
|
sentinelClassOf,
|
|
10
16
|
sentinelClassesOf,
|
|
11
17
|
sentinelClipRuns,
|
|
18
|
+
sentinelDayEnd,
|
|
12
19
|
sentinelDayOf,
|
|
13
20
|
sentinelEventPlayTs,
|
|
14
21
|
sentinelHumanBytes,
|
|
15
22
|
sentinelMergeDays,
|
|
16
23
|
sentinelStorageForecast,
|
|
24
|
+
sentinelWallMarks,
|
|
25
|
+
sentinelWallSeconds,
|
|
17
26
|
weekdayShorts
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import {
|
|
20
|
-
PlayerController,
|
|
21
|
-
rlog
|
|
22
|
-
} from "../chunk-Z22KWFHI.js";
|
|
27
|
+
} from "../chunk-LN4VXI2V.js";
|
|
23
28
|
|
|
24
29
|
// src/ui/context.tsx
|
|
25
30
|
import { createContext, useContext } from "react";
|
|
@@ -676,7 +681,10 @@ function Hero({ cameras, stats }) {
|
|
|
676
681
|
return /* @__PURE__ */ jsxs5("div", { className: "nvr-card nvr-hero", children: [
|
|
677
682
|
/* @__PURE__ */ jsxs5("div", { className: "nvr-hero__head", children: [
|
|
678
683
|
/* @__PURE__ */ jsx7(CardTitle, { icon: /* @__PURE__ */ jsx7(Gauge, { size: 16, strokeWidth: 1.75 }), title: t("nvr.hero.title"), sub: t("nvr.hero.sub") }),
|
|
679
|
-
/* @__PURE__ */ jsxs5("span", { className:
|
|
684
|
+
stats.storageOk === false ? /* @__PURE__ */ jsxs5("span", { className: "nvr-pill nvr-pill--danger", title: stats.storageProblem, children: [
|
|
685
|
+
/* @__PURE__ */ jsx7("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
686
|
+
t("nvr.hero.storageProblem")
|
|
687
|
+
] }) : /* @__PURE__ */ jsxs5("span", { className: `nvr-pill ${offline > 0 ? "nvr-pill--danger" : "nvr-pill--positive"}`, children: [
|
|
680
688
|
/* @__PURE__ */ jsx7("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
681
689
|
offline > 0 ? t("nvr.hero.offline", { count: offline }) : t("nvr.hero.allOnline")
|
|
682
690
|
] })
|
|
@@ -881,26 +889,29 @@ function VerticalTimeline(p) {
|
|
|
881
889
|
document.removeEventListener("touchcancel", off);
|
|
882
890
|
};
|
|
883
891
|
}, []);
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
rlog("follow-jump", { dSec: Math.round(d / 100) / 10, live: p.live, sinceIdle: v.idleAt ? Date.now() - v.idleAt : -1, px: Math.round(px * 1e6) / 1e6 });
|
|
895
|
-
}
|
|
896
|
-
scrollCenter(ts);
|
|
892
|
+
const followTick = () => {
|
|
893
|
+
const v = VT.current;
|
|
894
|
+
if (!v.user) {
|
|
895
|
+
const ts = p.live ? Date.now() : p.following() ? p.playhead() : null;
|
|
896
|
+
if (ts != null) {
|
|
897
|
+
const cur = centerTs();
|
|
898
|
+
const d = ts - cur;
|
|
899
|
+
if (Math.abs(d) > 3e3 && Math.abs(d * px) > 1.5 && Date.now() - v.lastJumpLog > 1e3) {
|
|
900
|
+
v.lastJumpLog = Date.now();
|
|
901
|
+
rlog("follow-jump", { dSec: Math.round(d / 100) / 10, live: p.live, sinceIdle: v.idleAt ? Date.now() - v.idleAt : -1, px: Math.round(px * 1e6) / 1e6 });
|
|
897
902
|
}
|
|
903
|
+
scrollCenter(ts);
|
|
898
904
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
905
|
+
}
|
|
906
|
+
notifyCenter();
|
|
907
|
+
tick((n) => n + 1);
|
|
908
|
+
};
|
|
909
|
+
const followRef = useRef(followTick);
|
|
910
|
+
followRef.current = followTick;
|
|
911
|
+
useEffect2(() => {
|
|
912
|
+
const t2 = setInterval(() => followRef.current(), 100);
|
|
902
913
|
return () => clearInterval(t2);
|
|
903
|
-
});
|
|
914
|
+
}, []);
|
|
904
915
|
const notifyCenter = () => {
|
|
905
916
|
const v = VT.current;
|
|
906
917
|
if (Date.now() - v.lastCenterCb < 400) return;
|
|
@@ -943,12 +954,15 @@ function VerticalTimeline(p) {
|
|
|
943
954
|
clearTimeout(v.relT);
|
|
944
955
|
v.relT = window.setTimeout(userIdle, 250);
|
|
945
956
|
};
|
|
957
|
+
const releaseRef = useRef(release);
|
|
958
|
+
releaseRef.current = release;
|
|
946
959
|
useEffect2(() => {
|
|
947
|
-
|
|
960
|
+
const h = () => releaseRef.current();
|
|
961
|
+
for (const n of ["pointerup", "pointercancel", "touchend"]) window.addEventListener(n, h);
|
|
948
962
|
return () => {
|
|
949
|
-
for (const n of ["pointerup", "pointercancel", "touchend"]) window.removeEventListener(n,
|
|
963
|
+
for (const n of ["pointerup", "pointercancel", "touchend"]) window.removeEventListener(n, h);
|
|
950
964
|
};
|
|
951
|
-
});
|
|
965
|
+
}, []);
|
|
952
966
|
const onScroll = () => {
|
|
953
967
|
const v = VT.current;
|
|
954
968
|
const el = scroll.current;
|
|
@@ -987,21 +1001,25 @@ function VerticalTimeline(p) {
|
|
|
987
1001
|
if (!v.down) userIdle();
|
|
988
1002
|
}, 700);
|
|
989
1003
|
};
|
|
1004
|
+
const onWheel = (e) => {
|
|
1005
|
+
const el = scroll.current;
|
|
1006
|
+
if (!e.ctrlKey) {
|
|
1007
|
+
markUser();
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
e.preventDefault();
|
|
1011
|
+
const r = el.getBoundingClientRect();
|
|
1012
|
+
const y = e.clientY - r.top;
|
|
1013
|
+
applyZoom(px * Math.exp(-e.deltaY * 2e-3), tsForY(el.scrollTop + y), y);
|
|
1014
|
+
};
|
|
1015
|
+
const wheelRef = useRef(onWheel);
|
|
1016
|
+
wheelRef.current = onWheel;
|
|
990
1017
|
useEffect2(() => {
|
|
991
1018
|
const el = scroll.current;
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
e.preventDefault();
|
|
998
|
-
const r = el.getBoundingClientRect();
|
|
999
|
-
const y = e.clientY - r.top;
|
|
1000
|
-
applyZoom(px * Math.exp(-e.deltaY * 2e-3), tsForY(el.scrollTop + y), y);
|
|
1001
|
-
};
|
|
1002
|
-
el.addEventListener("wheel", onWheel, { passive: false });
|
|
1003
|
-
return () => el.removeEventListener("wheel", onWheel);
|
|
1004
|
-
});
|
|
1019
|
+
const h = (e) => wheelRef.current(e);
|
|
1020
|
+
el.addEventListener("wheel", h, { passive: false });
|
|
1021
|
+
return () => el.removeEventListener("wheel", h);
|
|
1022
|
+
}, []);
|
|
1005
1023
|
const applyZoom = (npx, anchor, anchorY) => {
|
|
1006
1024
|
const c = clamp(npx, minPx, maxPx);
|
|
1007
1025
|
setPx(c);
|
|
@@ -1022,17 +1040,13 @@ function VerticalTimeline(p) {
|
|
|
1022
1040
|
const steps = [6e4, 3e5, 6e5, 9e5, 18e5, 36e5, 72e5, 108e5, 216e5];
|
|
1023
1041
|
const step = steps.find((s) => s >= 70 / px) ?? steps[steps.length - 1];
|
|
1024
1042
|
const topTs = px > 0 ? tsForY(0) : p.rangeEnd;
|
|
1025
|
-
const
|
|
1026
|
-
const
|
|
1027
|
-
for (let t2 = a0; t2 <= Math.min(topTs, winEnd) && axis.length < 2e3; t2 += step) axis.push(t2);
|
|
1043
|
+
const axisEnd = Math.min(topTs, winEnd), axisStart = Math.max(p.rangeStart, winStart);
|
|
1044
|
+
const axis = axisEnd >= axisStart ? sentinelWallMarks(axisStart, axisEnd, step, 2e3) : [];
|
|
1028
1045
|
const q = step / 4;
|
|
1029
|
-
const ticks = [];
|
|
1030
|
-
|
|
1031
|
-
const t0 = Math.max(p.rangeStart, Math.floor(winStart / q) * q);
|
|
1032
|
-
for (let t2 = t0; t2 <= Math.min(topTs, winEnd) && ticks.length < 8e3; t2 += q) ticks.push(t2);
|
|
1033
|
-
}
|
|
1046
|
+
const ticks = q * px >= 3 && axisEnd >= axisStart ? sentinelWallMarks(axisStart, axisEnd, q, 8e3) : [];
|
|
1047
|
+
const stepSec = Math.round(step / 1e3);
|
|
1034
1048
|
const midnights = [];
|
|
1035
|
-
for (let t2 =
|
|
1049
|
+
for (let t2 = sentinelAddDays(axisStart, 0); t2 <= axisEnd && midnights.length < 400; t2 = sentinelAddDays(t2, 1)) if (t2 > p.rangeStart) midnights.push(t2);
|
|
1036
1050
|
let lastThumbY = -1e9;
|
|
1037
1051
|
const thumbGap = (window.innerWidth < 900 ? 63 : 77) + 6;
|
|
1038
1052
|
const now = Date.now();
|
|
@@ -1046,7 +1060,10 @@ function VerticalTimeline(p) {
|
|
|
1046
1060
|
return /* @__PURE__ */ jsxs6("div", { className: "nvr-vtl vtl-wrap", children: [
|
|
1047
1061
|
/* @__PURE__ */ jsx8("div", { className: "vtl-scroll", ref: scroll, onScroll, onPointerDown: down, onTouchStart: down, children: /* @__PURE__ */ jsxs6("div", { className: "vtl-content", style: { height: span * px + PAD + PAD_BOT }, children: [
|
|
1048
1062
|
/* @__PURE__ */ jsx8("div", { className: "vtl-daybg", style: { top: 0, height: span * px + PAD } }),
|
|
1049
|
-
ticks.map((t2) =>
|
|
1063
|
+
ticks.map((t2) => {
|
|
1064
|
+
const w = sentinelWallSeconds(t2);
|
|
1065
|
+
return /* @__PURE__ */ jsx8("div", { className: "vtick" + (w % stepSec === 0 ? " vtick--l" : w % (stepSec / 2) === 0 ? " vtick--m" : ""), style: { top: yFor(t2) } }, "t" + t2);
|
|
1066
|
+
}),
|
|
1050
1067
|
axis.map((t2) => /* @__PURE__ */ jsx8("div", { className: "vaxis nvr-data", style: { top: yFor(t2) }, children: hhmm(t2) }, t2)),
|
|
1051
1068
|
midnights.map((t2) => /* @__PURE__ */ jsx8("div", { className: "vday", style: { top: yFor(t2) }, children: /* @__PURE__ */ jsx8("span", { className: "nvr-data", children: dayLbl(t2) }) }, "d" + t2)),
|
|
1052
1069
|
runs.map((r, i) => inWin(r.s, r.e) && /* @__PURE__ */ jsx8("div", { className: "vseg", style: { top: yFor(r.e), height: Math.max(2, (r.e - r.s) * px) } }, i)),
|
|
@@ -1098,14 +1115,25 @@ import { Calendar, Camera as Camera2, ChevronLeft as ChevronLeft2, ChevronRight
|
|
|
1098
1115
|
|
|
1099
1116
|
// src/ui/camera-logic.ts
|
|
1100
1117
|
function dateChipNav(centerDay, oldestAllowed, today = sentinelDayOf(Date.now())) {
|
|
1101
|
-
return { prevDisabled: centerDay -
|
|
1118
|
+
return { prevDisabled: sentinelAddDays(centerDay, -1) < oldestAllowed, nextDisabled: centerDay >= today };
|
|
1102
1119
|
}
|
|
1103
1120
|
function stageStatus(ps, t, locale, loadError = false, now = Date.now()) {
|
|
1104
|
-
|
|
1121
|
+
let label = loadError ? t("nvr.error.loadFailed") : ps.label ? t(`nvr.player.${ps.label}`) : "";
|
|
1122
|
+
if (!ps.live && !loadError && label && (ps.transport === "mse" || ps.transport === "native")) label += ` (${t("nvr.player.fallbackMode")})`;
|
|
1105
1123
|
if (ps.live || ps.playhead == null) return label;
|
|
1106
1124
|
const day = sentinelDayOf(ps.playhead) === sentinelDayOf(now) ? "" : fmtDay(ps.playhead, locale) + " ";
|
|
1107
1125
|
return `${label} \xB7 ${day}${fmtTimeSec(ps.playhead, locale)}`;
|
|
1108
1126
|
}
|
|
1127
|
+
function shouldHandleKey(e) {
|
|
1128
|
+
if (e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return false;
|
|
1129
|
+
const el = e.target;
|
|
1130
|
+
if (!el || typeof el !== "object") return true;
|
|
1131
|
+
if (el.isContentEditable) return false;
|
|
1132
|
+
const tag = (el.tagName || "").toLowerCase();
|
|
1133
|
+
if (tag === "input" || tag === "select" || tag === "textarea") return false;
|
|
1134
|
+
if (e.key === " " && (tag === "button" || tag === "a" || tag === "summary" || el.getAttribute?.("role") === "button")) return false;
|
|
1135
|
+
return true;
|
|
1136
|
+
}
|
|
1109
1137
|
|
|
1110
1138
|
// src/ui/components/CameraPage.tsx
|
|
1111
1139
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -1150,21 +1178,22 @@ function CameraPage(p) {
|
|
|
1150
1178
|
daysRef.current = days;
|
|
1151
1179
|
const camRef = useRef2(camId);
|
|
1152
1180
|
camRef.current = camId;
|
|
1181
|
+
const deepRef = useRef2("");
|
|
1153
1182
|
const merged = useMemo2(() => {
|
|
1154
1183
|
const m = sentinelMergeDays(days);
|
|
1155
1184
|
const rangeStart = m.oldestDay ?? todayStart();
|
|
1156
|
-
const rangeEnd = Math.min(todayStart()
|
|
1185
|
+
const rangeEnd = Math.min(sentinelDayEnd(todayStart()), nowTick + 20 * 6e4);
|
|
1157
1186
|
return { ...m, rangeStart, rangeEnd };
|
|
1158
1187
|
}, [days, nowTick]);
|
|
1159
1188
|
const mergedNow = useCallback(() => {
|
|
1160
1189
|
const m = sentinelMergeDays(daysRef.current);
|
|
1161
|
-
return { ...m, rangeStart: m.oldestDay ?? todayStart(), rangeEnd: Math.min(todayStart()
|
|
1190
|
+
return { ...m, rangeStart: m.oldestDay ?? todayStart(), rangeEnd: Math.min(sentinelDayEnd(todayStart()), Date.now() + 20 * 6e4) };
|
|
1162
1191
|
}, []);
|
|
1163
1192
|
useEffect3(() => {
|
|
1164
1193
|
ctl.current?.setClips(merged.clips, merged.codecs, merged.rangeStart, merged.rangeEnd);
|
|
1165
1194
|
}, [merged]);
|
|
1166
1195
|
const fetchDay = useCallback(async (ds) => {
|
|
1167
|
-
const d = await client.getJson(`api/clips?camera=${encodeURIComponent(camId)}&start=${ds}&end=${ds
|
|
1196
|
+
const d = await client.getJson(`api/clips?camera=${encodeURIComponent(camId)}&start=${ds}&end=${sentinelDayEnd(ds)}`);
|
|
1168
1197
|
d.clips = (d.clips || []).sort((a, b) => a.startTime - b.startTime);
|
|
1169
1198
|
d.events = d.events || [];
|
|
1170
1199
|
d.motion = d.motion || [];
|
|
@@ -1172,7 +1201,7 @@ function CameraPage(p) {
|
|
|
1172
1201
|
}, [client, camId]);
|
|
1173
1202
|
const ensureDay = useCallback(async (ds, force = false) => {
|
|
1174
1203
|
if (ds > todayStart()) return;
|
|
1175
|
-
if (earliest && ds
|
|
1204
|
+
if (earliest && sentinelAddDays(ds, 1) < sentinelDayOf(earliest)) return;
|
|
1176
1205
|
if (!force && (daysRef.current[ds] || loading.current.has(ds))) return;
|
|
1177
1206
|
loading.current.add(ds);
|
|
1178
1207
|
try {
|
|
@@ -1180,6 +1209,7 @@ function CameraPage(p) {
|
|
|
1180
1209
|
if (camRef.current !== camId) return;
|
|
1181
1210
|
daysRef.current = { ...daysRef.current, [ds]: d };
|
|
1182
1211
|
setDays((prev) => ({ ...prev, [ds]: d }));
|
|
1212
|
+
setLoadError(false);
|
|
1183
1213
|
} finally {
|
|
1184
1214
|
loading.current.delete(ds);
|
|
1185
1215
|
}
|
|
@@ -1187,9 +1217,7 @@ function CameraPage(p) {
|
|
|
1187
1217
|
const onCenter = useCallback((ts) => {
|
|
1188
1218
|
const d = sentinelDayOf(ts);
|
|
1189
1219
|
setCenterDay(d);
|
|
1190
|
-
|
|
1191
|
-
void ensureDay(d - SENTINEL_DAY_MS);
|
|
1192
|
-
void ensureDay(d + SENTINEL_DAY_MS);
|
|
1220
|
+
for (const x of [d, sentinelAddDays(d, -1), sentinelAddDays(d, 1)]) ensureDay(x).catch(() => setLoadError(true));
|
|
1193
1221
|
}, [ensureDay]);
|
|
1194
1222
|
useEffect3(() => {
|
|
1195
1223
|
const st = stage.current, cd = body.current;
|
|
@@ -1237,7 +1265,7 @@ function CameraPage(p) {
|
|
|
1237
1265
|
else c.posterFromSnapshot(lastTileSnapshot(camId));
|
|
1238
1266
|
const t0 = todayStart();
|
|
1239
1267
|
const target = startAt ? sentinelDayOf(startAt) : t0;
|
|
1240
|
-
Promise.all([ensureDay(target), ensureDay(target -
|
|
1268
|
+
Promise.all([ensureDay(target), ensureDay(sentinelAddDays(target, -1)), target !== t0 ? ensureDay(t0) : Promise.resolve(), target === t0 ? Promise.resolve() : ensureDay(sentinelAddDays(target, 1))]).then(() => {
|
|
1241
1269
|
if (c.camId !== camId || ctl.current !== c) return;
|
|
1242
1270
|
setLoadError(false);
|
|
1243
1271
|
const m = mergedNow();
|
|
@@ -1247,7 +1275,17 @@ function CameraPage(p) {
|
|
|
1247
1275
|
setJump({ ts: startAt, n: Date.now() });
|
|
1248
1276
|
} else c.goLive();
|
|
1249
1277
|
}).catch(() => setLoadError(true));
|
|
1278
|
+
deepRef.current = `${camId}|${startAt}`;
|
|
1250
1279
|
}, [camId, client]);
|
|
1280
|
+
useEffect3(() => {
|
|
1281
|
+
const key = `${camId}|${startAt}`;
|
|
1282
|
+
if (!startAt || !ctl.current || key === deepRef.current) return;
|
|
1283
|
+
deepRef.current = key;
|
|
1284
|
+
const c = ctl.current;
|
|
1285
|
+
c.freezeCurrent();
|
|
1286
|
+
c.posterEvent(posterTs || startAt);
|
|
1287
|
+
goToDay(sentinelDayOf(startAt), startAt).catch(() => setLoadError(true));
|
|
1288
|
+
}, [startAt, posterTs]);
|
|
1251
1289
|
useEffect3(() => {
|
|
1252
1290
|
if (ctl.current && name) ctl.current.camName = name;
|
|
1253
1291
|
}, [name]);
|
|
@@ -1299,20 +1337,20 @@ function CameraPage(p) {
|
|
|
1299
1337
|
const goToDay = useCallback(async (ds, at) => {
|
|
1300
1338
|
const c = ctl.current;
|
|
1301
1339
|
if (!c) return;
|
|
1302
|
-
await Promise.all([ensureDay(ds), ensureDay(ds -
|
|
1340
|
+
await Promise.all([ensureDay(ds), ensureDay(sentinelAddDays(ds, -1)), ensureDay(sentinelAddDays(ds, 1))]);
|
|
1303
1341
|
if (camRef.current !== camId) return;
|
|
1304
1342
|
if (ds === todayStart() && at == null) {
|
|
1305
1343
|
goLive();
|
|
1306
1344
|
return;
|
|
1307
1345
|
}
|
|
1308
|
-
const want = at ?? ds
|
|
1346
|
+
const want = at ?? sentinelAtTime(ds, 12, 0);
|
|
1309
1347
|
if (want > Date.now()) {
|
|
1310
1348
|
goLive();
|
|
1311
1349
|
return;
|
|
1312
1350
|
}
|
|
1313
1351
|
const m = mergedNow();
|
|
1314
1352
|
c.setClips(m.clips, m.codecs, m.rangeStart, m.rangeEnd);
|
|
1315
|
-
const inDay = m.clips.filter((x) => x.startTime >= ds && x.startTime < ds
|
|
1353
|
+
const inDay = m.clips.filter((x) => x.startTime >= ds && x.startTime < sentinelDayEnd(ds));
|
|
1316
1354
|
const exact = c.clipIndexFor(want) >= 0;
|
|
1317
1355
|
const pick = exact ? want : (inDay.find((x) => x.startTime >= want) || inDay[inDay.length - 1])?.startTime;
|
|
1318
1356
|
setJump({ ts: pick ?? want, n: Date.now() });
|
|
@@ -1328,9 +1366,7 @@ function CameraPage(p) {
|
|
|
1328
1366
|
}), []);
|
|
1329
1367
|
useEffect3(() => {
|
|
1330
1368
|
const k = (e) => {
|
|
1331
|
-
if (dt) return;
|
|
1332
|
-
const tag = (e.target?.tagName || "").toLowerCase();
|
|
1333
|
-
if (tag === "input" || tag === "select" || tag === "textarea") return;
|
|
1369
|
+
if (dt || !shouldHandleKey(e)) return;
|
|
1334
1370
|
const c = ctl.current;
|
|
1335
1371
|
if (!c) return;
|
|
1336
1372
|
if (e.key === " ") {
|
|
@@ -1418,12 +1454,12 @@ function CameraPage(p) {
|
|
|
1418
1454
|
}
|
|
1419
1455
|
) : /* @__PURE__ */ jsx9(EventList, { camId, events: merged.events, filterOff, onPick: playEvent }),
|
|
1420
1456
|
/* @__PURE__ */ jsxs7("div", { className: "nvr-datechip" + (ps.live ? "" : " nvr-datechip--rec"), children: [
|
|
1421
|
-
/* @__PURE__ */ jsx9("button", { type: "button", onClick: () =>
|
|
1457
|
+
/* @__PURE__ */ jsx9("button", { type: "button", onClick: () => goToDay(sentinelAddDays(centerDay, -1)).catch(() => setLoadError(true)), disabled: nav.prevDisabled, "aria-label": t("nvr.date.prevDay"), children: /* @__PURE__ */ jsx9(ChevronLeft2, { size: 14 }) }),
|
|
1422
1458
|
/* @__PURE__ */ jsxs7("button", { type: "button", className: "nvr-datechip__lbl nvr-data", onClick: () => setDt(true), "aria-label": t("nvr.date.title"), children: [
|
|
1423
1459
|
/* @__PURE__ */ jsx9(Calendar, { size: 13 }),
|
|
1424
1460
|
fmtDay(centerDay, locale)
|
|
1425
1461
|
] }),
|
|
1426
|
-
/* @__PURE__ */ jsx9("button", { type: "button", onClick: () =>
|
|
1462
|
+
/* @__PURE__ */ jsx9("button", { type: "button", onClick: () => goToDay(sentinelAddDays(centerDay, 1)).catch(() => setLoadError(true)), disabled: nav.nextDisabled, "aria-label": t("nvr.date.nextDay"), children: /* @__PURE__ */ jsx9(ChevronRight2, { size: 14 }) })
|
|
1427
1463
|
] })
|
|
1428
1464
|
] })
|
|
1429
1465
|
] }),
|
|
@@ -1434,9 +1470,8 @@ function CameraPage(p) {
|
|
|
1434
1470
|
onClose: () => setDt(false),
|
|
1435
1471
|
onGo: (ds, time) => {
|
|
1436
1472
|
setDt(false);
|
|
1437
|
-
const at = time ? ds
|
|
1438
|
-
goToDay(ds, at).catch(() =>
|
|
1439
|
-
});
|
|
1473
|
+
const at = time ? sentinelAtTime(ds, Number(time.split(":")[0]), Number(time.split(":")[1])) : void 0;
|
|
1474
|
+
goToDay(ds, at).catch(() => setLoadError(true));
|
|
1440
1475
|
}
|
|
1441
1476
|
})
|
|
1442
1477
|
] });
|
|
@@ -1587,4 +1622,5 @@ export {
|
|
|
1587
1622
|
useSentinelUi,
|
|
1588
1623
|
watchSystemMode
|
|
1589
1624
|
};
|
|
1625
|
+
/*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */
|
|
1590
1626
|
//# sourceMappingURL=index.js.map
|