Add “Unassigned” shelf view for books not in any shelf

This commit is contained in:
adityachandelgit
2025-05-15 21:11:33 -06:00
committed by Aditya Chandel
parent 22f10d0475
commit 4cb82d2ba7
6 changed files with 74 additions and 30 deletions
@@ -57,20 +57,32 @@ export class AppMenuComponent implements OnInit {
);
this.shelfMenu$ = this.shelfService.shelfState$.pipe(
map((state) => [
{
label: 'Shelves',
separator: false,
items: state.shelves?.map((shelf) => ({
menu: this.libraryShelfMenuService.initializeShelfMenuItems(shelf),
label: shelf.name,
type: 'Shelf',
icon: 'pi pi-' + shelf.icon,
routerLink: [`/shelf/${shelf.id}/books`],
bookCount$: this.shelfService.getBookCount(shelf.id ?? 0),
})) || [],
},
])
map((state) => {
const shelves = state.shelves?.map((shelf) => ({
menu: this.libraryShelfMenuService.initializeShelfMenuItems(shelf),
label: shelf.name,
type: 'Shelf',
icon: 'pi pi-' + shelf.icon,
routerLink: [`/shelf/${shelf.id}/books`],
bookCount$: this.shelfService.getBookCount(shelf.id ?? 0),
})) || [];
const unshelvedItem = {
label: 'Unshelved',
type: 'Shelf',
icon: 'pi pi-inbox',
routerLink: ['/unshelved-books'],
bookCount$: this.shelfService.getUnshelvedBookCount?.() ?? of(0),
};
return [
{
label: 'Shelves',
separator: false,
items: [unshelvedItem, ...shelves],
},
];
})
);
this.homeMenu$ = this.bookService.bookState$.pipe(