Skip to content

Commit

Permalink
🤖 GITHUB ACTIONS format_prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
orcid-releaser committed Feb 8, 2024
1 parent 12f91a9 commit 7677330
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 159 deletions.
5 changes: 3 additions & 2 deletions src/app/cdk/side-bar/side-bar/side-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
>
<h2
class="orc-font-body-large"
[ngClass]="{'sr-only': isPublicRecord ? !newRecordHeaderTogglz : true }"
i18n="@@shared.personalInformation">
[ngClass]="{ 'sr-only': isPublicRecord ? !newRecordHeaderTogglz : true }"
i18n="@@shared.personalInformation"
>
Personal information
</h2>
<ng-container *ngIf="!newRecordHeaderTogglz">
Expand Down
132 changes: 95 additions & 37 deletions src/app/record/components/record-header/record-header.component.html
Original file line number Diff line number Diff line change
@@ -1,75 +1,133 @@
<mat-progress-bar *ngIf="loadingUserRecord" mode="indeterminate" color="accent"></mat-progress-bar>
<div class="row record-header" [ngClass]="{ 'mobile': !platform.columns12 }">
<mat-progress-bar
*ngIf="loadingUserRecord"
mode="indeterminate"
color="accent"
></mat-progress-bar>
<div class="row record-header" [ngClass]="{ mobile: !platform.columns12 }">
<section [id]="'names'" role="region" [attr.aria-label]="regionNames">
<div class="names-wrapper" *ngIf="userRecord?.names || userRecord?.otherNames">
<div
class="names-wrapper"
*ngIf="userRecord?.names || userRecord?.otherNames"
>
<div class="row names">
<h1 [ngClass]="{
<h1
[ngClass]="{
'orc-font-heading-small': !platform.columns12,
'orc-font-heading': platform.columns12
}">
}"
>
<ng-container *ngIf="creditName">{{ creditName }}</ng-container>
<ng-container *ngIf="!!!creditName && (givenNames || familyName)">
<ng-container *ngIf="givenNames">{{ givenNames + ' ' }}</ng-container>
<ng-container *ngIf="givenNames">{{
givenNames + ' '
}}</ng-container>
{{ familyName }}
</ng-container>
</h1>
</div>
<div class="row other-names" [ngClass]="{ 'mobile': !platform.columns12 }">
<div class="row other-names" [ngClass]="{ mobile: !platform.columns12 }">
<p class="orc-font-body" *ngIf="otherNames">{{ otherNames }}</p>
</div>
</div>
<div class="issue" *ngIf="userInfo?.RECORD_WITH_ISSUES">
<h1 [ngClass]="{
'orc-font-heading-small': !platform.columns12,
'orc-font-heading': platform.columns12
}">
<ng-container *ngIf="userInfo.IS_DEACTIVATED === 'true' && !userInfo.PRIMARY_RECORD"
i18n="@@summary.recordIsDeactivated">This record has been deactivated
<h1
[ngClass]="{
'orc-font-heading-small': !platform.columns12,
'orc-font-heading': platform.columns12
}"
>
<ng-container
*ngIf="userInfo.IS_DEACTIVATED === 'true' && !userInfo.PRIMARY_RECORD"
i18n="@@summary.recordIsDeactivated"
>This record has been deactivated
</ng-container>
<ng-container
*ngIf="userInfo.IS_LOCKED === 'true' && !(userInfo.IS_DEACTIVATED === 'true' && !userInfo.PRIMARY_RECORD)"
i18n="@@summary.recordIsLocked">This record is locked
*ngIf="
userInfo.IS_LOCKED === 'true' &&
!(userInfo.IS_DEACTIVATED === 'true' && !userInfo.PRIMARY_RECORD)
"
i18n="@@summary.recordIsLocked"
>This record is locked
</ng-container>
<ng-container *ngIf="userInfo.PRIMARY_RECORD" i18n="@@summary.recordIsDeprecated">This record has been
deprecated</ng-container>
<ng-container
*ngIf="userInfo.PRIMARY_RECORD"
i18n="@@summary.recordIsDeprecated"
>This record has been deprecated</ng-container
>
</h1>
</div>
<div class="no-public-information"
*ngIf="!recordWithIssues && affiliations === 0 && !(!!!creditName && (givenNames || familyName))">
<h1 [ngClass]="{
'orc-font-heading-small': !platform.columns12,
'orc-font-heading': platform.columns12
}">
<ng-container i18n="@@record.noPublicInfo">No public information available.
<div
class="no-public-information"
*ngIf="
!recordWithIssues &&
affiliations === 0 &&
!(!!!creditName && (givenNames || familyName))
"
>
<h1
[ngClass]="{
'orc-font-heading-small': !platform.columns12,
'orc-font-heading': platform.columns12
}"
>
<ng-container i18n="@@record.noPublicInfo"
>No public information available.
</ng-container>
</h1>
</div>
</section>
<mat-divider class="divider"></mat-divider>
<section [id]="'orcid-id'" role="region" [attr.aria-label]="regionOrcidId">
<div class="row id-wrapper">
<div class="col" [ngClass]="{
<div
class="col"
[ngClass]="{
'orc-font-body-small': !platform.columns12,
'orc-font-body': platform.columns12
}" dir="ltr">
}"
dir="ltr"
>
<div>
<img class="orcid-logo" [ngClass]="{ mobile: !platform.columns12 }" src="assets/vectors/orcid.logo.icon.svg"
alt="orcid logo" />
<img
class="orcid-logo"
[ngClass]="{ mobile: !platform.columns12 }"
src="assets/vectors/orcid.logo.icon.svg"
alt="orcid logo"
/>
</div>
<h2 [ngClass]="{
<h2
[ngClass]="{
'orc-font-body': !platform.columns12,
'orc-font-body-large': platform.columns12
}">{{ orcidId }}</h2>
<div class="buttons-wrapper" [ngClass]="{
}"
>
{{ orcidId }}
</h2>
<div
class="buttons-wrapper"
[ngClass]="{
row: !platform.columns12,
mobile: !platform.columns12
}">
<button mat-icon-button class="orc-font-small-print" [matTooltip]="tooltipCopy"
[attr.aria-label]="ariaLabelCopyOrcidId" (click)="clipboard()">
<mat-icon class="material-icons" class="icon">content_copy</mat-icon>
}"
>
<button
mat-icon-button
class="orc-font-small-print"
[matTooltip]="tooltipCopy"
[attr.aria-label]="ariaLabelCopyOrcidId"
(click)="clipboard()"
>
<mat-icon class="material-icons" class="icon"
>content_copy</mat-icon
>
</button>
<button mat-icon-button class="orc-font-small-print" [matTooltip]="tooltipPrintableVersion"
[attr.aria-label]="ariaLabelViewPrintable" (click)="printRecord()">
<button
mat-icon-button
class="orc-font-small-print"
[matTooltip]="tooltipPrintableVersion"
[attr.aria-label]="ariaLabelViewPrintable"
(click)="printRecord()"
>
<mat-icon class="material-icons" class="icon">print</mat-icon>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
gap: 16px;
word-break: break-all;

