Retire the '*-specific' views.

This commit is contained in:
Dermot Duffy
2022-01-14 21:31:16 -08:00
parent faeb4a4a7e
commit 6e2786c7b5
5 changed files with 9 additions and 18 deletions
+2 -2
View File
@@ -214,8 +214,8 @@ export class FrigateCardGalleryCore extends LitElement {
if (this.view) { if (this.view) {
new View({ new View({
view: this.view.is('clips') view: this.view.is('clips')
? 'clip-specific' ? 'clip'
: 'snapshot-specific', : 'snapshot',
camera: this.view.camera, camera: this.view.camera,
target: this.view.target ?? undefined, target: this.view.target ?? undefined,
childIndex: index, childIndex: index,
+1 -3
View File
@@ -1,5 +1,3 @@
// TODO Live scrolling nav buttons disappearing
// TODO can I do away with clip/snapshot-specific?
// TODO Live carousel chevron/icons style // TODO Live carousel chevron/icons style
// TODO call change-event in viewer // TODO call change-event in viewer
// TODO editor for live lazy loading // TODO editor for live lazy loading
@@ -146,7 +144,7 @@ export class FrigateCardLive extends LitElement {
const mediaType = browseMediaParams.mediaType; const mediaType = browseMediaParams.mediaType;
if (mediaType && this.view && ['snapshots', 'clips'].includes(mediaType)) { if (mediaType && this.view && ['snapshots', 'clips'].includes(mediaType)) {
new View({ new View({
view: mediaType === 'clips' ? 'clip-specific' : 'snapshot-specific', view: mediaType === 'clips' ? 'clip' : 'snapshot',
camera: this.view.camera, camera: this.view.camera,
target: ev.detail.target, target: ev.detail.target,
childIndex: ev.detail.childIndex, childIndex: ev.detail.childIndex,
+1 -1
View File
@@ -445,7 +445,7 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
const clipStartTime = BrowseMediaUtil.extractEventStartTime(child); const clipStartTime = BrowseMediaUtil.extractEventStartTime(child);
if (clipStartTime && clipStartTime === snapshotStartTime) { if (clipStartTime && clipStartTime === snapshotStartTime) {
return new View({ return new View({
view: 'clip-specific', view: 'clip',
camera: this.view.camera, camera: this.view.camera,
target: clips, target: clips,
childIndex: i, childIndex: i,
+2 -9
View File
@@ -31,14 +31,7 @@ const FRIGATE_CARD_VIEWS_USER_SPECIFIED = [
'image', // Static image. 'image', // Static image.
] as const; ] as const;
const FRIGATE_CARD_VIEWS_INTERNAL = [ export type FrigateCardView = typeof FRIGATE_CARD_VIEWS_USER_SPECIFIED[number];
'clip-specific', // A specific clip.
'snapshot-specific', // A specific snapshot.
] as const;
export type FrigateCardView =
| typeof FRIGATE_CARD_VIEWS_USER_SPECIFIED[number]
| typeof FRIGATE_CARD_VIEWS_INTERNAL[number];
const FRIGATE_MENU_MODES = [ const FRIGATE_MENU_MODES = [
'none', 'none',
@@ -578,7 +571,7 @@ const menuConfigSchema = z
export type MenuConfig = z.infer<typeof menuConfigSchema>; export type MenuConfig = z.infer<typeof menuConfigSchema>;
/** /**
* Event viewer configuration section (clip, snapshot, clip-specific, snapshot-specific). * Event viewer configuration section (clip, snapshot).
*/ */
const viewerConfigDefault = { const viewerConfigDefault = {
autoplay_clip: false, autoplay_clip: false,
+3 -3
View File
@@ -82,7 +82,7 @@ export class View {
* Determine if a view is for the media viewer. * Determine if a view is for the media viewer.
*/ */
public isViewerView(): boolean { public isViewerView(): boolean {
return ['clip', 'clip-specific', 'snapshot', 'snapshot-specific'].includes( return ['clip', 'snapshot'].includes(
this.view, this.view,
); );
} }
@@ -91,14 +91,14 @@ export class View {
* Determine if a view is related to a clip or clips. * Determine if a view is related to a clip or clips.
*/ */
public isClipRelatedView(): boolean { public isClipRelatedView(): boolean {
return ['clip', 'clips', 'clip-specific'].includes(this.view); return ['clip', 'clips'].includes(this.view);
} }
/** /**
* Determine if a view is related to a snapshot or snapshots. * Determine if a view is related to a snapshot or snapshots.
*/ */
public isSnapshotRelatedView(): boolean { public isSnapshotRelatedView(): boolean {
return ['snapshot', 'snapshots', 'snapshot-specific'].includes(this.view); return ['snapshot', 'snapshots'].includes(this.view);
} }
/** /**