From d77cb8ec008d2f4decae2bca74550d55765fa618 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 13 Oct 2024 20:52:06 -0700 Subject: [PATCH] Make this better --- .../document-detail/document-detail.component.html | 9 +++++---- .../document-detail/document-detail.component.scss | 13 ++++++++++++- .../document-detail/document-detail.component.ts | 8 ++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index 668035ea2..0e52096fd 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -350,15 +350,16 @@ - @if (!metadata) { - Document loading... -
+
+ Document loading... +
Loading...
- } @else { +
+ @if (metadata) { @switch (archiveContentRenderType) { @case (ContentRenderType.PDF) { @if (!useNativePdfViewer) { diff --git a/src-ui/src/app/components/document-detail/document-detail.component.scss b/src-ui/src/app/components/document-detail/document-detail.component.scss index 2c561b163..3abd069de 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.scss +++ b/src-ui/src/app/components/document-detail/document-detail.component.scss @@ -64,5 +64,16 @@ textarea.rtl { } .thumb-preview { - border: 8px solid var(--bs-secondary); + top: 0; + left: calc(.5 * var(--bs-gutter-x)); + height: calc(100vh - 160px); + overflow: hidden; + background-color: gray; + padding: 10px 8px; // border + width: calc(100% - var(--bs-gutter-x)); + z-index: 1000; + + > div { + mix-blend-mode: difference; + } } diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index e51ed4dbf..f77a2c59f 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -136,6 +136,7 @@ export class DocumentDetailComponent previewText: string downloadUrl: string downloadOriginalUrl: string + previewLoaded: boolean = false correspondents: Correspondent[] documentTypes: DocumentType[] @@ -538,6 +539,9 @@ export class DocumentDetailComponent .subscribe({ next: (result) => { this.metadata = result + if (this.archiveContentRenderType !== ContentRenderType.PDF) { + this.previewLoaded = true + } }, error: (error) => { this.metadata = {} // allow display to fallback to tag @@ -904,11 +908,15 @@ export class DocumentDetailComponent pdfPreviewLoaded(pdf: PDFDocumentProxy) { this.previewNumPages = pdf.numPages if (this.password) this.requiresPassword = false + setTimeout(() => { + this.previewLoaded = true + }, 300) } onError(event) { if (event.name == 'PasswordException') { this.requiresPassword = true + this.previewLoaded = true } }