mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-09 16:47:37 +03:00
Fix back navigation when coming from direct shared timestamp links
This commit is contained in:
parent
0fb507ae3c
commit
8d462588fc
@ -280,6 +280,7 @@ export default function Events() {
|
|||||||
// this pattern is also used LiveCameraView to enter recording view
|
// this pattern is also used LiveCameraView to enter recording view
|
||||||
severity: "alert",
|
severity: "alert",
|
||||||
timelineType: notificationTab,
|
timelineType: notificationTab,
|
||||||
|
navigationSource: "shared-link",
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ export type RecordingStartingPoint = {
|
|||||||
startTime: number;
|
startTime: number;
|
||||||
severity: ReviewSeverity;
|
severity: ReviewSeverity;
|
||||||
timelineType?: TimelineType;
|
timelineType?: TimelineType;
|
||||||
|
navigationSource?: "shared-link";
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RecordingPlayerError = "stalled" | "startup";
|
export type RecordingPlayerError = "stalled" | "startup";
|
||||||
|
|||||||
@ -349,6 +349,16 @@ export function RecordingView({
|
|||||||
[location.pathname, mainCamera, t],
|
[location.pathname, mainCamera, t],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleBack = useCallback(() => {
|
||||||
|
// if we came from a direct share link, there is no history to go back to, so navigate to the homepage instead
|
||||||
|
if (recording?.navigationSource === "shared-link") {
|
||||||
|
navigate("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigate(-1);
|
||||||
|
}, [navigate, recording?.navigationSource]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!scrubbing) {
|
if (!scrubbing) {
|
||||||
if (Math.abs(currentTime - playerTime) > 10) {
|
if (Math.abs(currentTime - playerTime) > 10) {
|
||||||
@ -599,7 +609,7 @@ export function RecordingView({
|
|||||||
className="flex items-center gap-2.5 rounded-lg"
|
className="flex items-center gap-2.5 rounded-lg"
|
||||||
aria-label={t("label.back", { ns: "common" })}
|
aria-label={t("label.back", { ns: "common" })}
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => navigate(-1)}
|
onClick={handleBack}
|
||||||
>
|
>
|
||||||
<IoMdArrowRoundBack className="size-5 text-secondary-foreground" />
|
<IoMdArrowRoundBack className="size-5 text-secondary-foreground" />
|
||||||
{isDesktop && (
|
{isDesktop && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user