mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-18 07:29:45 +00:00
remember last selected history sidebar tab (#24488)
The History view always opened on Timeline unless the link carried a tab. The selected tab is now saved with useUserPersistence and used as the default when no tab is passed. Notification and shared review links no longer default to "timeline", so they pick up the saved tab too, and `?tab=` still overrides it.
This commit is contained in:
parent
0977fa5e15
commit
f9a37d4f4f
@ -132,8 +132,7 @@ export default function Events() {
|
||||
setMotionSearchDay(normalizedDay);
|
||||
}, []);
|
||||
|
||||
const [notificationTab, setNotificationTab] =
|
||||
useState<TimelineType>("timeline");
|
||||
const [notificationTab, setNotificationTab] = useState<TimelineType>();
|
||||
|
||||
const getReviewDayBounds = useCallback((date: Date) => {
|
||||
const now = Date.now() / 1000;
|
||||
|
||||
@ -14,6 +14,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { useOverlayState } from "@/hooks/use-overlay-state";
|
||||
import { usePersistence } from "@/hooks/use-persistence";
|
||||
import { useUserPersistence } from "@/hooks/use-user-persistence";
|
||||
import { useResizeObserver } from "@/hooks/resize-observer";
|
||||
import { DEFAULT_DRAWER_FEATURES, ExportMode } from "@/types/filter";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
@ -182,9 +183,19 @@ export function RecordingView({
|
||||
false,
|
||||
);
|
||||
|
||||
const [timelineType, setTimelineType] = useOverlayState<TimelineType>(
|
||||
const [savedTimelineType, setSavedTimelineType] =
|
||||
useUserPersistence<TimelineType>("recordingTimelineType");
|
||||
const [timelineType, setOverlayTimelineType] = useOverlayState<TimelineType>(
|
||||
"timelineType",
|
||||
recording?.timelineType ?? "timeline",
|
||||
recording?.timelineType ?? savedTimelineType ?? "timeline",
|
||||
);
|
||||
|
||||
const setTimelineType = useCallback(
|
||||
(value: TimelineType, replace?: boolean) => {
|
||||
setOverlayTimelineType(value, replace);
|
||||
setSavedTimelineType(value);
|
||||
},
|
||||
[setOverlayTimelineType, setSavedTimelineType],
|
||||
);
|
||||
|
||||
const chunkedTimeRange = useMemo(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user