remove help button when reaching footer by scroll, update submodule

This commit is contained in:
Alex Martzios 2022-11-01 12:20:03 +02:00
parent 62c5c26dc2
commit 4c628921ae
2 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, ElementRef, ViewChild} from '@angular/core';
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
@ -60,11 +60,11 @@ import {ResourcesService} from "./openaireLibrary/monitor/services/resources.ser
points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom #bottom *ngIf="properties && showMenu" id="bottom" [grantAdvance]="false"
[properties]="properties"></bottom>
<quick-contact #quickContact *ngIf="showQuickContact && contactForm" (sendEmitter)="send($event)"
[contactForm]="contactForm" [sending]="sending" [images]="images" [contact]="'Help'"
[organizationTypes]="organizationTypes"></quick-contact>
<bottom *ngIf="properties && showMenu" id="bottom" [grantAdvance]="false"
[properties]="properties"></bottom>
<modal-alert #modal [overflowBody]="false"></modal-alert>
</div>
`
@ -92,6 +92,7 @@ export class AppComponent {
public sending = false;
@ViewChild('modal') modal: AlertModal;
@ViewChild('quickContact') quickContact: QuickContactComponent;
@ViewChild('bottom', {read: ElementRef}) bottom: ElementRef;
private subscriptions: any[] = [];
public stakeholderEntities = StakeholderEntities;
@ -137,6 +138,27 @@ export class AppComponent {
this.showQuickContact = display;
}));
}
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);
}
public ngOnDestroy() {
this.subscriptions.forEach(value => {
@ -168,6 +190,9 @@ export class AppComponent {
new MenuItem("", "Contact us", "https://beta.openaire.eu/contact-us", "", false, [], [], {})
];
this.showMenu = true;
setTimeout(() => {
this.createObservers();
})
}
public setUserMenu() {

@ -1 +1 @@
Subproject commit bcaf7166a5023c1538058473b8606519cedf8b7a
Subproject commit 4216be29cd8eb993831cc96e5540b8631333856c