Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
refactor(frontend:files): simplify image viewer styles and introduce cleaner height calculation logic
johavenf738c0a70c46
diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.html b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.htmlindex 2c036772..14dac871 100644--- a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.html+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.html@@ -4,7 +4,7 @@~ See the LICENSE file for licensing details-->-<div [style.height.px]="currentHeight()">+<div><div class="app-top-menu d-flex justify-content-between"><div class="d-flex"><button@@ -55,9 +55,12 @@<fa-icon [icon]="icons.faInfo"></fa-icon></button></div>- <div class="d-flex justify-content-center" [style.height]="`calc(${currentHeight()}px - 40px)`">- <img #image (load)="onImageLoad()" [src]="file().dataUrl" [style.max-height]="`calc(${currentHeight()}px - 40px)`" alt="" class="img-fluid align-self-center" />- <div class="info-box position-absolute end-0 bottom-0" [class.d-none]="!isInfoboxOpen()">+ <div class="app-viewer-image" [style.height.px]="currentHeightWithOffset()">+ <img #image+ (load)="onImageLoad()"+ [src]="file().dataUrl" [style.max-height.px]="currentHeightWithOffset()"+ alt="" />+ <div class="info-box" [class.d-none]="!isInfoboxOpen()">{{ file().mime }}{{ imageResolution() }}{{ file().hSize }}diff --git a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.tsindex 12bd640d..0995a8a1 100755--- a/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts+++ b/frontend/src/app/applications/files/components/viewers/files-viewer-image.component.ts@@ -5,31 +5,19 @@*/import { ChangeDetectionStrategy, Component, computed, DestroyRef, ElementRef, inject, input, model, signal, viewChild } from '@angular/core'-import { FormsModule } from '@angular/forms'import { takeUntilDestroyed } from '@angular/core/rxjs-interop'+import { FormsModule } from '@angular/forms'import { FaIconComponent } from '@fortawesome/angular-fontawesome'import { faAngleLeft, faAngleRight, faInfo, faPlay, faStop } from '@fortawesome/free-solid-svg-icons'+import { L10N_LOCALE, L10nLocale, L10nTranslatePipe } from 'angular-l10n'import { ButtonCheckboxDirective } from 'ngx-bootstrap/buttons'import { TooltipModule } from 'ngx-bootstrap/tooltip'-import { L10N_LOCALE, L10nLocale, L10nTranslatePipe } from 'angular-l10n'import { Subscription, timer } from 'rxjs'import { FileModel } from '../../models/file.model'-const slideDelay = 5000-@Component({selector: 'app-files-viewer-image',imports: [FormsModule, TooltipModule, FaIconComponent, ButtonCheckboxDirective, L10nTranslatePipe],- styles: [- `- .info-box {- text-shadow:- 1px 1px 2px #000,- 0 0 1em #fff,- 0 0 0.2em #fff;- }- `- ],templateUrl: 'files-viewer-image.component.html',changeDetection: ChangeDetectionStrategy.OnPush})@@ -37,6 +25,7 @@ export class FilesViewerImageComponent {file = model<FileModel>()directoryImages = input<FileModel[]>()currentHeight = input<number>()+ currentHeightWithOffset = computed(() => this.currentHeight() - 40)protected isInfoboxOpen = signal(false)protected isSlideshowActive = signal(false)protected imageCount = computed(() => this.directoryImages().length)@@ -44,6 +33,7 @@ export class FilesViewerImageComponent {protected imageResolution = signal<string>('')protected readonly icons = { faAngleLeft, faAngleRight, faInfo, faPlay, faStop }protected readonly locale = inject<L10nLocale>(L10N_LOCALE)+ private readonly slideDelay = 5000private destroyRef = inject(DestroyRef)private imageRef = viewChild.required<ElementRef>('image')private slideshowSub: Subscription@@ -63,7 +53,7 @@ export class FilesViewerImageComponent {protected startSlideshow() {this.isSlideshowActive.set(true)- this.slideshowSub = timer(slideDelay, slideDelay)+ this.slideshowSub = timer(this.slideDelay, this.slideDelay).pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.nextImage())}diff --git a/frontend/src/styles/components/_app.scss b/frontend/src/styles/components/_app.scssindex dee71ff6..70f59387 100755--- a/frontend/src/styles/components/_app.scss+++ b/frontend/src/styles/components/_app.scss@@ -363,6 +363,26 @@border: none;}+.app-viewer-image {+ display: flex;+ justify-content: center;+ background-color: lighten($sidebar-dark-apps-menu-title-bg, 4%);++ img {+ @extend .img-fluid;+ align-self: center;+ }++ .info-box {+ position: absolute;+ bottom: 0;+ right: 0;+ text-shadow: 1px 1px 2px #000,+ 0 0 1em #fff,+ 0 0 0.2em #fff;+ }+}+.app-comment {textarea {padding: .15rem .3rem;