From 1d9590e3b9a1e88ce4714a8409b7e2c809789d15 Mon Sep 17 00:00:00 2001 From: Leonardo Mendoza Date: Wed, 9 Aug 2023 14:24:49 -0600 Subject: [PATCH] leo/set-of-fixes-aug-9 --- .../summary-panel.component.html | 18 ++++--- .../trusted-summary.component.html | 44 +++++++++------- .../trusted-summary.component.scss | 2 +- .../trusted-summary.component.spec.ts | 5 ++ .../trusted-summary.component.ts | 50 ++++++++++++++++--- .../properties/shared/shared.en.properties | 2 + .../properties/summary/summary.en.properties | 4 +- 7 files changed, 92 insertions(+), 33 deletions(-) diff --git a/src/app/trusted-summary/component/summary-panel/summary-panel.component.html b/src/app/trusted-summary/component/summary-panel/summary-panel.component.html index 568bd5402e..7b85790e68 100644 --- a/src/app/trusted-summary/component/summary-panel/summary-panel.component.html +++ b/src/app/trusted-summary/component/summary-panel/summary-panel.component.html @@ -78,11 +78,19 @@
- {{ activity.startDate | monthDayYearDateToString }} + {{ activity.startDate }} + to - to - {{ activity.endDate | monthDayYearDateToString }} + {{ activity.endDate }} + + + present
{{ activity.role }}
@@ -97,9 +105,7 @@ target="_blank" rel="noopener noreferrer" >+ {{ count - 3 }} - more Affiliationsmore
diff --git a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.html b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.html index b1f90f108d..18675e8b3b 100644 --- a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.html +++ b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.html @@ -12,6 +12,8 @@

@@ -93,34 +96,41 @@

KEY DATES

