@sentinel-nvr/web 0.19.1 → 0.19.2
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/README.md +1 -1
- package/dist/ui/index.d.ts +9 -1
- package/dist/ui/index.js +102 -39
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/ui.css +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ on older servers, but only get their full behaviour with the matching plugin ver
|
|
|
39
39
|
| 0.16.x | any (spans: ≥ 1.3.0) | events as time spans: bar from first sighting to last movement on the timeline, running events pulse, duration/„running“ in the list (`endTs`/`open`); older servers show plain markers. 0.16.5: storage values in the UI language, today refresh during playback — client only. 0.16.7: overlapping timeline markers grouped with a count, a tap zooms in — client only. 0.16.8: the events tab counts the centred day — client only. 0.16.9: "yesterday" in front of the time in the overview events strip — client only. 0.16.10: "recording stalled" on tiles and in the status pill (`stalled` from plugin ≥ 2026-10-05; older servers: no change). 0.16.11: `header`/`externalUrl` may take the playback position — client only. |
|
|
40
40
|
| 0.17.x | plugin with `features: ["export"]` (older plugins: no clip button, everything else as 0.16.x) | clip download on the camera page: "Download clip" in the info bar and per event in the list, range as a band on the timeline, edges set over the playhead line, `api/export` → `api/export-status` → `api/export-file` (save, or share up to 100 MB); `SentinelClient.startExport/exportStatus/exportFileUrl/cancelExport`, `SentinelHttpError.code`. |
|
|
41
41
|
| 0.18.x | any | opt-in immersive camera page: `CameraPage appearance="immersive"` (`data-nvr-appearance` on the page) — picture edge to edge with the header over it on phones, floating controls, tabs as a segment, styled by the host through `--nvr-ctl-*`, `--nvr-float-*`, `--nvr-seg-*`, `--nvr-live-*`, `--nvr-shade-top`/`-bottom`, `--nvr-ease`/`--nvr-dur`; `header(at, { live })`, `CameraTitle` `live`/`at` (LIVE badge or the picture's time). Without the prop the page is unchanged. Client only. |
|
|
42
|
-
| 0.19.x | any (clip download: as 0.17.x) | immersive clip mode (`CameraPage appearance="immersive"`): the clip bar as a floating card with the edges as a segment, the picture edge to edge on phones; the clip bar's close button never wraps (both appearances); optional `icon` in front of the `EventsStrip` / `CameraGrid` titles. 0.19.1: below 900 px the immersive picture card is sticky (it cannot move), so that, according to WebKit's source, an iOS 26 home-screen app on an iPhone shows the status bar on the stage's background instead of blurring the top of the picture (pictures at least 90 % as wide as the screen). Client only. |
|
|
42
|
+
| 0.19.x | any (clip download: as 0.17.x) | immersive clip mode (`CameraPage appearance="immersive"`): the clip bar as a floating card with the edges as a segment, the picture edge to edge on phones; the clip bar's close button never wraps (both appearances); optional `icon` in front of the `EventsStrip` / `CameraGrid` titles. 0.19.1: below 900 px the immersive picture card is sticky (it cannot move), so that, according to WebKit's source, an iOS 26 home-screen app on an iPhone shows the status bar on the stage's background instead of blurring the top of the picture (pictures at least 90 % as wide as the screen). 0.19.2: camera tiles carry `data-nvr-camera` and hold the picture in one box (`.nvr-camtile__pic`); a tile that mounts again shows the camera's last picture (`.nvr-camtile__img--last`, also while the remembered image loads its next snapshot) until its own snapshot is decoded (`drawLastTileSnapshot` / `hasLastTileSnapshot` for a host's own pictures). Client only. |
|
|
43
43
|
|
|
44
44
|
Lab note: Scrypted's WebRTC sink re-encodes (1280 px, 15 fps) for clients that are not Windows/macOS/iOS and report a
|
|
45
45
|
screen below 1920 physical pixels, unless the source declares a width ≤ 1280. Plugin ≥ 1.2.0 declares it for recorded
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -188,10 +188,18 @@ declare function CameraGrid({ cameras, icon }: {
|
|
|
188
188
|
* stays grey for long). Kept is the loaded <img> itself — already decoded, drawn synchronously. A URL alone was not
|
|
189
189
|
* enough: api/snapshot is no-store and the poster's crossOrigin request differs in CORS mode from the tile's, so the
|
|
190
190
|
* "cached" URL meant another full-size download (~400 KB at 5 MP) before the first pixel.
|
|
191
|
+
* A tile that mounts again (back on the overview) draws it too, until its own snapshot is decoded (0.19.2). For that a
|
|
192
|
+
* copy of each loaded picture is kept as well: the tile's <img> loads its next snapshot every few seconds, and while
|
|
193
|
+
* that one loads the element has nothing to draw (WebKit) — a tile left in that moment came back empty.
|
|
191
194
|
*/
|
|
192
195
|
type TileSnapshot = HTMLImageElement | string;
|
|
193
196
|
/** `snap` = the tile's loaded <img> (preferred; give it crossOrigin="anonymous" on another origin) or its URL */
|
|
194
197
|
declare function rememberTileSnapshot(camId: string, snap: TileSnapshot): void;
|
|
198
|
+
/** whether `drawLastTileSnapshot` has a picture for this camera */
|
|
199
|
+
declare function hasLastTileSnapshot(camId: string): boolean;
|
|
200
|
+
/** Draws the camera's last tile picture onto `canvas` at the picture's own size, at once. False when there is none
|
|
201
|
+
* that can be drawn (only a URL, no image that has loaded, no 2D context). */
|
|
202
|
+
declare function drawLastTileSnapshot(camId: string, canvas: HTMLCanvasElement): boolean;
|
|
195
203
|
|
|
196
204
|
/**
|
|
197
205
|
* Leaving a Home-Screen web app on iPhone/iPad. Apple disables Picture-in-Picture there (the video reports
|
|
@@ -423,4 +431,4 @@ declare function ThemeSwatch({ name, active, previewMode, onClick, ariaLabel, }:
|
|
|
423
431
|
}): react.JSX.Element;
|
|
424
432
|
declare function AppearanceSection(p: AppearanceProps): react.JSX.Element;
|
|
425
433
|
|
|
426
|
-
export { type AppearanceProps, AppearanceSection, CameraGrid, type CameraHeaderInfo, CameraPage, type CameraPageProps, CameraTiles, CameraTitle, CardTitle, ClassBadge, DatePickerPanel, type DatePickerPanelProps, type DatePickerRequest, type Dict, EventBadges, EventList, EventsStrip, Hero, HistogramCard, type ResolvedMode, type ScrubHandlers, type SentinelUiNav, SentinelUiProvider, type SentinelUiValue, StatTile, StorageCard, type TFn, THEMES, THEME_LABELS, THEME_NAMES, TOKEN_TO_VAR, type ThemeMode, type ThemeName, ThemeSwatch, type ThemeTokens, type TileSnapshot, type TimelineProps, type Tone, UI_LOCALES, UI_LOCALE_LABELS, type UiLocale, VerticalTimeline, accentOverride, applyTheme, classLabel, createT, dateChipNav, eventLabel, fmtDays, fmtRelative, hexHue, humanBytes, interpolate, isIosHomeScreenApp, isThemeName, outsideAppHref, pickLocale, rememberTileSnapshot, resolveMode, resolveThemeMode, stageStatus, tileSnapshotWidth, translate, useDatePicker, useSentinelUi, watchSystemMode };
|
|
434
|
+
export { type AppearanceProps, AppearanceSection, CameraGrid, type CameraHeaderInfo, CameraPage, type CameraPageProps, CameraTiles, CameraTitle, CardTitle, ClassBadge, DatePickerPanel, type DatePickerPanelProps, type DatePickerRequest, type Dict, EventBadges, EventList, EventsStrip, Hero, HistogramCard, type ResolvedMode, type ScrubHandlers, type SentinelUiNav, SentinelUiProvider, type SentinelUiValue, StatTile, StorageCard, type TFn, THEMES, THEME_LABELS, THEME_NAMES, TOKEN_TO_VAR, type ThemeMode, type ThemeName, ThemeSwatch, type ThemeTokens, type TileSnapshot, type TimelineProps, type Tone, UI_LOCALES, UI_LOCALE_LABELS, type UiLocale, VerticalTimeline, accentOverride, applyTheme, classLabel, createT, dateChipNav, drawLastTileSnapshot, eventLabel, fmtDays, fmtRelative, hasLastTileSnapshot, hexHue, humanBytes, interpolate, isIosHomeScreenApp, isThemeName, outsideAppHref, pickLocale, rememberTileSnapshot, resolveMode, resolveThemeMode, stageStatus, tileSnapshotWidth, translate, useDatePicker, useSentinelUi, watchSystemMode };
|
package/dist/ui/index.js
CHANGED
|
@@ -508,17 +508,59 @@ function EventsStrip({ events, icon }) {
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
// src/ui/components/CameraGrid.tsx
|
|
511
|
-
import { useEffect, useState } from "react";
|
|
511
|
+
import { useCallback, useEffect, useState } from "react";
|
|
512
512
|
import { Camera, VideoOff, WifiOff } from "lucide-react";
|
|
513
513
|
|
|
514
514
|
// src/ui/snapshot-cache.ts
|
|
515
515
|
var last = /* @__PURE__ */ new Map();
|
|
516
|
+
var copies = /* @__PURE__ */ new Map();
|
|
516
517
|
function rememberTileSnapshot(camId, snap) {
|
|
517
518
|
last.set(camId, snap);
|
|
519
|
+
if (typeof snap === "string") copies.delete(camId);
|
|
520
|
+
else keepCopy(camId, snap);
|
|
518
521
|
}
|
|
519
522
|
function lastTileSnapshot(camId) {
|
|
520
523
|
return last.get(camId);
|
|
521
524
|
}
|
|
525
|
+
function loaded(img) {
|
|
526
|
+
return img.complete && img.naturalWidth > 0;
|
|
527
|
+
}
|
|
528
|
+
function paint(canvas, src, w, h) {
|
|
529
|
+
try {
|
|
530
|
+
const ctx = canvas.getContext("2d");
|
|
531
|
+
if (!ctx) return false;
|
|
532
|
+
canvas.width = w;
|
|
533
|
+
canvas.height = h;
|
|
534
|
+
ctx.drawImage(src, 0, 0);
|
|
535
|
+
return true;
|
|
536
|
+
} catch {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
function keepCopy(camId, img) {
|
|
541
|
+
const copy = () => {
|
|
542
|
+
if (last.get(camId) !== img || !loaded(img)) return;
|
|
543
|
+
const canvas = copies.get(camId) ?? document.createElement("canvas");
|
|
544
|
+
if (paint(canvas, img, img.naturalWidth, img.naturalHeight)) copies.set(camId, canvas);
|
|
545
|
+
};
|
|
546
|
+
if (typeof img.decode === "function") img.decode().then(copy, () => {
|
|
547
|
+
});
|
|
548
|
+
else copy();
|
|
549
|
+
}
|
|
550
|
+
function drawable(camId) {
|
|
551
|
+
const snap = last.get(camId);
|
|
552
|
+
if (snap && typeof snap !== "string" && loaded(snap))
|
|
553
|
+
return { src: snap, w: snap.naturalWidth, h: snap.naturalHeight };
|
|
554
|
+
const copy = copies.get(camId);
|
|
555
|
+
return copy ? { src: copy, w: copy.width, h: copy.height } : null;
|
|
556
|
+
}
|
|
557
|
+
function hasLastTileSnapshot(camId) {
|
|
558
|
+
return drawable(camId) !== null;
|
|
559
|
+
}
|
|
560
|
+
function drawLastTileSnapshot(camId, canvas) {
|
|
561
|
+
const pic = drawable(camId);
|
|
562
|
+
return pic ? paint(canvas, pic.src, pic.w, pic.h) : false;
|
|
563
|
+
}
|
|
522
564
|
|
|
523
565
|
// src/ui/components/CameraGrid.tsx
|
|
524
566
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -530,6 +572,11 @@ var RETRY_EVERY = 6;
|
|
|
530
572
|
function CameraTile({ cam, tick, n }) {
|
|
531
573
|
const { client, t, nav } = useSentinelUi();
|
|
532
574
|
const [failed, setFailed] = useState(0);
|
|
575
|
+
const [last2, setLast] = useState(() => hasLastTileSnapshot(cam.id));
|
|
576
|
+
const drawLast = useCallback(
|
|
577
|
+
(canvas) => void (canvas && drawLastTileSnapshot(cam.id, canvas)),
|
|
578
|
+
[cam.id]
|
|
579
|
+
);
|
|
533
580
|
useEffect(() => {
|
|
534
581
|
setFailed(0);
|
|
535
582
|
}, [client, cam.id]);
|
|
@@ -547,6 +594,7 @@ function CameraTile({ cam, tick, n }) {
|
|
|
547
594
|
"div",
|
|
548
595
|
{
|
|
549
596
|
className: `nvr-card nvr-camtile${rec === "offline" || rec === "stalled" ? " nvr-camtile--badged" : ""}`,
|
|
597
|
+
"data-nvr-camera": cam.id,
|
|
550
598
|
role: "button",
|
|
551
599
|
tabIndex: 0,
|
|
552
600
|
onClick: open,
|
|
@@ -558,17 +606,30 @@ function CameraTile({ cam, tick, n }) {
|
|
|
558
606
|
},
|
|
559
607
|
"aria-label": cam.name,
|
|
560
608
|
children: [
|
|
561
|
-
src ? /* @__PURE__ */
|
|
562
|
-
"
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
609
|
+
src ? /* @__PURE__ */ jsxs2("span", { className: "nvr-camtile__pic", children: [
|
|
610
|
+
last2 && /* @__PURE__ */ jsx4("canvas", { className: "nvr-camtile__img nvr-camtile__img--last", ref: drawLast, "aria-hidden": "true" }),
|
|
611
|
+
/* @__PURE__ */ jsx4(
|
|
612
|
+
"img",
|
|
613
|
+
{
|
|
614
|
+
className: "nvr-camtile__img",
|
|
615
|
+
src,
|
|
616
|
+
alt: "",
|
|
617
|
+
crossOrigin: "anonymous",
|
|
618
|
+
onLoad: (e) => {
|
|
619
|
+
const img = e.currentTarget;
|
|
620
|
+
rememberTileSnapshot(cam.id, img);
|
|
621
|
+
if (!last2) return;
|
|
622
|
+
const drop = () => setLast(false);
|
|
623
|
+
if (typeof img.decode === "function") img.decode().then(drop, drop);
|
|
624
|
+
else drop();
|
|
625
|
+
},
|
|
626
|
+
onError: () => {
|
|
627
|
+
if (failed > 0 || !cam.latestThumbId) setLast(false);
|
|
628
|
+
setFailed((f) => Math.min(2, f + 1));
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
)
|
|
632
|
+
] }) : /* @__PURE__ */ jsx4("div", { className: "nvr-camtile__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(Camera, { size: 32, strokeWidth: 1.5 }) }),
|
|
572
633
|
/* @__PURE__ */ jsxs2("span", { className: "nvr-camtile__name", children: [
|
|
573
634
|
cam.name,
|
|
574
635
|
cam.recording && /* @__PURE__ */ jsx4("i", { className: `nvr-camtile__dot${rec === "ok" ? "" : " nvr-camtile__dot--off"}`, "aria-hidden": "true" })
|
|
@@ -1515,7 +1576,7 @@ function VerticalTimeline(p) {
|
|
|
1515
1576
|
}
|
|
1516
1577
|
|
|
1517
1578
|
// src/ui/components/CameraPage.tsx
|
|
1518
|
-
import { useCallback as
|
|
1579
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
|
|
1519
1580
|
import {
|
|
1520
1581
|
Calendar,
|
|
1521
1582
|
Camera as Camera2,
|
|
@@ -1694,7 +1755,7 @@ function clipErrorKind(status, code) {
|
|
|
1694
1755
|
}
|
|
1695
1756
|
|
|
1696
1757
|
// src/ui/components/ClipBar.tsx
|
|
1697
|
-
import { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
1758
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
1698
1759
|
import { Share2, X } from "lucide-react";
|
|
1699
1760
|
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1700
1761
|
function canShareFiles() {
|
|
@@ -1719,7 +1780,7 @@ function ClipBar(p) {
|
|
|
1719
1780
|
const [edges, setEdges] = useState4({ cur: p.edge, was: null });
|
|
1720
1781
|
if (edges.cur !== p.edge) setEdges({ cur: p.edge, was: edges.cur });
|
|
1721
1782
|
const jobRef = useRef2(job);
|
|
1722
|
-
const setJob =
|
|
1783
|
+
const setJob = useCallback2((j) => {
|
|
1723
1784
|
jobRef.current = j;
|
|
1724
1785
|
setJobState(j);
|
|
1725
1786
|
}, []);
|
|
@@ -1727,13 +1788,13 @@ function ClipBar(p) {
|
|
|
1727
1788
|
const alive = useRef2(true);
|
|
1728
1789
|
const abort = useRef2(null);
|
|
1729
1790
|
const standalone = isIosHomeScreenApp();
|
|
1730
|
-
const release =
|
|
1791
|
+
const release = useCallback2(() => {
|
|
1731
1792
|
abort.current?.abort();
|
|
1732
1793
|
abort.current = null;
|
|
1733
1794
|
const j = jobRef.current;
|
|
1734
1795
|
if (j.s === "ready" && j.blobUrl) URL.revokeObjectURL(j.blobUrl);
|
|
1735
1796
|
}, []);
|
|
1736
|
-
const cancelRunning =
|
|
1797
|
+
const cancelRunning = useCallback2(() => {
|
|
1737
1798
|
const j = jobRef.current;
|
|
1738
1799
|
if (j.s === "running") void client.cancelExport(j.id);
|
|
1739
1800
|
}, [client]);
|
|
@@ -1757,14 +1818,14 @@ function ClipBar(p) {
|
|
|
1757
1818
|
release();
|
|
1758
1819
|
setJob({ s: "idle" });
|
|
1759
1820
|
}, [rangeKey, cancelRunning, release, setJob]);
|
|
1760
|
-
const fail =
|
|
1821
|
+
const fail = useCallback2(
|
|
1761
1822
|
(kind, vars, extra) => {
|
|
1762
1823
|
rlog("clip", { ok: false, err: kind, standalone, ...extra });
|
|
1763
1824
|
setJob(vars ? { s: "error", kind, vars } : { s: "error", kind });
|
|
1764
1825
|
},
|
|
1765
1826
|
[setJob, standalone]
|
|
1766
1827
|
);
|
|
1767
|
-
const errorOf =
|
|
1828
|
+
const errorOf = useCallback2(
|
|
1768
1829
|
(e) => {
|
|
1769
1830
|
const st2 = e instanceof SentinelHttpError ? e.status : 0;
|
|
1770
1831
|
const code = e instanceof SentinelHttpError ? e.code : void 0;
|
|
@@ -1781,7 +1842,7 @@ function ClipBar(p) {
|
|
|
1781
1842
|
},
|
|
1782
1843
|
[fail, locale]
|
|
1783
1844
|
);
|
|
1784
|
-
const finish =
|
|
1845
|
+
const finish = useCallback2(
|
|
1785
1846
|
async (g, d) => {
|
|
1786
1847
|
const crossOrigin = isCrossOrigin(client.exportFileUrl(d.id));
|
|
1787
1848
|
const ways = clipWays({ bytes: d.bytes, canShareFiles: canShareFiles(), standalone, crossOrigin });
|
|
@@ -1895,7 +1956,7 @@ function ClipBar(p) {
|
|
|
1895
1956
|
);
|
|
1896
1957
|
return () => window.clearTimeout(i);
|
|
1897
1958
|
}, [expiresAt, release, setJob]);
|
|
1898
|
-
const create =
|
|
1959
|
+
const create = useCallback2(async () => {
|
|
1899
1960
|
const j = jobRef.current;
|
|
1900
1961
|
if (j.s === "starting" || j.s === "running" || j.s === "loading") return;
|
|
1901
1962
|
gen.current++;
|
|
@@ -1916,7 +1977,7 @@ function ClipBar(p) {
|
|
|
1916
1977
|
errorOf(e);
|
|
1917
1978
|
}
|
|
1918
1979
|
}, [client, p, release, setJob, errorOf]);
|
|
1919
|
-
const cancel =
|
|
1980
|
+
const cancel = useCallback2(() => {
|
|
1920
1981
|
cancelRunning();
|
|
1921
1982
|
gen.current++;
|
|
1922
1983
|
release();
|
|
@@ -2169,7 +2230,7 @@ function CameraPage(p) {
|
|
|
2169
2230
|
const i = setTimeout(() => setPipNote(null), 15e3);
|
|
2170
2231
|
return () => clearTimeout(i);
|
|
2171
2232
|
}, [pipNote]);
|
|
2172
|
-
const onPip =
|
|
2233
|
+
const onPip = useCallback3(() => {
|
|
2173
2234
|
const c = ctl.current;
|
|
2174
2235
|
if (!c) return;
|
|
2175
2236
|
void c.pip().then((r) => {
|
|
@@ -2205,7 +2266,7 @@ function CameraPage(p) {
|
|
|
2205
2266
|
const rangeEnd = Math.min(sentinelDayEnd(todayStart()), nowTick + 20 * 6e4);
|
|
2206
2267
|
return { ...m, rangeStart, rangeEnd };
|
|
2207
2268
|
}, [days, nowTick]);
|
|
2208
|
-
const mergedNow =
|
|
2269
|
+
const mergedNow = useCallback3(() => {
|
|
2209
2270
|
const m = sentinelMergeDays(daysRef.current);
|
|
2210
2271
|
return {
|
|
2211
2272
|
...m,
|
|
@@ -2216,7 +2277,7 @@ function CameraPage(p) {
|
|
|
2216
2277
|
useEffect4(() => {
|
|
2217
2278
|
ctl.current?.setClips(merged.clips, merged.codecs, merged.rangeStart, merged.rangeEnd);
|
|
2218
2279
|
}, [merged]);
|
|
2219
|
-
const fetchDay =
|
|
2280
|
+
const fetchDay = useCallback3(
|
|
2220
2281
|
async (ds) => {
|
|
2221
2282
|
const d = await client.getJson(
|
|
2222
2283
|
`api/clips?camera=${encodeURIComponent(camId)}&start=${ds}&end=${sentinelDayEnd(ds)}`
|
|
@@ -2228,7 +2289,7 @@ function CameraPage(p) {
|
|
|
2228
2289
|
},
|
|
2229
2290
|
[client, camId]
|
|
2230
2291
|
);
|
|
2231
|
-
const ensureDay =
|
|
2292
|
+
const ensureDay = useCallback3(
|
|
2232
2293
|
async (ds, force = false) => {
|
|
2233
2294
|
if (ds > todayStart()) return;
|
|
2234
2295
|
if (earliest && sentinelAddDays(ds, 1) < sentinelDayOf(earliest)) return;
|
|
@@ -2246,7 +2307,7 @@ function CameraPage(p) {
|
|
|
2246
2307
|
},
|
|
2247
2308
|
[fetchDay, earliest, camId]
|
|
2248
2309
|
);
|
|
2249
|
-
const onCenter =
|
|
2310
|
+
const onCenter = useCallback3(
|
|
2250
2311
|
(ts) => {
|
|
2251
2312
|
lineTs.current = ts;
|
|
2252
2313
|
const d = sentinelDayOf(ts);
|
|
@@ -2364,11 +2425,11 @@ function CameraPage(p) {
|
|
|
2364
2425
|
[merged.events, filterOff]
|
|
2365
2426
|
);
|
|
2366
2427
|
const dayCount = useMemo2(() => eventsOnDay(visEvents, centerDay), [visEvents, centerDay]);
|
|
2367
|
-
const goLive =
|
|
2428
|
+
const goLive = useCallback3(() => {
|
|
2368
2429
|
ctl.current?.goLive();
|
|
2369
2430
|
setJump({ ts: Date.now(), n: Date.now() });
|
|
2370
2431
|
}, []);
|
|
2371
|
-
const playEvent =
|
|
2432
|
+
const playEvent = useCallback3((ev) => {
|
|
2372
2433
|
const c = ctl.current;
|
|
2373
2434
|
if (!c) return;
|
|
2374
2435
|
setTab("tl");
|
|
@@ -2376,7 +2437,7 @@ function CameraPage(p) {
|
|
|
2376
2437
|
c.posterEvent(ev.timestamp);
|
|
2377
2438
|
c.playAt(sentinelEventPlayTs(ev), {});
|
|
2378
2439
|
}, []);
|
|
2379
|
-
const seekTo =
|
|
2440
|
+
const seekTo = useCallback3(
|
|
2380
2441
|
(ts) => {
|
|
2381
2442
|
const c = ctl.current;
|
|
2382
2443
|
if (!c) return;
|
|
@@ -2389,7 +2450,7 @@ function CameraPage(p) {
|
|
|
2389
2450
|
},
|
|
2390
2451
|
[goLive]
|
|
2391
2452
|
);
|
|
2392
|
-
const jumpEvent =
|
|
2453
|
+
const jumpEvent = useCallback3(
|
|
2393
2454
|
(dir) => {
|
|
2394
2455
|
const c = ctl.current;
|
|
2395
2456
|
if (!c) return;
|
|
@@ -2409,7 +2470,7 @@ function CameraPage(p) {
|
|
|
2409
2470
|
},
|
|
2410
2471
|
[visEvents, playEvent]
|
|
2411
2472
|
);
|
|
2412
|
-
const goToDay =
|
|
2473
|
+
const goToDay = useCallback3(
|
|
2413
2474
|
async (ds, at2) => {
|
|
2414
2475
|
const c = ctl.current;
|
|
2415
2476
|
if (!c) return;
|
|
@@ -2437,7 +2498,7 @@ function CameraPage(p) {
|
|
|
2437
2498
|
);
|
|
2438
2499
|
const canExport = useMemo2(() => Object.values(days).some((d) => sentinelHasFeature(d, "export")), [days]);
|
|
2439
2500
|
const oldestRec = earliest ?? merged.clips[0]?.startTime;
|
|
2440
|
-
const clipEvent =
|
|
2501
|
+
const clipEvent = useCallback3(
|
|
2441
2502
|
(ev) => {
|
|
2442
2503
|
const now = Date.now();
|
|
2443
2504
|
const r = clipRangeForEvent(ev, now);
|
|
@@ -2452,11 +2513,11 @@ function CameraPage(p) {
|
|
|
2452
2513
|
},
|
|
2453
2514
|
[oldestRec]
|
|
2454
2515
|
);
|
|
2455
|
-
const closeClip =
|
|
2516
|
+
const closeClip = useCallback3(() => {
|
|
2456
2517
|
setClip(null);
|
|
2457
2518
|
setClipEdge(null);
|
|
2458
2519
|
}, []);
|
|
2459
|
-
const toggleClip =
|
|
2520
|
+
const toggleClip = useCallback3(() => {
|
|
2460
2521
|
if (clipRef.current) {
|
|
2461
2522
|
closeClip();
|
|
2462
2523
|
return;
|
|
@@ -2474,7 +2535,7 @@ function CameraPage(p) {
|
|
|
2474
2535
|
setClipEdge(null);
|
|
2475
2536
|
setTab("tl");
|
|
2476
2537
|
}, [closeClip, visEvents, oldestRec]);
|
|
2477
|
-
const activateEdge =
|
|
2538
|
+
const activateEdge = useCallback3((e) => {
|
|
2478
2539
|
setClipEdge(e);
|
|
2479
2540
|
const r = clipRef.current;
|
|
2480
2541
|
if (!e || !r) return;
|
|
@@ -2487,7 +2548,7 @@ function CameraPage(p) {
|
|
|
2487
2548
|
c.playAt(ts, {});
|
|
2488
2549
|
}
|
|
2489
2550
|
}, []);
|
|
2490
|
-
const onUserCenter =
|
|
2551
|
+
const onUserCenter = useCallback3((ts) => {
|
|
2491
2552
|
lineTs.current = ts;
|
|
2492
2553
|
const e = clipEdgeRef.current, r = clipRef.current;
|
|
2493
2554
|
if (!e || !r) return;
|
|
@@ -2495,7 +2556,7 @@ function CameraPage(p) {
|
|
|
2495
2556
|
setClip({ ...n.range, open: false });
|
|
2496
2557
|
if (n.edge !== e) setClipEdge(n.edge);
|
|
2497
2558
|
}, []);
|
|
2498
|
-
const setEdgeToLine =
|
|
2559
|
+
const setEdgeToLine = useCallback3((e) => {
|
|
2499
2560
|
const r = clipRef.current;
|
|
2500
2561
|
if (!r) return;
|
|
2501
2562
|
const s = psRef.current;
|
|
@@ -2505,7 +2566,7 @@ function CameraPage(p) {
|
|
|
2505
2566
|
setClip({ ...n.range, open: false });
|
|
2506
2567
|
if (clipEdgeRef.current) setClipEdge(n.edge);
|
|
2507
2568
|
}, []);
|
|
2508
|
-
const onTimelineEvent =
|
|
2569
|
+
const onTimelineEvent = useCallback3(
|
|
2509
2570
|
(ev) => clipRef.current ? clipEvent(ev) : playEvent(ev),
|
|
2510
2571
|
[clipEvent, playEvent]
|
|
2511
2572
|
);
|
|
@@ -3083,9 +3144,11 @@ export {
|
|
|
3083
3144
|
classLabel,
|
|
3084
3145
|
createT,
|
|
3085
3146
|
dateChipNav,
|
|
3147
|
+
drawLastTileSnapshot,
|
|
3086
3148
|
eventLabel,
|
|
3087
3149
|
fmtDays,
|
|
3088
3150
|
fmtRelative,
|
|
3151
|
+
hasLastTileSnapshot,
|
|
3089
3152
|
hexHue,
|
|
3090
3153
|
humanBytes,
|
|
3091
3154
|
interpolate,
|