remove help button when reaching footer by scroll, update submodules

angular-14
Alex Martzios 2 years ago
parent b3ac3b3391
commit a358686a3d

@ -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"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom id="bottom" #bottom *ngIf="isClient && properties" [properties]="properties"></bottom>
<quick-contact #quickContact *ngIf="showQuickContact && contactForm" (sendEmitter)="send($event)"
[contactForm]="contactForm" [sending]="sending" [contact]="'Help'"></quick-contact>
<bottom id="bottom" *ngIf="isClient && properties" [properties]="properties"></bottom>
<modal-alert #modal [overflowBody]="false"></modal-alert>
`
})
@ -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 = [];

@ -1 +1 @@
Subproject commit f53ca8fde82ab31581b2248550e71272d589c905
Subproject commit c862be75613fa1cf08a3bf276b9f4e1b56a3321c

@ -1 +1 @@
Subproject commit 3b874be6dfb7041f358c2ba86d3e1ec4e58f388b
Subproject commit 35ab282e53ad5b7790bc431820a4400cfc36c977
Loading…
Cancel
Save