mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 22:25:24 +03:00
fix case where camera is disabled and has no previews
This commit is contained in:
parent
d01457e64d
commit
04d1ec1f92
@ -487,8 +487,6 @@ function PreviewFramesPlayer({
|
|||||||
|
|
||||||
// initial state
|
// initial state
|
||||||
|
|
||||||
const [firstLoad, setFirstLoad] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
return;
|
return;
|
||||||
@ -503,8 +501,6 @@ function PreviewFramesPlayer({
|
|||||||
}, [controller]);
|
}, [controller]);
|
||||||
|
|
||||||
const onImageLoaded = useCallback(() => {
|
const onImageLoaded = useCallback(() => {
|
||||||
setFirstLoad(false);
|
|
||||||
|
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -540,12 +536,14 @@ function PreviewFramesPlayer({
|
|||||||
className={`size-full rounded-lg bg-black object-contain md:rounded-2xl`}
|
className={`size-full rounded-lg bg-black object-contain md:rounded-2xl`}
|
||||||
onLoad={onImageLoaded}
|
onLoad={onImageLoaded}
|
||||||
/>
|
/>
|
||||||
{previewFrames?.length === 0 && (
|
{previewFrames && previewFrames.length === 0 && (
|
||||||
<div className="-y-translate-1/2 align-center absolute inset-x-0 top-1/2 rounded-lg bg-background_alt text-center text-primary md:rounded-2xl">
|
<div className="-y-translate-1/2 align-center absolute inset-x-0 top-1/2 rounded-lg bg-background_alt text-center text-primary md:rounded-2xl">
|
||||||
No Preview Found for {camera.replaceAll("_", " ")}
|
No Preview Found for {camera.replaceAll("_", " ")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{firstLoad && <Skeleton className="absolute aspect-video size-full" />}
|
{previewFrames == undefined && (
|
||||||
|
<Skeleton className="absolute aspect-video size-full" />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user