diff --git a/explore/src/app/app.component.ts b/explore/src/app/app.component.ts index 8c2e7a3e..f46da4f7 100644 --- a/explore/src/app/app.component.ts +++ b/explore/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {ChangeDetectorRef, Component, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, ElementRef, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {MenuItem} from './openaireLibrary/sharedComponents/menu'; @@ -51,9 +51,9 @@ import {LayoutService} from './openaireLibrary/dashboard/sharedComponents/sideba ratio="1"> + - ` }) @@ -70,6 +70,7 @@ export class AppComponent { public sending: boolean = false; @ViewChild('quickContact') quickContact: QuickContactComponent; @ViewChild('modal') modal: AlertModal; + @ViewChild('bottom', {read: ElementRef}) bottom: ElementRef; subscriptions = []; @@ -126,6 +127,33 @@ export class AppComponent { this.userManagementService.clearSubscriptions(); this.smoothScroll.clearSubscriptions(); } + + ngAfterViewInit() { + if (typeof window !== "undefined") { + this.createObservers(); + } + } + + createObservers() { + let options = { + root: null, + rootMargin: '300px', + threshold: 1.0 + }; + let intersectionObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting && this.showQuickContact) { + this.showQuickContact = false; + this.quickContactService.setDisplay(this.showQuickContact); + } else if (!entry.isIntersecting && !this.showQuickContact) { + this.showQuickContact = true; + this.quickContactService.setDisplay(this.showQuickContact); + } + }); + }, options); + intersectionObserver.observe(this.bottom.nativeElement); + this.subscriptions.push(intersectionObserver); + } buildMenu() { this.userMenuItems = []; diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index f53ca8fd..c862be75 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit f53ca8fde82ab31581b2248550e71272d589c905 +Subproject commit c862be75613fa1cf08a3bf276b9f4e1b56a3321c diff --git a/explore/src/assets/openaire-theme b/explore/src/assets/openaire-theme index 3b874be6..35ab282e 160000 --- a/explore/src/assets/openaire-theme +++ b/explore/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 3b874be6dfb7041f358c2ba86d3e1ec4e58f388b +Subproject commit 35ab282e53ad5b7790bc431820a4400cfc36c977