- Record created - Record created - -
  • -
    - + - Last updated - -
  • diff --git a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.scss b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.scss index 43ff490513..f3f2afdcd7 100644 --- a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.scss +++ b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.scss @@ -20,7 +20,7 @@ display: flex; flex-direction: row; - caption { + label.caption { text-align: initial; display: inline; line-height: 1; diff --git a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.spec.ts b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.spec.ts index f2ac458fcc..ec4daff961 100644 --- a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.spec.ts +++ b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.spec.ts @@ -6,6 +6,7 @@ import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.se import { HttpClientTestingModule } from '@angular/common/http/testing' import { PlatformInfoService } from 'src/app/cdk/platform-info' import { of } from 'rxjs' +import { ZendeskService } from 'src/app/core/zendesk/zendesk.service' describe('TrustedSummaryComponent', () => { let component: TrustedSummaryComponent @@ -21,6 +22,10 @@ describe('TrustedSummaryComponent', () => { useValue: { getSummary: () => of() }, }, { provide: PlatformInfoService, useValue: { get: () => of() } }, + { + provide: ZendeskService, + useValue: { hide: () => of() }, + }, ], imports: [HttpClientTestingModule], }).compileComponents() diff --git a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.ts b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.ts index aa171ba5db..a951ef3fbc 100644 --- a/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.ts +++ b/src/app/trusted-summary/pages/trusted-summary/trusted-summary.component.ts @@ -7,6 +7,7 @@ import { PlatformInfoService } from 'src/app/cdk/platform-info' import { takeUntil } from 'rxjs/operators' import { Subject } from 'rxjs' import { RobotsMetaTagsService } from 'src/app/core/robots-meta-tags/robots-meta-tags.service' +import { ZendeskService } from 'src/app/core/zendesk/zendesk.service' @Component({ selector: 'app-trusted-summary', @@ -30,8 +31,8 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { labelValidatedFundings = $localize`:@@summary.validatedFundings:Validated fundings` labelSelfAssertedFunding = $localize`:@@summary.selfAssertedFunding:Self-asserted funding` labelSelfAssertedFundings = $localize`:@@summary.selfAssertedFundings:Self-asserted fundings` - labelReviesFor = $localize`:@@summary.reviewsFor:Reviews for` - labelReviewFor = $localize`:@@summary.reviewFor:Review for` + labelReviesFor = $localize`:@@summary.reviewsFor:reviews for` + labelReviewFor = $localize`:@@summary.reviewFor:review for` labelpublicationgrants = $localize`:@@summary.publicationgrantes:publication/grants` labelpublicationgrant = $localize`:@@summary.publicationgrant:publication/grant` @@ -42,12 +43,17 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { twoColumns: boolean = false threeColumns: boolean = false oneColumn: boolean + createdToday = false + modifiedToday: boolean + creationDateWithOffset: any + lastUpdateDate: any constructor( private _trustedSummary: TrustedSummaryService, private _router: Router, private _platform: PlatformInfoService, - private _robotsMetaTags: RobotsMetaTagsService + private _robotsMetaTags: RobotsMetaTagsService, + private _zendeskService: ZendeskService ) {} ngOnDestroy(): void { this.unsubscribe.next() @@ -56,6 +62,7 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { } ngOnInit(): void { + this._zendeskService.hide() this._robotsMetaTags.disallowRobots() this._platform .get() @@ -69,8 +76,31 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { }) this.currentLocation = window.location.origin this.orcid = this._router.url.split('/')[1] + this._trustedSummary.getSummary(this.orcid).subscribe((data) => { this.trustedSummary = data + if (this.trustedSummary.creation) { + this.creationDateWithOffset = this.dateWithOffset( + this.trustedSummary.creation + ) + // if record was created today + if ( + this.creationDateWithOffset.toDateString() === + new Date().toDateString() + ) { + this.createdToday = true + } + } + if (this.trustedSummary.lastModified) { + this.lastUpdateDate = this.dateWithOffset( + this.trustedSummary.lastModified + ) + // if record was modified today + if (this.lastUpdateDate.toDateString() === new Date().toDateString()) { + this.modifiedToday = true + } + } + if (this.trustedSummary.selfAssertedWorks) { this.works.push({ verified: false, @@ -117,14 +147,14 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { ) { this.peerReviews.push({ verified: true, - countA: this.trustedSummary.peerReviewPublicationGrants, + countA: this.trustedSummary.peerReviewsTotal, stringA: - this.trustedSummary.peerReviewPublicationGrants > 1 + this.trustedSummary.peerReviewsTotal > 1 ? this.labelReviesFor : this.labelReviewFor, - countB: this.trustedSummary.peerReviewsTotal, + countB: this.trustedSummary.peerReviewPublicationGrants, stringB: - this.trustedSummary.peerReviewsTotal > 1 + this.trustedSummary.peerReviewPublicationGrants > 1 ? this.labelpublicationgrants : this.labelpublicationgrant, }) @@ -161,4 +191,10 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy { } }) } + dateWithOffset(creation: string): any { + const date = new Date(creation) + const offset = date.getTimezoneOffset() + const offsettedDate = new Date(date.getTime() + offset * 60 * 1000) + return offsettedDate + } } diff --git a/src/locale/properties/shared/shared.en.properties b/src/locale/properties/shared/shared.en.properties index 98644c528f..ea719c3f93 100644 --- a/src/locale/properties/shared/shared.en.properties +++ b/src/locale/properties/shared/shared.en.properties @@ -624,3 +624,5 @@ shared.worksSortType=Sort works by type shared.peerReviewsSortOrder=Sort peer reviews by order shared.researchSortTitle=Sort research resources by title shared.researchSortDate=Sort research resources by date +shared.today=Today +share.more=more \ No newline at end of file diff --git a/src/locale/properties/summary/summary.en.properties b/src/locale/properties/summary/summary.en.properties index 3cccdb203a..2753b101e6 100644 --- a/src/locale/properties/summary/summary.en.properties +++ b/src/locale/properties/summary/summary.en.properties @@ -19,8 +19,8 @@ summary.validatedFunding=Validated funding summary.validatedFundings=Validated fundings summary.selfAssertedFunding=Self-asserted funding summary.selfAssertedFundings=Self-asserted fundings -summary.reviewsFor=Reviews for -summary.reviewFor=Review for +summary.reviewsFor=reviews for +summary.reviewFor=review for summary.publicationgrantes=publication/grants summary.publicationgrant=publication/grant summary.nameIsPrivateOrLimited=Name is private or limited \ No newline at end of file