From 38616a76ce8bf945706f534508f54e9d70e6f411 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 14 Feb 2022 12:58:01 +0200 Subject: [PATCH] fix RED-3395: mark page as seen when user changes --- .../file-workload/file-workload.component.html | 3 ++- .../page-indicator/page-indicator.component.ts | 17 +++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html index 176f71a18..f36d12806 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html @@ -92,7 +92,7 @@ -
+
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts index dc226a6cc..2e06a8c49 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-indicator/page-indicator.component.ts @@ -1,11 +1,9 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnDestroy, Output } from '@angular/core'; import { PermissionsService } from '@services/permissions.service'; import { ConfigService } from '@services/config.service'; -import { DossiersService } from '@services/entity-services/dossiers.service'; import { ViewedPagesService } from '@services/entity-services/viewed-pages.service'; import { IViewedPage } from '@red/domain'; import { AutoUnsubscribe } from '@iqser/common-ui'; -import { FilesMapService } from '@services/entity-services/files-map.service'; import { FilePreviewStateService } from '../../services/file-preview-state.service'; import { firstValueFrom } from 'rxjs'; @@ -20,6 +18,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy @Input() showDottedIcon = false; @Input() number: number; @Input() activeSelection = false; + @Input() viewedPages: IViewedPage[] = []; @Output() readonly pageSelected = new EventEmitter(); @@ -28,8 +27,6 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy constructor( private readonly _viewedPagesService: ViewedPagesService, - private readonly _filesMapService: FilesMapService, - private readonly _dossiersService: DossiersService, private readonly _configService: ConfigService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _permissionService: PermissionsService, @@ -39,7 +36,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy } get activePage() { - return this._viewedPages.find(p => p.page === this.number); + return this.viewedPages.find(p => p.page === this.number); } get dossierId() { @@ -50,10 +47,6 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy return this._stateService.fileId; } - private get _viewedPages(): IViewedPage[] { - return this._stateService.fileData?.viewedPages || []; - } - ngOnChanges() { this._setReadState(); return this.handlePageRead(); @@ -104,7 +97,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy if (this.activePage) { this.activePage.showAsUnseen = false; } else { - this._viewedPages.push({ page: this.number, fileId: this.fileId }); + this.viewedPages.push({ page: this.number, fileId: this.fileId }); } this._setReadState(); } @@ -113,8 +106,8 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy const removePage$ = this._viewedPagesService.removePage(this.dossierId, this.fileId, this.number); await firstValueFrom(removePage$); - this._viewedPages.splice( - this._viewedPages.findIndex(p => p.page === this.number), + this.viewedPages.splice( + this.viewedPages.findIndex(p => p.page === this.number), 1, ); this._setReadState();