Add entity type to title.
Todo: Fix menu.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div class="library-header">
|
||||
<div class="library-header-dial">
|
||||
<h3 class="library-name">{{ (entity$ | async)?.name }}</h3>
|
||||
<h3 class="library-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h3>
|
||||
<p-speedDial
|
||||
[model]="items!"
|
||||
direction="right"
|
||||
|
||||
@@ -20,6 +20,7 @@ export class BooksBrowserComponent implements OnInit {
|
||||
|
||||
books$: Observable<Book[]> | undefined;
|
||||
entity$: Observable<Library | Shelf | null> | undefined;
|
||||
entityType$: Observable<string | null> | undefined;
|
||||
items: MenuItem[] | undefined;
|
||||
|
||||
constructor(
|
||||
@@ -38,8 +39,6 @@ export class BooksBrowserComponent implements OnInit {
|
||||
map(params => {
|
||||
const libraryId = Number(params.get('libraryId'));
|
||||
const shelfId = Number(params.get('shelfId'));
|
||||
|
||||
console.log(shelfId + '---' + libraryId)
|
||||
return {libraryId, shelfId};
|
||||
})
|
||||
);
|
||||
@@ -75,6 +74,18 @@ export class BooksBrowserComponent implements OnInit {
|
||||
})
|
||||
);
|
||||
|
||||
this.entityType$ = routeParam$.pipe(
|
||||
switchMap(({libraryId, shelfId}) => {
|
||||
if (!isNaN(libraryId) && libraryId !== 0) {
|
||||
return of('Library');
|
||||
} else if (!isNaN(shelfId) && shelfId !== 0) {
|
||||
return of('Shelf');
|
||||
}
|
||||
return of(null);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
//this.initializeMenuItems();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user