mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-03 22:04:53 +03:00
Bugfix: Share dialog was not receiving the player timestamp after removing key that triggered remounts
This commit is contained in:
parent
dd5ad11a6e
commit
55a858783c
@ -31,6 +31,10 @@ type ShareTimestampDialogProps = {
|
|||||||
currentTime: number;
|
currentTime: number;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
|
selectedOption: "current" | "custom";
|
||||||
|
setSelectedOption: (option: "current" | "custom") => void;
|
||||||
|
customTimestamp: number;
|
||||||
|
setCustomTimestamp: (timestamp: number) => void;
|
||||||
onShareTimestamp: (timestamp: number) => void;
|
onShareTimestamp: (timestamp: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,35 +42,22 @@ export default function ShareTimestampDialog({
|
|||||||
currentTime,
|
currentTime,
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
|
selectedOption,
|
||||||
|
setSelectedOption,
|
||||||
|
customTimestamp,
|
||||||
|
setCustomTimestamp,
|
||||||
onShareTimestamp,
|
onShareTimestamp,
|
||||||
}: Readonly<ShareTimestampDialogProps>) {
|
}: Readonly<ShareTimestampDialogProps>) {
|
||||||
const { t } = useTranslation(["components/dialog"]);
|
const { t } = useTranslation(["components/dialog"]);
|
||||||
const [selectedOption, setSelectedOption] = useState<"current" | "custom">(
|
|
||||||
"current",
|
|
||||||
);
|
|
||||||
const [openedCurrentTime, setOpenedCurrentTime] = useState(
|
|
||||||
Math.floor(currentTime),
|
|
||||||
);
|
|
||||||
const [customTimestamp, setCustomTimestamp] = useState(openedCurrentTime);
|
|
||||||
|
|
||||||
const handleOpenChange = useCallback(
|
const handleOpenChange = useCallback(
|
||||||
(nextOpen: boolean) => {
|
(nextOpen: boolean) => onOpenChange(nextOpen),
|
||||||
if (nextOpen) {
|
[onOpenChange],
|
||||||
const initialTimestamp = Math.floor(currentTime);
|
|
||||||
|
|
||||||
setOpenedCurrentTime(initialTimestamp);
|
|
||||||
setSelectedOption("current");
|
|
||||||
setCustomTimestamp(initialTimestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
onOpenChange(nextOpen);
|
|
||||||
},
|
|
||||||
[currentTime, onOpenChange],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<ShareTimestampContent
|
<ShareTimestampContent
|
||||||
currentTime={openedCurrentTime}
|
currentTime={currentTime}
|
||||||
selectedOption={selectedOption}
|
selectedOption={selectedOption}
|
||||||
setSelectedOption={setSelectedOption}
|
setSelectedOption={setSelectedOption}
|
||||||
customTimestamp={customTimestamp}
|
customTimestamp={customTimestamp}
|
||||||
|
|||||||
@ -213,6 +213,12 @@ export function RecordingView({
|
|||||||
const [shareTimestampAtOpen, setShareTimestampAtOpen] = useState(
|
const [shareTimestampAtOpen, setShareTimestampAtOpen] = useState(
|
||||||
Math.floor(startTime),
|
Math.floor(startTime),
|
||||||
);
|
);
|
||||||
|
const [shareTimestampOption, setShareTimestampOption] = useState<
|
||||||
|
"current" | "custom"
|
||||||
|
>("current");
|
||||||
|
const [customShareTimestamp, setCustomShareTimestamp] = useState(
|
||||||
|
Math.floor(startTime),
|
||||||
|
);
|
||||||
|
|
||||||
// move to next clip
|
// move to next clip
|
||||||
|
|
||||||
@ -694,13 +700,21 @@ export function RecordingView({
|
|||||||
currentTime={shareTimestampAtOpen}
|
currentTime={shareTimestampAtOpen}
|
||||||
open={shareTimestampOpen}
|
open={shareTimestampOpen}
|
||||||
onOpenChange={setShareTimestampOpen}
|
onOpenChange={setShareTimestampOpen}
|
||||||
|
selectedOption={shareTimestampOption}
|
||||||
|
setSelectedOption={setShareTimestampOption}
|
||||||
|
customTimestamp={customShareTimestamp}
|
||||||
|
setCustomTimestamp={setCustomShareTimestamp}
|
||||||
onShareTimestamp={onShareReviewLink}
|
onShareTimestamp={onShareReviewLink}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isDesktop && (
|
{isDesktop && (
|
||||||
<ActionsDropdown
|
<ActionsDropdown
|
||||||
onShareTimestampClick={() => {
|
onShareTimestampClick={() => {
|
||||||
setShareTimestampAtOpen(Math.floor(currentTime));
|
const initialTimestamp = Math.floor(currentTime);
|
||||||
|
|
||||||
|
setShareTimestampAtOpen(initialTimestamp);
|
||||||
|
setShareTimestampOption("current");
|
||||||
|
setCustomShareTimestamp(initialTimestamp);
|
||||||
setShareTimestampOpen(true);
|
setShareTimestampOpen(true);
|
||||||
}}
|
}}
|
||||||
onDebugReplayClick={() => {
|
onDebugReplayClick={() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user