mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 23:25:25 +03:00
improve image loading skeleton in object lifecycle pane
This commit is contained in:
parent
fedc3156e8
commit
2c3e2f9408
@ -77,6 +77,17 @@ export default function ObjectLifecycle({
|
|||||||
const [showControls, setShowControls] = useState(false);
|
const [showControls, setShowControls] = useState(false);
|
||||||
const [showZones, setShowZones] = useState(true);
|
const [showZones, setShowZones] = useState(true);
|
||||||
|
|
||||||
|
const aspectRatio = useMemo(() => {
|
||||||
|
if (!config) {
|
||||||
|
return 16 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
config.cameras[event.camera].detect.width /
|
||||||
|
config.cameras[event.camera].detect.height
|
||||||
|
);
|
||||||
|
}, [config, event]);
|
||||||
|
|
||||||
const getZoneColor = useCallback(
|
const getZoneColor = useCallback(
|
||||||
(zoneName: string) => {
|
(zoneName: string) => {
|
||||||
const zoneColor =
|
const zoneColor =
|
||||||
@ -240,7 +251,15 @@ export default function ObjectLifecycle({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="relative flex flex-row justify-center">
|
<div
|
||||||
|
className={cn(
|
||||||
|
"relative mx-auto flex max-h-[50dvh] flex-row justify-center",
|
||||||
|
!imgLoaded && aspectRatio < 16 / 9 && "h-full",
|
||||||
|
)}
|
||||||
|
style={{
|
||||||
|
aspectRatio: !imgLoaded ? aspectRatio : undefined,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ImageLoadingIndicator
|
<ImageLoadingIndicator
|
||||||
className="absolute inset-0"
|
className="absolute inset-0"
|
||||||
imgLoaded={imgLoaded}
|
imgLoaded={imgLoaded}
|
||||||
@ -263,7 +282,7 @@ export default function ObjectLifecycle({
|
|||||||
key={event.id}
|
key={event.id}
|
||||||
ref={imgRef}
|
ref={imgRef}
|
||||||
className={cn(
|
className={cn(
|
||||||
"max-h-[50dvh] max-w-full select-none rounded-lg object-contain transition-opacity",
|
"max-h-[50dvh] max-w-full select-none rounded-lg object-contain",
|
||||||
)}
|
)}
|
||||||
loading={isSafari ? "eager" : "lazy"}
|
loading={isSafari ? "eager" : "lazy"}
|
||||||
style={
|
style={
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user