From 90a5480ff6b08f4d6904e3e2e7dead5bae456d02 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 5 Sep 2023 22:26:42 +0200 Subject: [PATCH] Code cleanup and icon padding improvements #587 --- src/backend/routes/PublicRouter.ts | 3 +- .../app/ui/gallery/contentLoader.service.ts | 6 ++-- .../info-panel.lightbox.gallery.component.ts | 3 +- .../lightbox/lightbox.gallery.component.ts | 4 +-- .../ui/gallery/navigator/sorting.service.ts | 2 -- .../random-query-builder.gallery.component.ts | 31 ++++++++----------- .../search/search.gallery.component.ts | 12 +------ .../gallery/share/share.gallery.component.ts | 1 - 8 files changed, 19 insertions(+), 43 deletions(-) diff --git a/src/backend/routes/PublicRouter.ts b/src/backend/routes/PublicRouter.ts index 8ffe6b05..023f1442 100644 --- a/src/backend/routes/PublicRouter.ts +++ b/src/backend/routes/PublicRouter.ts @@ -176,7 +176,6 @@ export class PublicRouter { vBs[3] += size * (p); }; - addPadding(0.38); addPadding(paddingPercent); @@ -233,7 +232,7 @@ export class PublicRouter { res.set('Cache-control', 'public, max-age=31536000'); res.header('Content-Type', 'image/svg+xml'); // Use 40% padding: https://w3c.github.io/manifest/#icon-masks - res.send(getIcon('auto', 0.3)); + res.send(getIcon('auto', 0.7)); }); diff --git a/src/frontend/app/ui/gallery/contentLoader.service.ts b/src/frontend/app/ui/gallery/contentLoader.service.ts index 9aaa9c5b..9c01cd99 100644 --- a/src/frontend/app/ui/gallery/contentLoader.service.ts +++ b/src/frontend/app/ui/gallery/contentLoader.service.ts @@ -12,17 +12,15 @@ import {ErrorCodes} from '../../../../common/entities/Error'; import {map} from 'rxjs/operators'; import {MediaDTO} from '../../../../common/entities/MediaDTO'; import {FileDTO} from '../../../../common/entities/FileDTO'; -import {GroupedDirectoryContent} from './navigator/sorting.service'; @Injectable() export class ContentLoaderService { public content: BehaviorSubject; public originalContent: Observable; - public sortedFilteredContent: Observable; lastRequest: { directory: string } = { directory: null, }; - private searchId: any; + private searchId: number; private ongoingSearch: string = null; constructor( @@ -54,7 +52,7 @@ export class ContentLoaderService { this.lastRequest.directory = directoryName; // prepare server request - const params: { [key: string]: any } = {}; + const params: { [key: string]: unknown } = {}; if (Config.Sharing.enabled === true) { if (this.shareService.isSharing()) { params[QueryParams.gallery.sharingKey_query] = diff --git a/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts index 0e898ec7..5403a33c 100644 --- a/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts @@ -9,9 +9,8 @@ import {MapService} from '../../map/map.service'; import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes,} from '../../../../../../common/entities/SearchQueryDTO'; import {AuthenticationService} from '../../../../model/network/authentication.service'; import {LatLngLiteral, marker, Marker, TileLayer, tileLayer} from 'leaflet'; -import {ContentService} from '../../content.service'; import {ThemeService} from '../../../../model/theme.service'; -import { ContentLoaderService } from '../../contentLoader.service'; +import {ContentLoaderService} from '../../contentLoader.service'; @Component({ selector: 'app-info-panel', diff --git a/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts index 813798f4..781867ae 100644 --- a/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts @@ -11,7 +11,6 @@ import {PageHelper} from '../../../model/page.helper'; import {QueryService} from '../../../model/query.service'; import {MediaDTO} from '../../../../../common/entities/MediaDTO'; import {QueryParams} from '../../../../../common/QueryParams'; -import {ContentService} from '../content.service'; import {PhotoDTO} from '../../../../../common/entities/PhotoDTO'; import {ControlsLightboxComponent} from './controls/controls.lightbox.gallery.component'; import {SupportedFormats} from '../../../../../common/SupportedFormats'; @@ -73,7 +72,6 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit { private builder: AnimationBuilder, private router: Router, private queryService: QueryService, - private galleryService: ContentService, private route: ActivatedRoute, private piTitleService: PiTitleService ) { @@ -105,7 +103,7 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit { this.infoPanelMaxWidth = 1000; this.updatePhotoFrameDim(); this.subscription.route = this.route.queryParams.subscribe( - (params: Params): any => { + (params: Params) => { if ( params[QueryParams.gallery.photo] && params[QueryParams.gallery.photo] !== '' diff --git a/src/frontend/app/ui/gallery/navigator/sorting.service.ts b/src/frontend/app/ui/gallery/navigator/sorting.service.ts index fa1a00ec..7a5330e2 100644 --- a/src/frontend/app/ui/gallery/navigator/sorting.service.ts +++ b/src/frontend/app/ui/gallery/navigator/sorting.service.ts @@ -1,6 +1,5 @@ import {Injectable} from '@angular/core'; import {DatePipe} from '@angular/common'; -import {NetworkService} from '../../../model/network/network.service'; import {GalleryCacheService} from '../cache.gallery.service'; import {BehaviorSubject, Observable} from 'rxjs'; import {Config} from '../../../../../common/config/public/Config'; @@ -23,7 +22,6 @@ export class GallerySortingService { private collator = new Intl.Collator(undefined, {numeric: true}); constructor( - private networkService: NetworkService, private galleryCacheService: GalleryCacheService, private galleryService: ContentLoaderService, private rndService: SeededRandomService, diff --git a/src/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.ts b/src/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.ts index 753c3515..19bde020 100644 --- a/src/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.ts +++ b/src/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.ts @@ -1,20 +1,15 @@ -import { Component, OnDestroy, OnInit, TemplateRef } from '@angular/core'; -import { ContentService } from '../content.service'; -import { ContentWrapper } from '../../../../../common/entities/ConentWrapper'; -import { Config } from '../../../../../common/config/public/Config'; -import { NotificationService } from '../../../model/notification.service'; -import { BsModalService } from 'ngx-bootstrap/modal'; -import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; -import { NetworkService } from '../../../model/network/network.service'; -import { Subscription } from 'rxjs'; -import { - SearchQueryDTO, - SearchQueryTypes, - TextSearch, -} from '../../../../../common/entities/SearchQueryDTO'; -import { ActivatedRoute, Params } from '@angular/router'; -import { QueryParams } from '../../../../../common/QueryParams'; -import { SearchQueryParserService } from '../search/search-query-parser.service'; +import {Component, OnDestroy, OnInit, TemplateRef} from '@angular/core'; +import {ContentWrapper} from '../../../../../common/entities/ConentWrapper'; +import {Config} from '../../../../../common/config/public/Config'; +import {NotificationService} from '../../../model/notification.service'; +import {BsModalService} from 'ngx-bootstrap/modal'; +import {BsModalRef} from 'ngx-bootstrap/modal/bs-modal-ref.service'; +import {NetworkService} from '../../../model/network/network.service'; +import {Subscription} from 'rxjs'; +import {SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../../../common/entities/SearchQueryDTO'; +import {ActivatedRoute, Params} from '@angular/router'; +import {QueryParams} from '../../../../../common/QueryParams'; +import {SearchQueryParserService} from '../search/search-query-parser.service'; import {ContentLoaderService} from '../contentLoader.service'; @Component({ @@ -95,7 +90,7 @@ export class RandomQueryBuilderGalleryComponent implements OnInit, OnDestroy { this.modalRef.hide(); } - this.modalRef = this.modalService.show(template, { class: 'modal-lg' }); + this.modalRef = this.modalService.show(template, {class: 'modal-lg'}); document.body.style.paddingRight = '0px'; this.onQueryChange(); return false; diff --git a/src/frontend/app/ui/gallery/search/search.gallery.component.ts b/src/frontend/app/ui/gallery/search/search.gallery.component.ts index a001ba94..a35cc8ac 100644 --- a/src/frontend/app/ui/gallery/search/search.gallery.component.ts +++ b/src/frontend/app/ui/gallery/search/search.gallery.component.ts @@ -1,16 +1,9 @@ import {Component, OnDestroy, TemplateRef} from '@angular/core'; import {AutoCompleteService} from './autocomplete.service'; import {ActivatedRoute, Params, Router, RouterLink} from '@angular/router'; -import {ContentService} from '../content.service'; import {Subscription} from 'rxjs'; -import {NavigationService} from '../../../model/navigation.service'; import {QueryParams} from '../../../../../common/QueryParams'; -import { - MetadataSearchQueryTypes, - SearchQueryDTO, - SearchQueryTypes, - TextSearch, -} from '../../../../../common/entities/SearchQueryDTO'; +import {MetadataSearchQueryTypes, SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../../../common/entities/SearchQueryDTO'; import {BsModalService} from 'ngx-bootstrap/modal'; import {BsModalRef} from 'ngx-bootstrap/modal/bs-modal-ref.service'; import {SearchQueryParserService} from './search-query-parser.service'; @@ -43,11 +36,8 @@ export class GallerySearchComponent implements OnDestroy { private saveSearchModalRef: BsModalRef; constructor( - private autoCompleteService: AutoCompleteService, private searchQueryParserService: SearchQueryParserService, - private galleryService: ContentService, private albumService: AlbumsService, - private navigationService: NavigationService, private route: ActivatedRoute, public router: Router, private modalService: BsModalService, diff --git a/src/frontend/app/ui/gallery/share/share.gallery.component.ts b/src/frontend/app/ui/gallery/share/share.gallery.component.ts index 374f213c..2707565e 100644 --- a/src/frontend/app/ui/gallery/share/share.gallery.component.ts +++ b/src/frontend/app/ui/gallery/share/share.gallery.component.ts @@ -1,7 +1,6 @@ import {Component, Input, OnDestroy, OnInit, TemplateRef} from '@angular/core'; import {Utils} from '../../../../../common/Utils'; import {ShareService} from '../share.service'; -import {ContentService} from '../content.service'; import {ContentWrapper} from '../../../../../common/entities/ConentWrapper'; import {SharingDTO} from '../../../../../common/entities/SharingDTO'; import {Config} from '../../../../../common/config/public/Config';