diff --git a/apps/datahub/src/app/record/record-metadata/record-metadata.component.html b/apps/datahub/src/app/record/record-metadata/record-metadata.component.html index 0cbd0c38b2..c4e7a0fcb1 100644 --- a/apps/datahub/src/app/record/record-metadata/record-metadata.component.html +++ b/apps/datahub/src/app/record/record-metadata/record-metadata.component.html @@ -33,29 +33,12 @@ [metadataQualityDisplay]="metadataQualityDisplay" > -
- -
- - zoom_out_map - -
-
+
metadata?.overviews?.[0]?.url) + thumbnailUrl$ = this.facade.metadata$.pipe( + map((metadata) => { + return metadata?.overviews?.[0]?.url + }) ) - lightboxInstance: any + + showOverlay = true constructor( public facade: MdViewFacade, @@ -83,9 +85,4 @@ export class RecordMetadataComponent { .getFiltersForOrgs([org]) .subscribe((filters) => this.searchService.updateFilters(filters)) } - - openLightbox(src: string) { - this.lightboxInstance = basicLightbox.create(``) - this.lightboxInstance.show() - } } diff --git a/libs/ui/elements/src/index.ts b/libs/ui/elements/src/index.ts index ed3b7f3ad5..a0ee32142f 100644 --- a/libs/ui/elements/src/index.ts +++ b/libs/ui/elements/src/index.ts @@ -20,3 +20,4 @@ export * from './lib/search-results-error/search-results-error.component' export * from './lib/user-preview/user-preview.component' export * from './lib/record-api-form/record-api-form.component' export * from './lib/markdown-parser/markdown-parser.component' +export * from './lib/image-overlay-preview/image-overlay-preview.component' diff --git a/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.css b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html new file mode 100644 index 0000000000..024d2bdbfa --- /dev/null +++ b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html @@ -0,0 +1,29 @@ + +
+ +
+ + zoom_out_map + +
+
+
diff --git a/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.spec.ts b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.spec.ts new file mode 100644 index 0000000000..2e4c996979 --- /dev/null +++ b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing' + +import { ImageOverlayPreviewComponent } from './image-overlay-preview.component' + +describe('ImageOverlayPreviewComponent', () => { + let component: ImageOverlayPreviewComponent + let fixture: ComponentFixture + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ImageOverlayPreviewComponent], + }) + fixture = TestBed.createComponent(ImageOverlayPreviewComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) + + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.ts b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.ts new file mode 100644 index 0000000000..c7f24db928 --- /dev/null +++ b/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.ts @@ -0,0 +1,15 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core' +import * as basicLightbox from 'basiclightbox' + +@Component({ + selector: 'gn-ui-image-overlay-preview', + templateUrl: './image-overlay-preview.component.html', + styleUrls: ['./image-overlay-preview.component.css'], +}) +export class ImageOverlayPreviewComponent { + @Input() imageUrl: string + @Output() isPlaceholderShown = new EventEmitter() + openLightbox(src: string) { + basicLightbox.create(``).show() + } +} diff --git a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html index 6670ab21ec..804dfe6a5e 100644 --- a/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html +++ b/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html @@ -20,7 +20,7 @@ (click)="onOrganizationClick()" data-cy="organization-name" > - {{ shownOrganization.name }} + {{ shownOrganization?.name }}
diff --git a/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts b/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts index be4e85eaf5..239dc4ca52 100644 --- a/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts +++ b/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts @@ -10,6 +10,8 @@ import { Optional, SimpleChanges, ViewChild, + Output, + EventEmitter, } from '@angular/core' export const THUMBNAIL_PLACEHOLDER = new InjectionToken( @@ -36,6 +38,7 @@ export class ThumbnailComponent implements OnInit, OnChanges { @Input() fit: FitOptions | FitOptions[] = 'cover' @ViewChild('imageElement') imgElement: ElementRef @ViewChild('containerElement') containerElement: ElementRef + @Output() placeholderShown = new EventEmitter() imgUrl: string imgFit: FitOptions placeholderUrl = this.optionalPlaceholderUrl || DEFAULT_PLACEHOLDER @@ -85,6 +88,7 @@ export class ThumbnailComponent implements OnInit, OnChanges { private setNewSrcImage(image: ThumbnailImageObject) { this.imgFit = image.fit this.imgUrl = image.url + this.placeholderShown.emit(this.isPlaceholder) } private setPlaceholder(): void { diff --git a/libs/ui/elements/src/lib/ui-elements.module.ts b/libs/ui/elements/src/lib/ui-elements.module.ts index eac4060e3b..0fd0093efa 100644 --- a/libs/ui/elements/src/lib/ui-elements.module.ts +++ b/libs/ui/elements/src/lib/ui-elements.module.ts @@ -30,6 +30,7 @@ import { PaginationButtonsComponent } from './pagination-buttons/pagination-butt import { MaxLinesComponent } from './max-lines/max-lines.component' import { RecordApiFormComponent } from './record-api-form/record-api-form.component' import { MarkdownParserComponent } from './markdown-parser/markdown-parser.component' +import { ImageOverlayPreviewComponent } from './image-overlay-preview/image-overlay-preview.component' @NgModule({ imports: [ @@ -67,6 +68,7 @@ import { MarkdownParserComponent } from './markdown-parser/markdown-parser.compo MaxLinesComponent, RecordApiFormComponent, MarkdownParserComponent, + ImageOverlayPreviewComponent, ], exports: [ MetadataInfoComponent, @@ -88,6 +90,7 @@ import { MarkdownParserComponent } from './markdown-parser/markdown-parser.compo PaginationButtonsComponent, RecordApiFormComponent, MarkdownParserComponent, + ImageOverlayPreviewComponent, ], }) export class UiElementsModule {}