@@ -10,48 +10,43 @@ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
1010import { ActivatedRoute , Router } from '@angular/router' ;
1111
1212import { FilesSelectors , GetFile } from '@osf/features/files/store' ;
13- import { LoadingSpinnerComponent } from '@shared/components/loading-spinner/loading-spinner.component' ;
14- import { SubHeaderComponent } from '@shared/components/sub-header/sub-header.component' ;
15- import { ViewOnlyLinkHelperService } from '@shared/services/view-only-link-helper.service' ;
13+ import { LoadingSpinnerComponent } from '@osf/ shared/components/loading-spinner/loading-spinner.component' ;
14+ import { SubHeaderComponent } from '@osf/ shared/components/sub-header/sub-header.component' ;
15+ import { ViewOnlyLinkHelperService } from '@osf/ shared/services/view-only-link-helper.service' ;
1616
1717@Component ( {
18- selector : 'osf-draft-file-detail.component ' ,
18+ selector : 'osf-draft-file-detail' ,
1919 imports : [ SubHeaderComponent , LoadingSpinnerComponent , TranslatePipe ] ,
2020 templateUrl : './file-preview.component.html' ,
21- styleUrl : './file-preview.. component.scss' ,
21+ styleUrl : './file-preview.component.scss' ,
2222 changeDetection : ChangeDetectionStrategy . OnPush ,
2323} )
2424export class FilePreviewComponent {
2525 @HostBinding ( 'class' ) classes = 'flex flex-column flex-1 w-full h-full' ;
2626
27- isFileLoading = select ( FilesSelectors . isOpenedFileLoading ) ;
28- file = select ( FilesSelectors . getOpenedFile ) ;
29- readonly router = inject ( Router ) ;
30- readonly route = inject ( ActivatedRoute ) ;
31- readonly sanitizer = inject ( DomSanitizer ) ;
27+ private readonly router = inject ( Router ) ;
28+ private readonly route = inject ( ActivatedRoute ) ;
29+ private readonly sanitizer = inject ( DomSanitizer ) ;
30+ private readonly destroyRef = inject ( DestroyRef ) ;
3231 private readonly viewOnlyService = inject ( ViewOnlyLinkHelperService ) ;
32+
33+ private readonly actions = createDispatchMap ( { getFile : GetFile } ) ;
34+
35+ file = select ( FilesSelectors . getOpenedFile ) ;
36+ isFileLoading = select ( FilesSelectors . isOpenedFileLoading ) ;
37+
3338 isIframeLoading = true ;
3439 safeLink : SafeResourceUrl | null = null ;
35- readonly destroyRef = inject ( DestroyRef ) ;
36- fileGuid = '' ;
37- hasViewOnly = computed ( ( ) => this . viewOnlyService . hasViewOnlyParam ( this . router ) ) ;
3840
39- private readonly actions = createDispatchMap ( {
40- getFile : GetFile ,
41- } ) ;
41+ hasViewOnly = computed ( ( ) => this . viewOnlyService . hasViewOnlyParam ( this . router ) ) ;
4242
4343 constructor ( ) {
4444 this . route . params
4545 . pipe (
4646 takeUntilDestroyed ( this . destroyRef ) ,
47- switchMap ( ( params ) => {
48- this . fileGuid = params [ 'fileGuid' ] ;
49- return this . actions . getFile ( this . fileGuid ) ;
50- } )
47+ switchMap ( ( params ) => this . actions . getFile ( params [ 'fileGuid' ] ) )
5148 )
52- . subscribe ( ( ) => {
53- this . getIframeLink ( '' ) ;
54- } ) ;
49+ . subscribe ( ( ) => this . getIframeLink ( '' ) ) ;
5550 }
5651
5752 getIframeLink ( version : string ) {
0 commit comments