Skip to content

Commit df6be96

Browse files
authored
PD-4980,PD-4979,PD-4977,PD-4978 + Improve my-orcid rendering resources (#2744)
* PD-4978 * PD-4978 * PD-4978
1 parent 00421e3 commit df6be96

9 files changed

Lines changed: 46 additions & 29 deletions

File tree

projects/orcid-registry-ui/src/lib/components/permission-notifications/permission-notifications.component.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
gap: var(--orcid-space-4, 16px);
99
}
1010

11-
.permission-notifications__list ::ng-deep .action-surface__text {
12-
font-size: var(--orcid-font-size-body-small, 14px);
13-
line-height: 21px;
14-
}
15-
1611
.registry-brand-secondary-dark:hover {
1712
background-color: var(--orcid-color-brand-secondary-dark, #085c77);
1813
}

projects/orcid-ui/src/lib/components/action-surface-container/action-surface-container.component.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<section class="action-surface-container">
22
<header class="action-surface-container__header">
3-
<h2 class="action-surface-container__title orc-font-body" *ngIf="title">
3+
<h3
4+
class="action-surface-container__title orcid-font-size-body-large"
5+
*ngIf="title"
6+
>
47
{{ title }}
5-
</h2>
8+
</h3>
69
<p
710
class="action-surface-container__subtitle orc-font-body-small"
811
*ngIf="subtitle"

projects/orcid-ui/src/lib/components/action-surface-container/action-surface-container.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
-apple-system,
2626
sans-serif
2727
);
28-
font-size: 20px;
28+
font-size: var(--orcid-font-size-body, 16px);
2929
line-height: 1.25;
3030
font-weight: var(--orcid-font-weight-bold, 700);
3131
color: var(--orcid-color-text-dark-high, #000000);

src/app/core/inbox/permission-notifications.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,18 @@ describe('PermissionNotificationsService', () => {
322322
})
323323
})
324324

325-
it('should sort by sentDate descending', (done) => {
325+
it('should sort by createdDate descending', (done) => {
326326
const perm1 = createPermissionNotification({
327327
putCode: 1,
328-
sentDate: 1000,
328+
createdDate: 1000,
329329
source: {
330330
sourceClientId: { path: 'client-a' } as any,
331331
sourceName: { content: 'A' },
332332
},
333333
})
334334
const perm2 = createPermissionNotification({
335335
putCode: 2,
336-
sentDate: 3000,
336+
createdDate: 3000,
337337
source: {
338338
sourceClientId: { path: 'client-b' } as any,
339339
sourceName: { content: 'B' },
@@ -346,8 +346,8 @@ describe('PermissionNotificationsService', () => {
346346
)
347347

348348
service.loadUnreadPermissionNotifications(3).subscribe((result) => {
349-
expect(result[0].sentDate).toBe(3000)
350-
expect(result[1].sentDate).toBe(1000)
349+
expect(result[0].createdDate).toBe(3000)
350+
expect(result[1].createdDate).toBe(1000)
351351
done()
352352
})
353353
})

src/app/core/inbox/permission-notifications.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ export class PermissionNotificationsService {
9797
(n): n is InboxNotificationPermission =>
9898
n?.notificationType === 'PERMISSION' && !n.readDate && !n.archivedDate
9999
)
100-
.sort((a, b) => Number(b.sentDate || 0) - Number(a.sentDate || 0))
100+
.sort(
101+
(a, b) =>
102+
new Date(b.createdDate || 0).getTime() -
103+
new Date(a.createdDate || 0).getTime()
104+
)
101105
const byClient = new Map<string, InboxNotificationPermission>()
102106
for (const n of unreadPermission) {
103107
const clientId = n?.source?.sourceClientId?.path
@@ -106,7 +110,9 @@ export class PermissionNotificationsService {
106110
if (!byClient.has(clientId)) byClient.set(clientId, n)
107111
}
108112
return Array.from(byClient.values()).sort(
109-
(a, b) => Number(b.sentDate || 0) - Number(a.sentDate || 0)
113+
(a, b) =>
114+
new Date(b.createdDate || 0).getTime() -
115+
new Date(a.createdDate || 0).getTime()
110116
)
111117
}
112118
}

src/app/layout/language/language.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Component, OnInit, Inject, LOCALE_ID } from '@angular/core'
1+
import {
2+
ChangeDetectionStrategy,
3+
Component,
4+
Inject,
5+
LOCALE_ID,
6+
} from '@angular/core'
27

38
import { WINDOW } from 'src/app/cdk/window'
49
import { LanguageService } from 'src/app/core/language/language.service'
@@ -8,8 +13,9 @@ import { LanguageService } from 'src/app/core/language/language.service'
813
templateUrl: './language.component.html',
914
styleUrls: ['./language.component.scss'],
1015
standalone: false,
16+
changeDetection: ChangeDetectionStrategy.OnPush,
1117
})
12-
export class LanguageComponent implements OnInit {
18+
export class LanguageComponent {
1319
languageMenuOptions: { [key: string]: string }
1420
labelLanguage = $localize`:@@layout.ariaLabelLanguage:Select your preferred language. Current language is`
1521

@@ -31,6 +37,4 @@ export class LanguageComponent implements OnInit {
3137
this.window.location.reload()
3238
})
3339
}
34-
35-
ngOnInit() {}
3640
}
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { Component, OnInit } from '@angular/core'
1+
import {
2+
ChangeDetectionStrategy,
3+
ChangeDetectorRef,
4+
Component,
5+
} from '@angular/core'
26
import { TogglzService } from 'src/app/core/togglz/togglz.service'
37
import { MaintenanceMessage } from 'src/app/types/togglz.local'
8+
import { take } from 'rxjs/operators'
49

510
@Component({
611
selector: 'app-maintenance-message',
@@ -10,17 +15,20 @@ import { MaintenanceMessage } from 'src/app/types/togglz.local'
1015
'./maintenance-message.component.scss',
1116
],
1217
standalone: false,
18+
changeDetection: ChangeDetectionStrategy.OnPush,
1319
})
14-
export class MaintenanceMessageComponent implements OnInit {
20+
export class MaintenanceMessageComponent {
1521
maintenanceMessage: MaintenanceMessage
1622
closableElement: Element
1723
labelMaintenance = $localize`:@@layout.ariaLabelMaintenance:Maintenance message`
1824

19-
constructor(togglz: TogglzService) {
20-
togglz.getMaintenanceMessages().subscribe((value) => {
21-
this.maintenanceMessage = value
22-
})
25+
constructor(togglz: TogglzService, private cdr: ChangeDetectorRef) {
26+
togglz
27+
.getMaintenanceMessages()
28+
.pipe(take(1))
29+
.subscribe((value) => {
30+
this.maintenanceMessage = value
31+
this.cdr.markForCheck()
32+
})
2333
}
24-
25-
ngOnInit() {}
2634
}

src/app/record/components/top-bar/top-bar.component.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ app-top-bar-actions {
147147
}
148148
}
149149

150-
app-warning-message {
150+
app-warning-message,
151+
orcid-registry-permission-notifications {
151152
margin-bottom: 16px;
152153
}

src/app/record/components/top-bar/top-bar.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class TopBarComponent implements OnInit, OnDestroy {
191191
(_, i) => i !== event.notificationIndex
192192
)
193193
if (target) {
194-
;(this.window as any).outOfRouterNavigation(target)
194+
this.window.open(target, '_blank')
195195
}
196196
})
197197
return

0 commit comments

Comments
 (0)