diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html index 764e2454f..37411ebe8 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html @@ -1,39 +1,34 @@ - - -
-
-
- {{ comment.user | name }} - {{ comment.date | date: 'sophisticatedDate' }} -
- -
- -
+ +
+
+
+ {{ comment.user | name }} + {{ comment.date | date: 'sophisticatedDate' }}
-
{{ comment.text }}
+
+ +
- - +
{{ comment.text }}
+
+ + + +
- -
- - - diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts index 214246329..f0eab09e1 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts @@ -1,14 +1,15 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnChanges, ViewChild } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnInit, ViewChild } from '@angular/core'; import { Dossier, File, IComment } from '@red/domain'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { UserService } from '@services/user.service'; import { PermissionsService } from '@services/permissions.service'; -import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui'; +import { InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui'; import { firstValueFrom, Observable } from 'rxjs'; import { CommentingService } from '../../services/commenting.service'; import { tap } from 'rxjs/operators'; import { FilePreviewStateService } from '../../services/file-preview-state.service'; import { ManualRedactionService } from '../../services/manual-redaction.service'; +import { ContextComponent } from '@utils/context.component'; @Component({ selector: 'redaction-comments', @@ -16,7 +17,7 @@ import { ManualRedactionService } from '../../services/manual-redaction.service' styleUrls: ['./comments.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class CommentsComponent extends AutoUnsubscribe implements OnChanges { +export class CommentsComponent extends ContextComponent implements OnInit { @Input() annotation: AnnotationWrapper; readonly trackBy = trackByFactory(); readonly file$: Observable; @@ -39,12 +40,14 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges { this.dossier$ = _stateService.dossier$; } - ngOnChanges() { + ngOnInit() { this.hiddenComments$ = this._commentingService.isActive$(this.annotation.id).pipe( tap(active => { this._hidden = !active; }), ); + + super._initContext([{ file: this.file$ }, { dossier: this.dossier$ }, this.hiddenComments$]); } async addComment(value: string): Promise { diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html index 19f0302e7..31f5076ab 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.html @@ -1,22 +1,22 @@ - -
+ +