mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-09 08:37: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
|
||||
severity: "alert",
|
||||
timelineType: notificationTab,
|
||||
navigationSource: "shared-link",
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
@ -40,6 +40,7 @@ export type RecordingStartingPoint = {
|
||||
startTime: number;
|
||||
severity: ReviewSeverity;
|
||||
timelineType?: TimelineType;
|
||||
navigationSource?: "shared-link";
|
||||
};
|
||||
|
||||
export type RecordingPlayerError = "stalled" | "startup";
|
||||
|
||||
@ -349,6 +349,16 @@ export function RecordingView({
|
||||
[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(() => {
|
||||
if (!scrubbing) {
|
||||
if (Math.abs(currentTime - playerTime) > 10) {
|
||||
@ -599,7 +609,7 @@ export function RecordingView({
|
||||
className="flex items-center gap-2.5 rounded-lg"
|
||||
aria-label={t("label.back", { ns: "common" })}
|
||||
size="sm"
|
||||
onClick={() => navigate(-1)}
|
||||
onClick={handleBack}
|
||||
>
|
||||
<IoMdArrowRoundBack className="size-5 text-secondary-foreground" />
|
||||
{isDesktop && (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user