h1,p {
h1,
p {
margin: 0;
}

Expand Down Expand Up @@ -46,7 +47,7 @@
align-items: center;

.col {
padding: 0 !important
padding: 0 !important;
}

.orcid-logo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { RecordHeaderComponent } from './record-header.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { WINDOW_PROVIDERS } from 'src/app/cdk/window';
import { PlatformInfoService } from 'src/app/cdk/platform-info';
import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service';
import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service';
import { RecordHeaderComponent } from './record-header.component'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { WINDOW_PROVIDERS } from 'src/app/cdk/window'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
import { ErrorHandlerService } from 'src/app/core/error-handler/error-handler.service'
import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service'
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar'
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog'
import { Overlay } from '@angular/cdk/overlay';
import { RouterTestingModule } from '@angular/router/testing';
import { RecordService } from 'src/app/core/record/record.service';
import { Overlay } from '@angular/cdk/overlay'
import { RouterTestingModule } from '@angular/router/testing'
import { RecordService } from 'src/app/core/record/record.service'

describe('RecordHeaderComponent', () => {
let component: RecordHeaderComponent;
let fixture: ComponentFixture<RecordHeaderComponent>;
let component: RecordHeaderComponent
let fixture: ComponentFixture<RecordHeaderComponent>

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule],
declarations: [RecordHeaderComponent],
providers: [
WINDOW_PROVIDERS,
RecordService ,
RecordService,
PlatformInfoService,
ErrorHandlerService,
SnackbarService,
Expand All @@ -34,12 +34,12 @@ describe('RecordHeaderComponent', () => {
})

beforeEach(() => {
fixture = TestBed.createComponent(RecordHeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(RecordHeaderComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy();
});
});
expect(component).toBeTruthy()
})
})
55 changes: 29 additions & 26 deletions src/app/record/components/record-header/record-header.component.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Component, Inject, Input, OnInit } from '@angular/core';
import { isEmpty } from 'lodash';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info';
import { WINDOW } from 'src/app/cdk/window';
import { UserService } from 'src/app/core';
import { RecordService } from 'src/app/core/record/record.service';
import { NamesUtil } from 'src/app/shared/utils/names.util';
import { Assertion, UserInfo } from 'src/app/types';
import { UserRecord } from 'src/app/types/record.local';
import { environment } from 'src/environments/environment';
import { Component, Inject, Input, OnInit } from '@angular/core'
import { isEmpty } from 'lodash'
import { Subject } from 'rxjs'
import { takeUntil } from 'rxjs/operators'
import { PlatformInfo, PlatformInfoService } from 'src/app/cdk/platform-info'
import { WINDOW } from 'src/app/cdk/window'
import { UserService } from 'src/app/core'
import { RecordService } from 'src/app/core/record/record.service'
import { NamesUtil } from 'src/app/shared/utils/names.util'
import { Assertion, UserInfo } from 'src/app/types'
import { UserRecord } from 'src/app/types/record.local'
import { environment } from 'src/environments/environment'

