From d054922efa13bdcc42d2ab655d9e764b53a01e6c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 3 May 2022 11:52:07 +0300 Subject: [PATCH] [Library | new-theme]: Fixes and updates for project and result landing pages redesign. 1. statisticsTab.component.ts: Added charts inside cards. 2. landing-header.component.ts: Updated margins according to mocks. 3. project.component.html: In #graph_and_feedback, updated offset attribute. | Updated wrapper class from "publication" to "project" | Removed "uk-margin-top" from labels section. 4. project.component.ts: a. Added field public graph_offset: number = 0; b. [Bug fix] Fix expressionchangedafterithasbeencheckederror - Updated when "offset" and "graph_offset" (calcGraphOffset()) is calculated. c. [Bug fix] Updated checks in hasMetrics(). d. [Bug fix] Updated title for organizationsModal to "Partners". 5. project.module.ts: Added in constructor iconsService.registerIcons([link, graph]). 6. projectService.module.ts: Removed IconsService - icons should be registred in project.module. 7. resultLanding.component.html: In #graph_and_feedback, updated offset attribute. 8. resultLanding.component.ts: Added field public graph_offset: number = 0; | [Bug fix] Fix expressionchangedafterithasbeencheckederror - Updated when "offset" and "graph_offset" (calcGraphOffset()) is calculated. --- .../landing-header.component.ts | 10 ++++--- landingPages/project/project.component.html | 14 +++------- landingPages/project/project.component.ts | 27 ++++++++++++------- landingPages/project/project.module.ts | 8 +++++- landingPages/project/projectService.module.ts | 9 +------ .../result/resultLanding.component.html | 3 ++- .../result/resultLanding.component.ts | 21 ++++++++++----- landingPages/result/resultLanding.service.ts | 4 +-- 8 files changed, 53 insertions(+), 43 deletions(-) diff --git a/landingPages/landing-utils/landing-header/landing-header.component.ts b/landingPages/landing-utils/landing-header/landing-header.component.ts index afe7228c..a64ebf59 100644 --- a/landingPages/landing-utils/landing-header/landing-header.component.ts +++ b/landingPages/landing-utils/landing-header/landing-header.component.ts @@ -49,11 +49,13 @@ import {AlertModal} from "../../../utils/modal/alert"; class="uk-text-primary">Under curation - -
- +
+ +
+ +
-
+
` diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index b42bb03a..513da1b5 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -8,7 +8,7 @@
-
+
@@ -104,7 +104,8 @@
-
+
@@ -124,8 +125,7 @@ [status]="projectInfo.status"> -
- +
Open Access mandate for Publications and Research Data @@ -258,12 +258,6 @@ - - - - - -
diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 1b59991b..bb847c48 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -147,8 +147,9 @@ export class ProjectComponent { {label: OpenaireEntities.OTHER, value: "other", disabled: true}]; public offset: number; - @ViewChild("graph_and_feedback") graph_and_feedback; public stickyHeader: boolean = false; + public graph_offset: number = 0; + @ViewChild("graph_and_feedback") graph_and_feedback; subscriptions = []; properties: EnvProperties; @@ -166,8 +167,7 @@ export class ProjectComponent { private _searchResearchResultsService: SearchResearchResultsService, private _reportsService: ReportsService, private htmlService: HtmlProjectReportService, - private indexInfoService: IndexInfoService, - private cdr: ChangeDetectorRef) {} + private indexInfoService: IndexInfoService) {} ngOnInit() { @@ -221,14 +221,21 @@ export class ProjectComponent { this.createClipboard(); })); - this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height')); } - calcGraphOffset() { - if(this.graph_and_feedback && window) { - return window.innerHeight-this.graph_and_feedback.nativeElement.offsetHeight+"px"; + ngAfterViewInit() { + if (typeof document !== 'undefined') { + this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height')); } - return 0; + } + + ngAfterContentChecked() { + if(this.graph_and_feedback && window) { + this.graph_offset = this.calcGraphOffset(); + } + } + calcGraphOffset() { + return window.innerHeight-this.graph_and_feedback.nativeElement.offsetHeight; } public getFileNameType(type: string) { @@ -515,7 +522,7 @@ export class ProjectComponent { } public get hasMetrics(): boolean { - return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0||this.pageViews > 0; + return !(this.totalViews != null && this.totalDownloads != null && this.pageViews != null) || this.totalViews > 0 || this.totalDownloads > 0||this.pageViews > 0; } public viewAllOrganizationsClick() { @@ -530,7 +537,7 @@ export class ProjectComponent { public openOrganizationsModal() { this.organizationsModal.cancelButton = false; this.organizationsModal.okButton = false; - this.organizationsModal.alertTitle = "Organizations"; + this.organizationsModal.alertTitle = "Partners"; this.organizationsModal.open(); } diff --git a/landingPages/project/project.module.ts b/landingPages/project/project.module.ts index d86bdd49..496a07af 100644 --- a/landingPages/project/project.module.ts +++ b/landingPages/project/project.module.ts @@ -30,6 +30,8 @@ import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module"; import {LoadingModule} from "../../utils/loading/loading.module"; import {IconsModule} from "../../utils/icons/icons.module"; import {InputModule} from "../../sharedComponents/input/input.module"; +import {IconsService} from "../../utils/icons/icons.service"; +import {graph, link} from "../../utils/icons/icons"; @NgModule({ imports: [ @@ -51,4 +53,8 @@ import {InputModule} from "../../sharedComponents/input/input.module"; ProjectComponent ] }) -export class ProjectModule { } +export class ProjectModule { + constructor(private iconsService: IconsService) { + this.iconsService.registerIcons([link, graph]) + } +} diff --git a/landingPages/project/projectService.module.ts b/landingPages/project/projectService.module.ts index 49509ba7..a429ebf7 100644 --- a/landingPages/project/projectService.module.ts +++ b/landingPages/project/projectService.module.ts @@ -3,9 +3,6 @@ import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {ProjectService} from './project.service'; -import {IconsService} from "../../utils/icons/icons.service"; -import {graph, link} from "../../utils/icons/icons"; - @NgModule({ imports: [ @@ -17,8 +14,4 @@ import {graph, link} from "../../utils/icons/icons"; ], exports: [] }) -export class ProjectServiceModule { - constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([link, graph]) - } -} +export class ProjectServiceModule {} diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index fea97d7c..6e6b8f8d 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -110,7 +110,8 @@
-
+
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 8726ea9d..6fec3121 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -123,8 +123,9 @@ export class ResultLandingComponent { public filteredRelatedResults: RelationResult[]; public offset: number; - @ViewChild("graph_and_feedback") graph_and_feedback; public stickyHeader: boolean = false; + public graph_offset: number = 0; + @ViewChild("graph_and_feedback") graph_and_feedback; public viewAll: string = ""; public noCommunities: boolean = false; @@ -210,15 +211,21 @@ export class ResultLandingComponent { this.scroll(); })); - - this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height')); } - calcGraphOffset() { - if(this.graph_and_feedback && window) { - return window.innerHeight-this.graph_and_feedback.nativeElement.offsetHeight+"px"; + ngAfterViewInit() { + if (typeof document !== 'undefined') { + this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height')); } - return 0; + } + + ngAfterContentChecked() { + if(this.graph_and_feedback && window) { + this.graph_offset = this.calcGraphOffset(); + } + } + calcGraphOffset() { + return window.innerHeight-this.graph_and_feedback.nativeElement.offsetHeight; } private initMetaAndLinks(type: string) { diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 9082b030..92bfc07e 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -91,8 +91,8 @@ export class ResultLandingService { res[1]['oaf:result']['country'] , // 10 res[1]['oaf:result']['programmingLanguage'], // 11 - software //res[1]['oaf:result']['resulttype'], - (res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['citations'] !== undefined) - ? res[1]['extraInfo']['citations']['citation'] : null, // 12 + (res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['references'] !== undefined) + ? res[1]['extraInfo']['references']['reference'] : null, // 12 res[0], // 13 res[2] // 14 ]))