Skip to content

Commit

Permalink
Merge pull request #2037 from ORCID/leo/set-of-fixes-aug-9
Browse files Browse the repository at this point in the history
leo/set-of-fixes-aug-9
  • Loading branch information
leomendoza123 authored Aug 9, 2023
2 parents dbf0de7 + 21d07dc commit 3d6c841
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,19 @@
<div class="body-wrapper">
<caption class="orc-font-small-print">
<ng-container *ngIf="activity.startDate">
{{ activity.startDate | monthDayYearDateToString }}
{{ activity.startDate }}
<ng-container i18n="@@summary.to" i18n="@@shared.to"
>to</ng-container
>
</ng-container>
<ng-container *ngIf="activity.endDate">
<ng-container i18n="@@summary.to">to</ng-container>
{{ activity.endDate | monthDayYearDateToString }}
{{ activity.endDate }}
</ng-container>
<ng-container
*ngIf="!activity.endDate && activity.startDate"
i18n="@@shared.present"
>
present
</ng-container>
</caption>
<div class="orc-font-small-print">{{ activity.role }}</div>
Expand All @@ -97,9 +105,7 @@
target="_blank"
rel="noopener noreferrer"
>+ {{ count - 3 }}
<ng-container i18n="@@summary.moreAffiliation"
>more Affiliations</ng-container
></a
<ng-container i18n="@@share.more">more</ng-container></a
>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<a
class="orc-font-body-small cursor-pointer header-name"
href="{{ trustedSummary.orcid }}"
target="_blank"
rel="noopener noreferrer"
>
<h1 class="orc-font-body-large">
<ng-container
Expand Down Expand Up @@ -83,6 +85,7 @@ <h2 class="orc-font-small-print" i18n="@@summary.affiliations">
<app-summary-panel
[url]="trustedSummary?.orcid"
[activitySummary]="trustedSummary.employmentAffiliations"
[count]="trustedSummary.employmentAffiliationsCount"
></app-summary-panel>
</ng-container>

Expand All @@ -93,34 +96,41 @@ <h2 class="orc-font-small-print" i18n="@@summary.keyDates">KEY DATES</h2>
<div
class="date-item"
[ngClass]="{
'last-date': !trustedSummary.lastModified
'last-date': !lastUpdateDate
}"
>
<caption
class="orc-font-small-print"
<label
class="orc-font-small-print caption"
i18n="@@summary.recordCreated"
>Record created</label
>
Record created
</caption>
<label class="orc-font-body-small">{{
trustedSummary.creation | date
<label class="orc-font-body-small" *ngIf="!createdToday">{{
creationDateWithOffset | date
}}</label>
<label
class="orc-font-body-small"
*ngIf="createdToday"
i18n="@@shared.today"
>Today</label
>
</div>
</li>
<li>
<div
class="date-item last-date"
*ngIf="trustedSummary.lastModified"
>
<caption
class="orc-font-small-print"
<div class="date-item last-date" *ngIf="lastUpdateDate">
<label
class="orc-font-small-print caption"
i18n="@@summary.lastUpdated"
>Last updated</label
>
Last updated
</caption>
<label class="orc-font-body-small">{{
trustedSummary.lastModified | date
<label class="orc-font-body-small" *ngIf="!modifiedToday">{{
lastUpdateDate | date
}}</label>
<label
class="orc-font-body-small"
*ngIf="modifiedToday"
i18n="@@shared.today"
>Today</label
>
</div>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
display: flex;
flex-direction: row;

caption {
label.caption {
text-align: initial;
display: inline;
line-height: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,6 +22,10 @@ describe('TrustedSummaryComponent', () => {
useValue: { getSummary: () => of() },
},
{ provide: PlatformInfoService, useValue: { get: () => of() } },
{
provide: ZendeskService,
useValue: { hide: () => of() },
},
],
imports: [HttpClientTestingModule],
}).compileComponents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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`

Expand All @@ -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()
Expand All @@ -56,6 +62,7 @@ export class TrustedSummaryComponent implements OnInit, OnDestroy {
}

ngOnInit(): void {
this._zendeskService.hide()
this._robotsMetaTags.disallowRobots()
this._platform
.get()
Expand All @@ -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,
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -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
}
}
2 changes: 2 additions & 0 deletions src/locale/properties/shared/shared.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/locale/properties/summary/summary.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d6c841

Please sign in to comment.