diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 13907e7..258233c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,8 +6,16 @@ import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity. const routes: Routes = [ // ORCID Pages - {path: 'orcid', loadChildren: () => import('./orcid/orcid.module').then(m => m.LibOrcidModule)}, - {path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)}, + { + path: 'orcid', + loadChildren: () => import('./orcid/orcid.module').then(m => m.LibOrcidModule), + data: {hasQuickContact: false} + }, + { + path: 'my-orcid-links', + loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule), + data: {hasQuickContact: false} + }, /** Other Pages */ { @@ -18,46 +26,60 @@ const routes: Routes = [ {path: 'about/learn-how', loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)}, {path: 'about/faq', loadChildren: () => import('./learn-how/faqs/faqs.module').then(m => m.FaqsModule)}, {path: 'get-started', loadChildren: () => import('./get-started/get-started.module').then(m => m.GetStartedModule)}, - {path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)}, - {path: 'invite', loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule)}, + { + path: 'contact-us', + loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule), + data: {hasQuickContact: false} + }, + { + path: 'invite', + loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule), + data: {hasQuickContact: false} + }, { path: 'content', loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] + }, + { + path: 'sdgs', + loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule), + data: {hasQuickContact: false} }, - {path: 'sdgs', loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule)}, { path: 'fields-of-science', loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule), - data: {extraOffset: 100} + data: {extraOffset: 100, hasQuickContact: false} }, { path: 'organizations', loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'publications', loadChildren: () => import('./htmlPages/publications/publications-page.module').then(m => m.PublicationsPageModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'projects', loadChildren: () => import('./htmlPages/projects/projectsPage.module').then(m => m.ProjectsPageModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'national-bulletins', loadChildren: () => import('./htmlPages/nationalBulletins/nationalBulletinsPage.module').then(m => m.NaionalBulletinPageModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'faqs', loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule), + data: {hasQuickContact: false} }, { path: 'roadmap', loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule), + data: {hasQuickContact: false} }, // { // path: 'featured', @@ -65,24 +87,24 @@ const routes: Routes = [ // { // path: '', // loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule), - // canActivateChild: [IsCommunity], + // data: {hasQuickContact: false}, canActivateChild: [IsCommunity], // }, // { // path: '**', // loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule), - // canActivateChild: [IsCommunity], + // data: {hasQuickContact: false}, canActivateChild: [IsCommunity], // }, // ] // }, { path: 'curators', loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'subjects', loadChildren: () => import('./subjects/subjects.module').then(m => m.SubjectsModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'myCommunities', @@ -90,7 +112,8 @@ const routes: Routes = [ }, { path: 'develop', - loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule), canActivate: [IsCommunity] + loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule), + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, /** Testing Page for help contents */ {path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)}, @@ -98,46 +121,45 @@ const routes: Routes = [ { path: 'search/result', loadChildren: () => import('./landingPages/result/libResult.module').then(m => m.LibResultModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, { path: 'search/publication', loadChildren: () => import('./landingPages/publication/libPublication.module').then(m => m.LibPublicationModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, { path: 'search/dataset', loadChildren: () => import('./landingPages/dataset/libDataset.module').then(m => m.LibDatasetModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, { path: 'search/software', loadChildren: () => import('./landingPages/software/libSoftware.module').then(m => m.LibSoftwareModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] + }, + { + path: 'search/other', loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule), + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, - {path: 'search/other', loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule), canActivate: [IsCommunity]}, { path: 'search/project', loadChildren: () => import('./landingPages/project/libProject.module').then(m => m.LibProjectModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, { path: 'search/dataprovider', loadChildren: () => import('././landingPages/dataProvider/libDataProvider.module').then(m => m.LibDataProviderModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, { path: 'search/organization', loadChildren: () => import('./landingPages/organization/libOrganization.module').then(m => m.LibOrganizationModule), - canActivate: [IsCommunity] - }, - { - path: 'project-report', - loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule) + data: {hasQuickContact: false, hasMenuSearchBar: true}, canActivate: [IsCommunity] }, /** Search Pages */ {path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'}, - + { path: 'search/find/communities', loadChildren: () => import('./searchPages/communities/searchCommunities.module').then(m => m.SearchCommunitiesModule) @@ -145,46 +167,86 @@ const routes: Routes = [ { path: 'search/find/research-outcomes', loadChildren: () => import('./searchPages/simple/searchResearchResults.module').then(m => m.OpenaireSearchResearchResultsModule), + data: {hasQuickContact: false}, canActivate: [IsCommunity] + }, + { + path: 'search/find/publications', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/find/datasets', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/find/software', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/find/other', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, - {path: 'search/find/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/find/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/find/software', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/find/other', component: PageURLResolverComponent, canActivate: [IsCommunity]}, { path: 'search/find/projects', loadChildren: () => import('./searchPages/simple/searchProjects.module').then(m => m.LibSearchProjectsModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'search/find/dataproviders', loadChildren: () => import('./searchPages/simple/searchDataProviders.module').then(m => m.LibSearchDataProvidersModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, /** Advanced Search Pages */ { path: 'search/advanced/research-outcomes', loadChildren: () => import('./searchPages/advanced/searchResearchResults.module').then(m => m.OpenaireAdvancedSearchResearchResultsModule), + data: {hasQuickContact: false}, canActivate: [IsCommunity] + }, + { + path: 'search/advanced/publications', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/advanced/datasets', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/advanced/software', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, + canActivate: [IsCommunity] + }, + { + path: 'search/advanced/other', + component: PageURLResolverComponent, + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, - {path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/advanced/software', component: PageURLResolverComponent, canActivate: [IsCommunity]}, - {path: 'search/advanced/other', component: PageURLResolverComponent, canActivate: [IsCommunity]}, { path: 'search/advanced/organizations', loadChildren: () => import('./searchPages/advanced/advancedSearchOrganizations.module').then(m => m.LibAdvancedSearchOrganizationsModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'search/advanced/dataproviders', loadChildren: () => import('./searchPages/advanced/advancedSearchDataProviders.module').then(m => m.LibAdvancedSearchDataProvidersModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'search/advanced/projects', loadChildren: () => import('./searchPages/advanced/advancedSearchProjects.module').then(m => m.LibAdvancedSearchProjectsModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, /** Deposit Pages */ { path: 'participate/deposit-datasets', @@ -208,41 +270,56 @@ const routes: Routes = [ { path: 'participate/deposit/learn-how', loadChildren: () => import('./deposit/deposit.module').then(m => m.LibDepositModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'participate/deposit/search', loadChildren: () => import('./deposit/searchDataprovidersToDeposit.module').then(m => m.LibSearchDataprovidersToDepositModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'participate/deposit/zenodo', loadChildren: () => import('./deposit/zenodo/shareInZenodo.module').then(m => m.ShareInZenodoModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, /** Linking Pages */ - {path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule), canActivate: [IsCommunity]}, + { + path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule), + data: {hasQuickContact: false}, canActivate: [IsCommunity] + }, { path: 'participate/claim', loadChildren: () => import('./claims/linking/linkingGeneric.module').then(m => m.LibLinkingGenericModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'participate/direct-claim', loadChildren: () => import('./claims/directLinking/directLinking.module').then(m => m.LibDirectLinkingModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { path: 'preview', loadChildren: () => import('./demo/demo.module').then(m => m.DemoModule), - canActivate: [IsCommunity] + data: {hasQuickContact: false}, canActivate: [IsCommunity] }, /** help pages - do not exist in Admin portal/api/db */ - {path: 'reload', loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule)}, - {path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)}, - {path: 'error', component: OpenaireErrorPageComponent}, - {path: 'theme', loadChildren: () => import('./openaireLibrary/utils/theme/theme.module').then(m => m.ThemeModule)}, - {path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent} + { + path: 'reload', + loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule), + data: {hasQuickContact: false} + }, + { + path: 'user-info', + loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule), + data: {hasQuickContact: false} + }, + {path: 'error', component: OpenaireErrorPageComponent, data: {hasQuickContact: false}}, + { + path: 'theme', + loadChildren: () => import('./openaireLibrary/utils/theme/theme.module').then(m => m.ThemeModule), + data: {hasQuickContact: false} + }, + {path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent, data: {hasQuickContact: false}} ]; @NgModule({ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c02f84f..79f679a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,5 @@ import { + ChangeDetectorRef, Component, ElementRef, Inject, @@ -40,6 +41,7 @@ import {NotificationHandler} from "./openaireLibrary/utils/notification-handler" import {OpenaireEntities} from "./openaireLibrary/utils/properties/searchFields"; import {DOCUMENT, isPlatformServer} from "@angular/common"; import {AdvancedAsyncSubject} from "./openaireLibrary/utils/AdvancedAsyncSubject"; +import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; @Component({ selector: 'app-root', @@ -101,12 +103,16 @@ import {AdvancedAsyncSubject} from "./openaireLibrary/utils/AdvancedAsyncSubject points="7 4 13 10 7 16"> + - + @@ -130,9 +136,11 @@ export class AppComponent implements OnInit, OnDestroy { communityId: string = ""; header: Header; logoPath: string = 'assets/common-assets/logo-services/connect/'; + public showGetStarted: boolean = true; /* Contact */ public showQuickContact: boolean; - public showGetStarted: boolean = true; + public bottomNotIntersecting: boolean; + public displayQuickContact: boolean; // intersecting with specific section in home page public contactForm: UntypedFormGroup; public sending = false; public images: string[] = []; @@ -157,12 +165,14 @@ export class AppComponent implements OnInit, OnDestroy { private configurationService: ConfigurationService, private _communityService: CommunityService, private customizationService: CustomizationService, private _meta: Meta, private seoService: SEOService, private quickContactService: QuickContactService, + private layoutService: LayoutService, private fb: UntypedFormBuilder, private emailService: EmailService, @Inject(DOCUMENT) private document, private transferState: TransferState, @Inject(PLATFORM_ID) private platformId: any, - private rendererFactory: RendererFactory2 + private rendererFactory: RendererFactory2, + private cdr: ChangeDetectorRef ) { this.subscriptions.push(router.events.forEach((event) => { if (event instanceof NavigationEnd) { @@ -199,8 +209,17 @@ export class AppComponent implements OnInit, OnDestroy { }, error => { this.init(); })); + 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(); + } })); } @@ -208,6 +227,8 @@ export class AppComponent implements OnInit, OnDestroy { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { subscription.unsubscribe(); + } else if (typeof IntersectionObserver !== "undefined" && subscription instanceof IntersectionObserver) { + subscription.disconnect(); } }); this._communitiesService.clearSubscriptions(); @@ -225,17 +246,16 @@ export class AppComponent implements OnInit, OnDestroy { }; 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); - intersectionObserver.observe(this.bottom.nativeElement); - this.subscriptions.push(intersectionObserver); + if (this.bottom) { + intersectionObserver.observe(this.bottom.nativeElement); + this.subscriptions.push(intersectionObserver); + } } get isManager() { @@ -505,7 +525,8 @@ export class AppComponent implements OnInit, OnDestroy { restrictedData ? "" : "/myCommunities", false, [], [], {})); } this.showMenu = true; - if (typeof document !== "undefined" && this.bottom) { + // if (typeof document !== "undefined" && this.bottom) { + if (typeof document !== "undefined" && properties && this.isClient && this.showMenu) { setTimeout(() => { this.createObservers(); }); diff --git a/src/app/communities/communities.component.ts b/src/app/communities/communities.component.ts index 1a6c780..06238ee 100644 --- a/src/app/communities/communities.component.ts +++ b/src/app/communities/communities.component.ts @@ -39,7 +39,6 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit { public subscriberErrorMessage: string = ""; public errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - public showQuickContact: boolean = true; @ViewChildren('scrolling_element') elements: QueryList; @ViewChild('contact') contact: ElementRef; public entities = OpenaireEntities; @@ -70,6 +69,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.status = this.errorCodes.LOADING; + this.quickContactService.setDisplay(false); } public ngOnInit() { @@ -95,9 +95,10 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit { if (subscription instanceof Subscriber) { subscription.unsubscribe(); } else if (subscription instanceof IntersectionObserver || subscription instanceof MutationObserver) { - subscription.disconnect(); - } + subscription.disconnect(); + } }); + this.quickContactService.setDisplay(true); } ngAfterViewInit() { @@ -126,13 +127,7 @@ export class CommunitiesComponent 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/src/app/openaireLibrary b/src/app/openaireLibrary index e3d26f1..3aee0bc 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit e3d26f138dfe4f501d77439b0c73eb6217eb272b +Subproject commit 3aee0bcca2c39d35ee7a94fd57896059842d5f65