diff --git a/dashboard/sharedComponents/page-content/page-content.component.ts b/dashboard/sharedComponents/page-content/page-content.component.ts index 654f82e6..10b17a94 100644 --- a/dashboard/sharedComponents/page-content/page-content.component.ts +++ b/dashboard/sharedComponents/page-content/page-content.component.ts @@ -132,42 +132,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {end: true, offset: footer_offset}); } - /** - * @deprecated - * - * Should be smooth - * - * */ - private observeBottom() { - let bottom = document.getElementById('bottom'); - if (bottom) { - let bottomObs = new IntersectionObserver(entries => { - entries.forEach(entry => { - this.shouldSticky = !entry.isIntersecting; - }) - }); - this.subscriptions.push(bottomObs); - bottomObs.observe(bottom); - } - } - - /** - * @deprecated - * */ - private observeHeader() { - if (this.header) { - let headerObs = new IntersectionObserver(entries => { - entries.forEach(entry => { - if (entry.boundingClientRect.height > 0) { - this.layoutService.setReplaceHeader(!entry.isIntersecting); - } - }) - }); - this.subscriptions.push(headerObs); - headerObs.observe(this.header.nativeElement); - } - } - private observeStickyFooter() { if (this.sticky_footer) { let resizeObs = new ResizeObserver(entries => { diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index dc515f81..2cf7a798 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -1,4 +1,4 @@ -import {Injectable} from "@angular/core"; +import {AfterViewInit, Injectable} from "@angular/core"; import {BehaviorSubject, Observable, Subscriber} from "rxjs"; import {ActivationStart, Router} from "@angular/router"; import {Icon} from "../../../sharedComponents/menu"; @@ -92,6 +92,7 @@ export class LayoutService { * Display help pop-up on non-admin pages. (default true for the rest of the pages) * */ private hasHelpPopUpSubject: BehaviorSubject = new BehaviorSubject(true); + private isBottomIntersectingSubject: BehaviorSubject = new BehaviorSubject(false); private subscriptions: any[] = []; ngOnDestroy() { @@ -119,6 +120,20 @@ export class LayoutService { this.subscriptions.push(resizeObs); resizeObs.observe(document.documentElement); } + if(typeof document !== "undefined") { + setTimeout(() => { + let bottom = document.getElementById('bottom'); + if (bottom) { + let bottomObs = new IntersectionObserver(entries => { + entries.forEach(entry => { + this.isBottomIntersectingSubject.next(entry.isIntersecting); + }) + }); + this.subscriptions.push(bottomObs); + bottomObs.observe(bottom); + } + }, 500) + } } constructor(private router: Router) { @@ -355,4 +370,8 @@ export class LayoutService { setHasHelpPopUp(value: boolean) { this.hasHelpPopUpSubject.next(value); } + + get isBottomIntersecting(): Observable { + return this.isBottomIntersectingSubject.asObservable(); + } } diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 243bd629..50d88984 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index d62da598..60c954ec 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -148,14 +148,13 @@ export class DataProviderComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - subscriptions = []; private sub: Subscription; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -198,6 +197,11 @@ export class DataProviderComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); if (typeof document !== 'undefined') { this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { @@ -261,16 +265,6 @@ export class DataProviderComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index 353cbf96..c58d75c4 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -3,7 +3,7 @@ [URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId" type="organization"> -
diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 623853f2..d6465383 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -115,8 +115,6 @@ export class OrganizationComponent { public graph_height: number = 0; @ViewChild("graph_and_feedback") graph_and_feedback; - // public shouldSticky: boolean = true; - subscriptions = []; innerReportSubscriptions = []; properties: EnvProperties; @@ -131,6 +129,7 @@ export class OrganizationComponent { public deleteByInferenceOpened: boolean = false; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "actions" = "info"; public viewAllMobile: string = ""; @@ -162,6 +161,11 @@ export class OrganizationComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.properties = properties; if (typeof document !== 'undefined') { @@ -218,16 +222,6 @@ export class OrganizationComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index e6a81ce9..18f51940 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 380e5806..b70e8b42 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -169,14 +169,13 @@ export class ProjectComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - subscriptions = []; private sub: Subscription; properties: EnvProperties; public openaireEntities = OpenaireEntities; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -209,6 +208,11 @@ export class ProjectComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.properties = properties; if (typeof document !== 'undefined') { @@ -278,16 +282,6 @@ export class ProjectComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } @@ -467,7 +461,6 @@ export class ProjectComponent { data => { this.projectInfo = data; this.projectInfo.setBelongsTo(id); - console.log(this.projectInfo); this.projectInfo.id = this.projectId; this.actionsAfterGettingProjectInfo(); diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 45d17250..03ff3145 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 59b3c41e..b20fc52c 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -155,8 +155,6 @@ export class ResultLandingComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -164,6 +162,7 @@ export class ResultLandingComponent { @ViewChild("sdgFosSuggest") sdgFosSuggest: SdgFosSuggestComponent; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; // Full screen modals for small screens (mobile) @ViewChild('summaryFsModal') summaryFsModal: FullScreenModalComponent; @ViewChild('subjectsFsModal') subjectsFsModal: FullScreenModalComponent; @@ -208,6 +207,11 @@ export class ResultLandingComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.isLoggedIn = !!user; @@ -294,16 +298,6 @@ export class ResultLandingComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 8097da49..8cdf216b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -209,7 +209,7 @@ export class ResultLandingInfo { this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1; this.message = !this.belongsTo ? BelongsTo.result.message : null; if (this.message) { - this.message = this.message.replace('((result))', StringUtils.getEntityName(this.resultType)); + this.message = this.message.replace('((result))', StringUtils.capitalizeAll(StringUtils.getEntityName(this.resultType))); this.message = this.message.replace('((type_id))', typeId); this.message = this.message.replace('((id))', id); } diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index 3ccf6e6b..9c5ca69c 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -443,9 +443,13 @@ export class StringUtils { }); return words; } + + public static capitalizeAll(str: string): string { + return str.split(' ').map(value => StringUtils.capitalize(value)).join(' '); + } - public static capitalize(value: string): string { - return value.charAt(0).toUpperCase() + value.slice(1); + public static capitalize(str: string): string { + return str.charAt(0).toUpperCase() + str.slice(1); } /**