remove help button when reaching footer by scrolling and when reaching contant section in about page, update submodules

This commit is contained in:
Alex Martzios 2022-11-01 12:12:06 +02:00
parent 17bb6c889b
commit 8dc9ab6aa8
4 changed files with 68 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import {Component, Inject, OnDestroy, OnInit, RendererFactory2, ViewChild, ViewEncapsulation} from '@angular/core'; import {Component, ElementRef, Inject, OnDestroy, OnInit, RendererFactory2, ViewChild, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
@ -88,15 +88,15 @@ import {DOCUMENT} from "@angular/common";
points="7 4 13 10 7 16"></polyline></svg> points="7 4 13 10 7 16"></polyline></svg>
</span></a> </span></a>
</cookie-law> </cookie-law>
<quick-contact #quickContact *ngIf="showQuickContact && contactForm" (sendEmitter)="send($event)" <bottom #bottom *ngIf="properties && isClient && showMenu && !community" [grantAdvance]="false"
[contact]="'Help'" [images]="images" [background]="{class: 'uk-background-primary', dark: false}"
[contactForm]="contactForm" [sending]="sending"></quick-contact>
<bottom *ngIf="properties && isClient && showMenu && !community" [grantAdvance]="false"
[properties]="properties"></bottom> [properties]="properties"></bottom>
<bottom *ngIf="properties && isClient && showMenu && community" class=" communityPanelBackground " <bottom *ngIf="properties && isClient && showMenu && community" class=" communityPanelBackground "
[showSocialButtons]="true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true" [showSocialButtons]="true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true"
[communityId]="community.communityId" [menuItems]=bottomMenuItems [properties]="properties" [communityId]="community.communityId" [menuItems]=bottomMenuItems [properties]="properties"
[darkBackground]="true" [centered]="true"></bottom> [darkBackground]="true" [centered]="true"></bottom>
<quick-contact #quickContact *ngIf="showQuickContact && contactForm" (sendEmitter)="send($event)"
[contact]="'Help'" [images]="images" [background]="{class: 'uk-background-primary', dark: false}"
[contactForm]="contactForm" [sending]="sending"></quick-contact>
<modal-alert #modal [overflowBody]="false"></modal-alert> <modal-alert #modal [overflowBody]="false"></modal-alert>
<role-verification *ngIf="community" service="connect" <role-verification *ngIf="community" service="connect"
[id]="community.communityId" [name]="community.title" [type]="community.type"></role-verification> [id]="community.communityId" [name]="community.title" [type]="community.type"></role-verification>
@ -125,6 +125,7 @@ export class AppComponent implements OnInit, OnDestroy {
public images: string[] = []; public images: string[] = [];
@ViewChild('modal') modal: AlertModal; @ViewChild('modal') modal: AlertModal;
@ViewChild('quickContact') quickContact: QuickContactComponent; @ViewChild('quickContact') quickContact: QuickContactComponent;
@ViewChild('bottom', {read: ElementRef}) bottom: ElementRef;
private subscriptions = []; private subscriptions = [];
layout: Layout = null; layout: Layout = null;
layouts: Layout[] = null; layouts: Layout[] = null;
@ -195,6 +196,27 @@ export class AppComponent implements OnInit, OnDestroy {
this.smoothScroll.clearSubscriptions(); this.smoothScroll.clearSubscriptions();
} }
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);
}
get isManager() { get isManager() {
return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user)) return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user))
} }
@ -452,6 +474,9 @@ export class AppComponent implements OnInit, OnDestroy {
restrictedData ? "" : "/myCommunities", false, [], [], {})); restrictedData ? "" : "/myCommunities", false, [], [], {}));
} }
this.showMenu = true; this.showMenu = true;
setTimeout(() => {
this.createObservers();
});
} }
/** /**

View File

@ -1,4 +1,4 @@
import {Component, OnInit} from '@angular/core'; import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser'; import {Meta, Title} from '@angular/platform-browser';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -8,6 +8,7 @@ import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {QuickContactService} from '../openaireLibrary/sharedComponents/quick-contact/quick-contact.service';
@Component({ @Component({
selector: 'learn-how', selector: 'learn-how',
@ -208,7 +209,7 @@ import {properties} from "../../environments/environment";
</div> </div>
</div> </div>
</div> </div>
<div class="uk-section uk-container uk-container-large uk-text-center uk-flex uk-flex-column uk-flex-middle"> <div #contact class="uk-section uk-container uk-container-large uk-text-center uk-flex uk-flex-column uk-flex-middle">
<h2 class="uk-h2 uk-margin-medium-top uk-width-3-5@m">We look forward to working together and helping you unlock the full potential of your research community through open science<span class="uk-text-primary">.</span></h2> <h2 class="uk-h2 uk-margin-medium-top uk-width-3-5@m">We look forward to working together and helping you unlock the full potential of your research community through open science<span class="uk-text-primary">.</span></h2>
<a class="uk-button uk-button-primary uk-text-uppercase uk-margin-medium-top uk-margin-medium-bottom" routerLink="/contact-us">Contact us</a> <a class="uk-button uk-button-primary uk-text-uppercase uk-margin-medium-top uk-margin-medium-bottom" routerLink="/contact-us">Contact us</a>
</div> </div>
@ -232,6 +233,8 @@ export class LearnHowComponent implements OnInit {
public pageDescription: string = "Learn the process: Build a Gateway to your community's open and linked research outcomes. Customized to your needs."; public pageDescription: string = "Learn the process: Build a Gateway to your community's open and linked research outcomes. Customized to your needs.";
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About'}];
properties: EnvProperties = properties; properties: EnvProperties = properties;
public showQuickContact: boolean;
@ViewChild('contact') contact: ElementRef;
subscriptions = []; subscriptions = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
@ -240,7 +243,8 @@ export class LearnHowComponent implements OnInit {
private _title: Title, private _title: Title,
private seoService: SEOService, private seoService: SEOService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private helper: HelperService) { private helper: HelperService,
private quickContactService: QuickContactService) {
} }
public ngOnInit() { public ngOnInit() {
@ -276,6 +280,33 @@ export class LearnHowComponent implements OnInit {
}); });
} }
ngAfterViewInit() {
if (typeof window !== "undefined") {
this.createObservers();
}
}
createObservers() {
let options = {
root: null,
rootMargin: '200px',
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.contact.nativeElement);
this.subscriptions.push(intersectionObserver);
}
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");

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

@ -1 +1 @@
Subproject commit 3b874be6dfb7041f358c2ba86d3e1ec4e58f388b Subproject commit 35ab282e53ad5b7790bc431820a4400cfc36c977