diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html index facd0ca27..30acc44e2 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html @@ -2,7 +2,11 @@
@if (document()) { - + @if (priority()) { + {{ document().title | documentTitle }} thumbnail + } @else { + {{ document().title | documentTitle }} thumbnail + }
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts index 421754618..4737f5337 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts @@ -94,6 +94,15 @@ describe('DocumentCardLargeComponent', () => { expect(thumbnail.getAttribute('loading')).toEqual('lazy') }) + it('should prioritize the thumbnail when requested', () => { + fixture.componentRef.setInput('priority', true) + fixture.detectChanges() + const thumbnail: HTMLImageElement = + fixture.nativeElement.querySelector('img.doc-img') + expect(thumbnail.getAttribute('loading')).toEqual('eager') + expect(thumbnail.getAttribute('fetchpriority')).toEqual('high') + }) + it('should trim content', () => { expect(component.contentTrimmed).toHaveLength(503) // includes ... }) diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts index 9304d1168..d0ff0ea3e 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts @@ -66,6 +66,7 @@ export class DocumentCardLargeComponent private documentService = inject(DocumentService) settingsService = inject(SettingsService) readonly selected = input(false) + readonly priority = input(false) readonly displayFields = input( DEFAULT_DISPLAY_FIELDS.map((f) => f.id) ) diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index 7a0a507e6..4e55e4936 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -2,7 +2,11 @@
@if (document()) { - + @if (priority()) { + {{ document().title | documentTitle }} thumbnail + } @else { + {{ document().title | documentTitle }} thumbnail + }
diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts index c6127494b..88f143d71 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts @@ -67,6 +67,15 @@ describe('DocumentCardSmallComponent', () => { expect(thumbnail.getAttribute('loading')).toEqual('lazy') }) + it('should prioritize the thumbnail when requested', () => { + fixture.componentRef.setInput('priority', true) + fixture.detectChanges() + const thumbnail: HTMLImageElement = + fixture.nativeElement.querySelector('img.doc-img') + expect(thumbnail.getAttribute('loading')).toEqual('eager') + expect(thumbnail.getAttribute('fetchpriority')).toEqual('high') + }) + it('should display a document, limit tags to 5', () => { expect(fixture.nativeElement.textContent).toContain('Document 10') expect( diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts index 633ad3e2e..a0e8bd2ab 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts @@ -66,6 +66,7 @@ export class DocumentCardSmallComponent private documentService = inject(DocumentService) settingsService = inject(SettingsService) readonly selected = input(false) + readonly priority = input(false) readonly document = input(undefined) readonly displayFields = input( DEFAULT_DISPLAY_FIELDS.map((f) => f.id) diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index f29d2dca8..cf2088e78 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -164,9 +164,10 @@ } @else { @if (list.displayMode === DisplayMode.LARGE_CARDS) {
- @for (d of list.documents; track d.id) { + @for (d of list.documents; track d.id; let i = $index) { - @for (d of list.documents; track d.id) { + @for (d of list.documents; track d.id; let i = $index) {