@ -52,7 +52,7 @@ import {LayoutService} from './openaireLibrary/dashboard/sharedComponents/sideba
< / span > < / a >
< / c o o k i e - l a w >
< bottom id = "bottom" # bottom * ngIf = "isClient && properties" [ properties ] = " properties " > < / bottom >
< quick - contact # quickContact * ngIf = " showQuickContact && contactForm" ( sendEmitter ) = " send ( $ event ) "
< quick - contact # quickContact * ngIf = " bottomNotIntersecting && displayQuickContact && showQuickContact && contactForm" ( sendEmitter ) = " send ( $ event ) "
[ contactForm ] = "contactForm" [ sending ] = "sending" [ contact ] = "'Help'" class = "uk-visible@m" > < / q u i c k - c o n t a c t >
< modal - alert # modal [ overflowBody ] = " false " > < / m o d a l - a l e r t >
`
@ -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 ) ;