1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing constantly updating navigator bar. This should fix the button not working problem for IOS #493

This commit is contained in:
Patrik J. Braun 2022-12-18 10:09:34 +01:00
parent f2504f60d2
commit 48a1900fc6
2 changed files with 68 additions and 66 deletions

View File

@ -2,7 +2,7 @@
<nav class="d-md-flex row" aria-label="breadcrumb"> <nav class="d-md-flex row" aria-label="breadcrumb">
<div class="col-12 col-md-auto"> <div class="col-12 col-md-auto">
<ol *ngIf="isDirectory" id="directory-path" class="mb-0 mt-1 breadcrumb"> <ol *ngIf="isDirectory" id="directory-path" class="mb-0 mt-1 breadcrumb">
<li *ngFor="let path of Routes" class="breadcrumb-item"> <li *ngFor="let path of routes | async" class="breadcrumb-item">
<a *ngIf="path.route" [routerLink]="['/gallery',path.route]" <a *ngIf="path.route" [routerLink]="['/gallery',path.route]"
[queryParams]="queryService.getParams()">{{path.name}}</a> [queryParams]="queryService.getParams()">{{path.name}}</a>
<ng-container *ngIf="!path.route">{{path.name}}</ng-container> <ng-container *ngIf="!path.route">{{path.name}}</ng-container>
@ -77,4 +77,4 @@
</div> </div>
<app-gallery-filter *ngIf="showFilters && ItemCount> 0"></app-gallery-filter> <app-gallery-filter *ngIf="showFilters && ItemCount> 0"></app-gallery-filter>

View File

@ -34,6 +34,7 @@ export class GalleryNavigatorComponent {
public readonly SearchQueryTypes = SearchQueryTypes; public readonly SearchQueryTypes = SearchQueryTypes;
public wrappedContent: Observable<ContentWrapperWithError>; public wrappedContent: Observable<ContentWrapperWithError>;
public directoryContent: Observable<DirectoryContent>; public directoryContent: Observable<DirectoryContent>;
public routes: Observable<NavigatorPath[]>;
public showFilters = false; public showFilters = false;
private readonly RootFolderName: string; private readonly RootFolderName: string;
@ -49,23 +50,8 @@ export class GalleryNavigatorComponent {
this.directoryContent = this.wrappedContent.pipe( this.directoryContent = this.wrappedContent.pipe(
map((c) => (c.directory ? c.directory : c.searchResult)) map((c) => (c.directory ? c.directory : c.searchResult))
); );
} this.routes = this.galleryService.content.pipe(
map((c) => {
get isDirectory(): boolean {
return !!this.galleryService.content.value.directory;
}
get ItemCount(): number {
const c = this.galleryService.content.value;
return c.directory
? c.directory.mediaCount
: c.searchResult
? c.searchResult.media.length
: 0;
}
get Routes(): NavigatorPath[] {
const c = this.galleryService.content.value;
if (!c.directory) { if (!c.directory) {
return []; return [];
} }
@ -114,6 +100,22 @@ export class GalleryNavigatorComponent {
}); });
return arr; return arr;
})
);
}
get isDirectory(): boolean {
return !!this.galleryService.content.value.directory;
}
get ItemCount(): number {
const c = this.galleryService.content.value;
return c.directory
? c.directory.mediaCount
: c.searchResult
? c.searchResult.media.length
: 0;
} }
get DefaultSorting(): SortingMethods { get DefaultSorting(): SortingMethods {