@Component({
selector: 'app-record-header',
templateUrl: './record-header.component.html',
styleUrls: [
'./record-header.component.scss',
'./record-header.component.scss-theme.scss'
]
'./record-header.component.scss-theme.scss',
],
})
export class RecordHeaderComponent implements OnInit {
$destroy: Subject<boolean> = new Subject<boolean>()
Expand Down Expand Up @@ -50,18 +50,18 @@ export class RecordHeaderComponent implements OnInit {
@Inject(WINDOW) private window: Window,
private _platform: PlatformInfoService,
private _user: UserService,
private _record: RecordService,
) { }
private _record: RecordService
) {}

ngOnInit(): void {
this.orcidId = 'https:' + environment.BASE_URL + this.isPublicRecord

this._platform
.get()
.pipe(takeUntil(this.$destroy))
.subscribe((data) => {
this.platform = data
})
.get()
.pipe(takeUntil(this.$destroy))
.subscribe((data) => {
this.platform = data
})

this._record
.getRecord({
Expand All @@ -77,23 +77,26 @@ export class RecordHeaderComponent implements OnInit {
this.givenNames = NamesUtil.getGivenNames(this.userRecord)
this.familyName = NamesUtil.getFamilyName(this.userRecord)
this.creditName = NamesUtil.getCreditName(this.userRecord)
this.ariaLabelName = NamesUtil.getAriaLabelName(this.userRecord, this.ariaLabelName)
this.ariaLabelName = NamesUtil.getAriaLabelName(
this.userRecord,
this.ariaLabelName
)
} else {
if (this.affiliations > 0) {
this.creditName = this.privateName
}
}

if (!isEmpty(this.userRecord.otherNames?.otherNames)) {
this.otherNames = NamesUtil.getOtherNamesUnique(userRecord.otherNames?.otherNames)
this.otherNames = NamesUtil.getOtherNamesUnique(
userRecord.otherNames?.otherNames
)
}
})
}

clipboard() {
this.window.navigator.clipboard.writeText(
this.orcidId
)
this.window.navigator.clipboard.writeText(this.orcidId)
}

printRecord() {
Expand Down
Loading

0 comments on commit 7677330

Please sign in to comment.