diff --git a/apps/red-ui/src/app/modules/projects/projects.module.ts b/apps/red-ui/src/app/modules/projects/projects.module.ts index 761894780..64a4ae3a6 100644 --- a/apps/red-ui/src/app/modules/projects/projects.module.ts +++ b/apps/red-ui/src/app/modules/projects/projects.module.ts @@ -37,6 +37,7 @@ import { AnnotationDrawService } from './services/annotation-draw.service'; import { AnnotationProcessingService } from './services/annotation-processing.service'; import { AnnotationRemoveActionsComponent } from './components/annotation-remove-actions/annotation-remove-actions.component'; import { DossierDictionaryDialogComponent } from './dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component'; +import { UserPreferenceControllerService } from '@redaction/red-ui-http'; const screens = [ProjectListingScreenComponent, ProjectOverviewScreenComponent, FilePreviewScreenComponent]; @@ -79,7 +80,8 @@ const services = [ ManualAnnotationService, PdfViewerDataService, AnnotationDrawService, - AnnotationProcessingService + AnnotationProcessingService, + UserPreferenceControllerService ]; @NgModule({ diff --git a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts index c9ace948e..971d244f9 100644 --- a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.ts @@ -22,7 +22,7 @@ import { handleFilterDelta, processFilters } from '@shared/components/filter/uti import { UserPreferenceService } from '@services/user-preference.service'; import { UserService } from '@services/user.service'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { FileManagementControllerService, StatusControllerService } from '@redaction/red-ui-http'; +import { FileManagementControllerService, StatusControllerService, UserPreferenceControllerService } from '@redaction/red-ui-http'; import { PdfViewerDataService } from '../../services/pdf-viewer-data.service'; import { download } from '@utils/file-download-utils'; import { ViewMode } from '@models/file/view-mode'; @@ -71,6 +71,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, readonly permissionsService: PermissionsService, readonly userPreferenceService: UserPreferenceService, readonly userService: UserService, + private readonly _userPreferenceControllerService: UserPreferenceControllerService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _activatedRoute: ActivatedRoute, private readonly _dialogService: ProjectsDialogService, @@ -88,6 +89,16 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, this.reviewerForm = this._formBuilder.group({ reviewer: [this.appStateService.activeFile.currentReviewer] }); + + this._loadFileData().subscribe(() => { + this._updateCanPerformActions(); + }); + + document.documentElement.addEventListener('fullscreenchange', () => { + if (!document.fullscreenElement) { + this.fullScreen = false; + } + }); } get singleUsersSelectOptions() { @@ -178,23 +189,15 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, } ngOnAttach(previousRoute: ActivatedRouteSnapshot) { - this.displayPDFViewer = true; + this.ngOnInit(); this._lastPage = previousRoute.queryParams.page; - this._subscribeToFileUpdates(); } ngOnInit(): void { this.displayPDFViewer = true; - document.documentElement.addEventListener('fullscreenchange', () => { - if (!document.fullscreenElement) { - this.fullScreen = false; - } - }); - - this._loadFileData().subscribe(() => { - this._updateCanPerformActions(); - }); + const key = 'Project-Recent-' + this.projectId; + this._userPreferenceControllerService.savePreferences([this.fileId], key).toPromise().then(); this._subscribeToFileUpdates(); } diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.html index ce6d0ee1f..2dff5fed0 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.html @@ -171,6 +171,7 @@ *cdkVirtualFor="let fileStatus of displayedEntities | sortBy: sortingOption.order:sortingOption.column; trackBy: fileId" [class.disabled]="fileStatus.isExcluded" [class.pointer]="permissionsService.canOpenFile(fileStatus)" + [class.last-opened]="isLastOpenedFile(fileStatus)" [routerLink]="fileLink(fileStatus)" class="table-item" > diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss index c305c4f98..4f91ae3fe 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss @@ -122,3 +122,23 @@ cdk-virtual-scroll-viewport { .primary-attribute { padding-top: 6px; } + +.last-opened { + > .selection-column { + padding-left: 6px !important; + border-left: 4px solid $red-1; + } + + > div { + animation: red-fading-background 3s 1; + } +} + +@keyframes red-fading-background { + 0% { + background-color: rgba($red-1, 0.1); + } + 100% { + background-color: inherit; + } +} diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts index 698e823ec..cb102bda3 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.ts @@ -14,7 +14,7 @@ import { FileStatusWrapper } from '@models/file/file-status.wrapper'; import { annotationFilterChecker, keyChecker, processFilters } from '@shared/components/filter/utils/filter-utils'; import { PermissionsService } from '@services/permissions.service'; import { UserService } from '@services/user.service'; -import { FileStatus } from '@redaction/red-ui-http'; +import { FileStatus, UserPreferenceControllerService } from '@redaction/red-ui-http'; import { Subscription, timer } from 'rxjs'; import { filter, tap } from 'rxjs/operators'; import { RedactionFilterSorter } from '@utils/sorters/redaction-filter-sorter'; @@ -50,6 +50,7 @@ export class ProjectOverviewScreenComponent extends BaseListingComponent { + if (attributes === null || attributes === undefined) return; + const key = 'Project-Recent-' + this.activeProject.projectId; + this._lastOpenedFileId = attributes[key][0]; + }); + this._fileDropOverlayService.initFileDropHandling(); this.calculateData();