From aa4d56e2cf1b3158e56c3a1644f4722e70e838bc Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Sun, 19 Mar 2023 11:42:09 +0100 Subject: [PATCH 1/3] Made it possible to only enable video media viewer Also: - Filtered out non-supported media file types from the mediaViewers mediaList - Fixed thumbnails not displaying with 0 ORIGINAL bitstreams --- .../media-viewer-image.component.ts | 17 ++--- .../media-viewer-video.component.html | 13 ++-- .../media-viewer-video.component.spec.ts | 2 - .../media-viewer-video.component.ts | 20 ++---- .../media-viewer/media-viewer.component.html | 36 ++++------ .../media-viewer.component.spec.ts | 12 +++- .../media-viewer/media-viewer.component.ts | 67 ++++++++++++------- .../publication/publication.component.html | 6 +- .../untyped-item/untyped-item.component.html | 6 +- 9 files changed, 89 insertions(+), 90 deletions(-) diff --git a/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts b/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts index 0c32b5603de..28c5b4efd6c 100644 --- a/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts +++ b/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { NgxGalleryImage, NgxGalleryOptions } from '@kolkov/ngx-gallery'; import { MediaViewerItem } from '../../../core/shared/media-viewer-item.model'; import { NgxGalleryAnimation } from '@kolkov/ngx-gallery'; @@ -13,7 +13,7 @@ import { AuthService } from '../../../core/auth/auth.service'; templateUrl: './media-viewer-image.component.html', styleUrls: ['./media-viewer-image.component.scss'], }) -export class MediaViewerImageComponent implements OnInit { +export class MediaViewerImageComponent implements OnChanges, OnInit { @Input() images: MediaViewerItem[]; @Input() preview?: boolean; @Input() image?: string; @@ -30,11 +30,9 @@ export class MediaViewerImageComponent implements OnInit { constructor(private authService: AuthService) {} - /** - * Thi method sets up the gallery settings and data - */ - ngOnInit(): void { - this.isAuthenticated$ = this.authService.isAuthenticated(); + ngOnChanges(changes: SimpleChanges): void { + this.image = changes.image.currentValue; + this.preview = changes.preview.currentValue; this.galleryOptions = [ { preview: this.preview !== undefined ? this.preview : true, @@ -50,7 +48,6 @@ export class MediaViewerImageComponent implements OnInit { previewFullscreen: true, }, ]; - if (this.image) { this.galleryImages = [ { @@ -64,6 +61,10 @@ export class MediaViewerImageComponent implements OnInit { } } + ngOnInit(): void { + this.isAuthenticated$ = this.authService.isAuthenticated(); + } + /** * This method convert an array of MediaViewerItem into NgxGalleryImage array * @param medias input NgxGalleryImage array diff --git a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.html b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.html index a4493e36fc0..aaec542f828 100644 --- a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.html +++ b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.html @@ -1,15 +1,14 @@ -
+
- + - - + + diff --git a/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html b/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html index 04794717f1f..7eb896f8aee 100644 --- a/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html +++ b/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html @@ -20,13 +20,13 @@

- + - - + + From 43dd508b10e4ca8dd5238080e60ad7900c0f6bae Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Sun, 26 Mar 2023 01:04:02 +0100 Subject: [PATCH 2/3] Fix placeholder not being shown for items with not THUMBNAIL bitstreams --- .../media-viewer-image.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts b/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts index 28c5b4efd6c..59a9513d4f0 100644 --- a/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts +++ b/src/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { NgxGalleryImage, NgxGalleryOptions } from '@kolkov/ngx-gallery'; import { MediaViewerItem } from '../../../core/shared/media-viewer-item.model'; import { NgxGalleryAnimation } from '@kolkov/ngx-gallery'; @@ -20,8 +20,9 @@ export class MediaViewerImageComponent implements OnChanges, OnInit { loggedin: boolean; - galleryOptions: NgxGalleryOptions[]; - galleryImages: NgxGalleryImage[]; + galleryOptions: NgxGalleryOptions[] = []; + + galleryImages: NgxGalleryImage[] = []; /** * Whether or not the current user is authenticated @@ -30,9 +31,7 @@ export class MediaViewerImageComponent implements OnChanges, OnInit { constructor(private authService: AuthService) {} - ngOnChanges(changes: SimpleChanges): void { - this.image = changes.image.currentValue; - this.preview = changes.preview.currentValue; + ngOnChanges(): void { this.galleryOptions = [ { preview: this.preview !== undefined ? this.preview : true, @@ -63,6 +62,7 @@ export class MediaViewerImageComponent implements OnChanges, OnInit { ngOnInit(): void { this.isAuthenticated$ = this.authService.isAuthenticated(); + this.ngOnChanges(); } /** From 44699186406c10aebfa40b49772a0d62a204abaa Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Tue, 4 Apr 2023 22:05:09 +0200 Subject: [PATCH 3/3] Show ThumbnailComponent as fallback instead of a MediaViewerImageComponent placeholder when only one of the mediaviewers options is enabled --- src/app/item-page/media-viewer/media-viewer.component.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/item-page/media-viewer/media-viewer.component.html b/src/app/item-page/media-viewer/media-viewer.component.html index 3d2a863f61b..b9b7ba1932e 100644 --- a/src/app/item-page/media-viewer/media-viewer.component.html +++ b/src/app/item-page/media-viewer/media-viewer.component.html @@ -16,9 +16,12 @@
- + +