Revert "Merge pull request #628 from shamoon/feature/popover-previews"

This reverts commit 8da1521508, reversing
changes made to a7846925b1.
This commit is contained in:
jonaswinkler 2021-03-05 23:19:44 +01:00
parent 8da1521508
commit 9816efb816
14 changed files with 61 additions and 161 deletions

View file

@ -1,15 +1,13 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { PaperlessDocument } from 'src/app/data/paperless-document';
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata';
import { DocumentService } from 'src/app/services/rest/document.service';
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-document-card-large',
templateUrl: './document-card-large.component.html',
styleUrls: ['./document-card-large.component.scss', '../popover-preview/popover-preview.scss']
styleUrls: ['./document-card-large.component.scss']
})
export class DocumentCardLargeComponent implements OnInit {
@ -43,13 +41,6 @@ export class DocumentCardLargeComponent implements OnInit {
@Input()
searchScore: number
@ViewChild('popover') popover: NgbPopover
mouseOnPreview = false
popoverHidden = true
metadata: PaperlessDocumentMetadata
get searchScoreClass() {
if (this.searchScore > 0.7) {
return "success"
@ -61,9 +52,6 @@ export class DocumentCardLargeComponent implements OnInit {
}
ngOnInit(): void {
this.documentService.getMetadata(this.document?.id).subscribe(result => {
this.metadata = result
})
}
getIsThumbInverted() {
@ -91,36 +79,7 @@ export class DocumentCardLargeComponent implements OnInit {
return this.documentService.getDownloadUrl(this.document.id)
}
get previewUrl() {
getPreviewUrl() {
return this.documentService.getPreviewUrl(this.document.id)
}
getContentType() {
return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type
}
mouseEnterPreview() {
this.mouseOnPreview = true
if (!this.popover.isOpen()) {
// we're going to open but hide to pre-load content during hover delay
this.popover.open()
this.popoverHidden = true
setTimeout(() => {
if (this.mouseOnPreview) {
// show popover
this.popoverHidden = false
} else {
this.popover.close()
}
}, 600);
}
}
mouseLeavePreview() {
this.mouseOnPreview = false
}
mouseLeaveCard() {
this.popover.close()
}
}