Hide live view in preload mode if there's a message to display.
This commit is contained in:
+8
-19
@@ -1032,8 +1032,8 @@ export class FrigateCard extends LitElement {
|
|||||||
return !(
|
return !(
|
||||||
(screenfull.isEnabled && screenfull.isFullscreen) ||
|
(screenfull.isEnabled && screenfull.isFullscreen) ||
|
||||||
aspectRatioMode == 'unconstrained' ||
|
aspectRatioMode == 'unconstrained' ||
|
||||||
(aspectRatioMode == 'dynamic' && this._view?.isMediaView() ||
|
(aspectRatioMode == 'dynamic' && this._view?.isMediaView()) ||
|
||||||
this._message != null)
|
this._message != null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,25 +1175,16 @@ export class FrigateCard extends LitElement {
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
const galleryClasses = {
|
// Render but hide the live view if there's a message, or if it's preload
|
||||||
hidden: this._getConfig().live.preload && !this._view.isGalleryView(),
|
// mode and the view is not live.
|
||||||
};
|
|
||||||
const viewerClasses = {
|
|
||||||
hidden: this._getConfig().live.preload && !this._view.isViewerView(),
|
|
||||||
};
|
|
||||||
const liveClasses = {
|
const liveClasses = {
|
||||||
hidden: this._getConfig().live.preload && this._view.view != 'live',
|
hidden:
|
||||||
};
|
!!this._message || (this._getConfig().live.preload && !this._view.is('live')),
|
||||||
const imageClasses = {
|
|
||||||
hidden: this._getConfig().live.preload && this._view.view != 'image',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
${!this._message && this._view.is('image')
|
${!this._message && this._view.is('image')
|
||||||
? html` <frigate-card-image
|
? html` <frigate-card-image .imageConfig=${this._getConfig().image}>
|
||||||
.imageConfig=${this._getConfig().image}
|
|
||||||
class="${classMap(imageClasses)}"
|
|
||||||
>
|
|
||||||
</frigate-card-image>`
|
</frigate-card-image>`
|
||||||
: ``}
|
: ``}
|
||||||
${!this._message && this._view.isGalleryView()
|
${!this._message && this._view.isGalleryView()
|
||||||
@@ -1201,7 +1192,6 @@ export class FrigateCard extends LitElement {
|
|||||||
.hass=${this._hass}
|
.hass=${this._hass}
|
||||||
.view=${this._view}
|
.view=${this._view}
|
||||||
.cameraConfig=${cameraConfig}
|
.cameraConfig=${cameraConfig}
|
||||||
class="${classMap(galleryClasses)}"
|
|
||||||
>
|
>
|
||||||
</frigate-card-gallery>`
|
</frigate-card-gallery>`
|
||||||
: ``}
|
: ``}
|
||||||
@@ -1212,7 +1202,6 @@ export class FrigateCard extends LitElement {
|
|||||||
.cameraConfig=${cameraConfig}
|
.cameraConfig=${cameraConfig}
|
||||||
.viewerConfig=${this._getConfig().event_viewer}
|
.viewerConfig=${this._getConfig().event_viewer}
|
||||||
.resolvedMediaCache=${this._resolvedMediaCache}
|
.resolvedMediaCache=${this._resolvedMediaCache}
|
||||||
class="${classMap(viewerClasses)}"
|
|
||||||
>
|
>
|
||||||
</frigate-card-viewer>`
|
</frigate-card-viewer>`
|
||||||
: ``}
|
: ``}
|
||||||
@@ -1223,7 +1212,7 @@ export class FrigateCard extends LitElement {
|
|||||||
// Note: <frigate-card-live> uses the baseConfig rather than the
|
// Note: <frigate-card-live> uses the baseConfig rather than the
|
||||||
// overriden config, as it does it's own overriding as part of the
|
// overriden config, as it does it's own overriding as part of the
|
||||||
// camera carousel.
|
// camera carousel.
|
||||||
(!this._message && this._view.is('live')) || this._getConfig().live.preload
|
this._getConfig().live.preload || (!this._message && this._view.is('live'))
|
||||||
? html`
|
? html`
|
||||||
<frigate-card-live
|
<frigate-card-live
|
||||||
.hass=${this._hass}
|
.hass=${this._hass}
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ export class FrigateCardLive extends LitElement {
|
|||||||
try {
|
try {
|
||||||
parent = await BrowseMediaUtil.browseMediaQuery(this.hass, browseMediaParams);
|
parent = await BrowseMediaUtil.browseMediaQuery(this.hass, browseMediaParams);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.info('thumb exception')
|
||||||
return dispatchErrorMessageEvent(this, (e as Error).message);
|
return dispatchErrorMessageEvent(this, (e as Error).message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -71,7 +71,8 @@ ha-card {
|
|||||||
background-color: var(--secondary-background-color, black);
|
background-color: var(--secondary-background-color, black);
|
||||||
}
|
}
|
||||||
|
|
||||||
frigate-card-gallery.hidden,frigate-card-viewer.hidden,frigate-card-live.hidden {
|
frigate-card-live.hidden {
|
||||||
|
// Live view will be rendered but hidden for live preloading.
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user