diff --git a/explore/src/app/app.component.ts b/explore/src/app/app.component.ts index 5292ea5c..c92c2699 100644 --- a/explore/src/app/app.component.ts +++ b/explore/src/app/app.component.ts @@ -52,7 +52,7 @@ import {LayoutService} from './openaireLibrary/dashboard/sharedComponents/sideba - ` @@ -65,7 +65,10 @@ export class AppComponent { properties: EnvProperties = properties; user: User; header: Header; - public showQuickContact: boolean; + /* Contact */ + public showQuickContact: boolean; + public bottomNotIntersecting: boolean; + public displayQuickContact: boolean; // intersecting with specific section in home page public contactForm: FormGroup; public sending: boolean = false; @ViewChild('quickContact') quickContact: QuickContactComponent; @@ -85,10 +88,6 @@ export class AppComponent { if (typeof document !== 'undefined') { this.isClient = true; } - this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => { - this.showQuickContact = hasQuickContact; - this.cdr.detectChanges(); - })); this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); this.feedbackmail = this.properties.feedbackmail; if (this.properties.environment == "production" || this.properties.environment == "development") { @@ -111,9 +110,18 @@ export class AppComponent { badge: true }; this.reset(); + })); + this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => { + if(this.showQuickContact !== hasQuickContact) { + this.showQuickContact = hasQuickContact; + this.cdr.detectChanges(); + } })); this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => { - this.showQuickContact = display; + if(this.displayQuickContact !== display) { + this.displayQuickContact = display; + this.cdr.detectChanges(); + } })); } @@ -121,6 +129,8 @@ export class AppComponent { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { subscription.unsubscribe(); + } else if (typeof IntersectionObserver !== "undefined" && subscription instanceof IntersectionObserver) { + subscription.disconnect(); } }); this.configurationService.clearSubscriptions(); @@ -142,12 +152,9 @@ export class AppComponent { }; 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); + if(this.bottomNotIntersecting !== (!entry.isIntersecting)) { + this.bottomNotIntersecting = !entry.isIntersecting; + this.cdr.detectChanges(); } }); }, options); diff --git a/explore/src/app/home/home.component.ts b/explore/src/app/home/home.component.ts index c05576ed..c4a40ced 100644 --- a/explore/src/app/home/home.component.ts +++ b/explore/src/app/home/home.component.ts @@ -121,7 +121,6 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { public properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public readMore: boolean = false; - public showQuickContact: boolean; @ViewChild('contact') contact: ElementRef; subscriptions: any[] = []; @ViewChildren('scrolling_element') elements: QueryList; @@ -173,6 +172,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: title}, "property='og:title'"); + this.quickContactService.setDisplay(false); } private getPageContents() { @@ -281,6 +281,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { public ngOnDestroy() { + this.quickContactService.setDisplay(true); this.clear(); } @@ -298,13 +299,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { }; 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); - } + this.quickContactService.setDisplay(!entry.isIntersecting); }); }, options); intersectionObserver.observe(this.contact.nativeElement); diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index ea1b054b..8b14aaf3 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit ea1b054b63502fe0cd9dcc7a5559b456ea2a1fc7 +Subproject commit 8b14aaf325c4c18691be36a89dca882b945d8eb0