From 577a3ea480dd71fef306cd196b777ccb1d3092e4 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 11 Sep 2023 23:55:52 +0200 Subject: [PATCH] Small bugfixes --- src/frontend/app/ui/gallery/blog/blog.service.ts | 8 ++++++-- .../controls/controls.lightbox.gallery.component.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frontend/app/ui/gallery/blog/blog.service.ts b/src/frontend/app/ui/gallery/blog/blog.service.ts index c1695b7f..9231712e 100644 --- a/src/frontend/app/ui/gallery/blog/blog.service.ts +++ b/src/frontend/app/ui/gallery/blog/blog.service.ts @@ -24,8 +24,12 @@ export class BlogService { const dates = content.mediaGroups.map(g => g.date) .filter(d => !!d).map(d => d.getTime()); - const firstMedia = content.mediaGroups[0].media.reduce((p, m) => - Math.min(m.metadata.creationDate, p), Number.MAX_SAFE_INTEGER); + + let firstMedia = Number.MAX_SAFE_INTEGER; + if (content.mediaGroups.length > 0) { + firstMedia = content.mediaGroups[0].media.reduce((p, m) => + Math.min(m.metadata.creationDate, p), Number.MAX_SAFE_INTEGER); + } const files = this.mdFilesFilterPipe.transform(content.metaFile) .map(f => this.splitMarkDown(f, dates, firstMedia)); diff --git a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts index d1de0074..34792f6a 100644 --- a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts @@ -177,11 +177,11 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges { this.prevZoom = this.zoom; } - tap($event: { tapCount: number }): void { + tap($event: Event): void { if (!this.activePhoto || this.activePhoto.gridMedia.isVideo()) { return; } - if ($event.tapCount < 2) { + if (($event as unknown as { tapCount: number }).tapCount < 2) { return; }