diff --git a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html index 98decd5c8..0e4717459 100644 --- a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html +++ b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html @@ -1,4 +1,4 @@
-
{{initials}}
+
{{initials}}
{{username || ('initials-avatar.unassigned.label' | translate)}}
diff --git a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.ts b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.ts index 6c65d0a68..e748b81c3 100644 --- a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.ts +++ b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.ts @@ -1,16 +1,18 @@ -import {Component, Input, OnInit} from '@angular/core'; +import { Component, Input, OnChanges, OnInit } from '@angular/core'; +import { UserService } from '../../user/user.service'; +import { User } from '@redaction/red-ui-http'; @Component({ selector: 'redaction-initials-avatar', templateUrl: './initials-avatar.component.html', styleUrls: ['./initials-avatar.component.scss'] }) -export class InitialsAvatarComponent implements OnInit { +export class InitialsAvatarComponent implements OnInit, OnChanges { @Input() - public username: string; + public userId: string; @Input() - public color = 'lightgray-dark'; + public color = 'lightgray'; @Input() public size: 'small' | 'large' = 'small'; @@ -18,21 +20,40 @@ export class InitialsAvatarComponent implements OnInit { @Input() public withName = false; - constructor() { + public _user: User; + + constructor(private readonly _userService: UserService) { } ngOnInit(): void { } + ngOnChanges(): void { + this._user = this._userService.getUserById(this.userId); + } + + public get username(): string { + return this._userService.getName(this._user); + } + public get initials(): string { - if (!this.username) { + if (!this._user) { return '?' } - return this.username + return this._userService.getName(this._user) .split(' ') + .filter(value => value !== ' ') .filter((value, idx) => idx < 2) .map((str) => str[0]) .join(''); } + + public get colorClass() { + if (this.color.includes('-')) { + return this.color; + } + const textColor = !this._user || !this._userService.isManager(this._user) ? 'dark' : 'red'; + return `${this.color}-${textColor}` + } } diff --git a/apps/red-ui/src/app/screens/base-screen/base-screen.component.html b/apps/red-ui/src/app/screens/base-screen/base-screen.component.html index da5a7c2f3..3070fa98e 100644 --- a/apps/red-ui/src/app/screens/base-screen/base-screen.component.html +++ b/apps/red-ui/src/app/screens/base-screen/base-screen.component.html @@ -40,7 +40,7 @@
-
diff --git a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts index df592011b..cdcb496e8 100644 --- a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts @@ -68,10 +68,6 @@ export class ProjectListingScreenComponent implements OnInit { return this.appStateService.allProjects.length - this.activeProjects; } - public getOwnerName(pw: ProjectWrapper) { - return this._userService.getNameForId(pw.project.ownerId); - } - public documentCount(project: ProjectWrapper) { return project.files.length; } @@ -107,6 +103,6 @@ export class ProjectListingScreenComponent implements OnInit { return acc; }, {}) - return Object.keys(obj).map(status => ({ length: obj[status], color: status })); + return Object.keys(obj).sort().map(status => ({ length: obj[status], color: status })); } } diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html index 1ad9a2d5f..0a9356f9b 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html @@ -108,7 +108,7 @@
@@ -178,9 +178,8 @@
-
@@ -192,8 +191,8 @@
-
- +
+
+{{overflowCount}}
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index 59efd5162..5cfd2cdbe 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -69,20 +69,12 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { return this._userService.user; } - public get members() { - return this.activeProject.memberIds.map(m => this._userService.getName(this._userService.getUserById(m))); - } - public get displayMembers() { - return this.members.slice(0, 6); + return this.activeProject.memberIds.slice(0, 6); } public get overflowCount() { - return this.members.length > 6 ? this.members.length - 6 : 0; - } - - public get ownerName() { - return this._userService.getNameForId(this.activeProject.ownerId); + return this.activeProject.memberIds.length > 6 ? this.activeProject.memberIds.length - 6 : 0; } private _getFileStatus() { @@ -190,10 +182,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { return fileStatus === 'PROCESSING' || fileStatus === 'REVIEWED' || true; } - public getFileOwnerUsername(fileStatus: FileStatus) { - return this._userService.getNameForId(fileStatus.currentReviewer); - } - public toggleSortByAddedOn() { const sortedByRecent: boolean = (this.sortingOption === this.sortingOptions[0]); this.sortingOption = sortedByRecent ? this.sortingOptions[1] : this.sortingOptions[0];