Add author metadata fetching via Audnexus with browser, detail, and editor pages (#2843)
This commit is contained in:
@@ -13,6 +13,7 @@ import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {UserService} from '../../../../features/settings/user-management/user.service';
|
||||
import {MagicShelfService, MagicShelfState} from '../../../../features/magic-shelf/service/magic-shelf.service';
|
||||
import {SeriesDataService} from '../../../../features/series-browser/service/series-data.service';
|
||||
import {AuthorService} from '../../../../features/author-browser/service/author.service';
|
||||
import {MenuItem} from 'primeng/api';
|
||||
import {DialogLauncherService} from '../../../services/dialog-launcher.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
@@ -46,6 +47,7 @@ export class AppMenuComponent implements OnInit {
|
||||
private userService = inject(UserService);
|
||||
private magicShelfService = inject(MagicShelfService);
|
||||
private seriesDataService = inject(SeriesDataService);
|
||||
private authorService = inject(AuthorService);
|
||||
private t = inject(TranslocoService);
|
||||
private localStorageService = inject(LocalStorageService);
|
||||
|
||||
@@ -65,6 +67,8 @@ export class AppMenuComponent implements OnInit {
|
||||
this.versionInfo = data;
|
||||
});
|
||||
|
||||
this.authorService.getAllAuthors().subscribe();
|
||||
|
||||
this.userService.userState$.pipe(
|
||||
filter(userState => !!userState?.user && userState.loaded))
|
||||
.subscribe(userState => {
|
||||
@@ -107,6 +111,13 @@ export class AppMenuComponent implements OnInit {
|
||||
routerLink: ['/series'],
|
||||
bookCount$: this.seriesDataService.allSeries$.pipe(map(series => series.length)),
|
||||
},
|
||||
{
|
||||
label: this.t.translate('layout.menu.authors'),
|
||||
type: 'Authors',
|
||||
icon: 'pi pi-fw pi-users',
|
||||
routerLink: ['/authors'],
|
||||
bookCount$: this.authorService.allAuthors$.pipe(map(authors => authors?.length ?? 0)),
|
||||
},
|
||||
{
|
||||
label: this.t.translate('layout.menu.notebook'),
|
||||
icon: 'pi pi-fw pi-pencil',
|
||||
|
||||
@@ -83,9 +83,9 @@
|
||||
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
|
||||
@if (item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.type === 'Series' || item.label === 'Unshelved' || item.label === 'Kobo') {
|
||||
@if (item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.type === 'Series' || item.type === 'Authors' || item.label === 'Unshelved' || item.label === 'Kobo') {
|
||||
<p class="book-count">
|
||||
{{ (item.bookCount$ | async)?.toString() || '0' }}
|
||||
{{ formatCount(item.bookCount$ | async) }}
|
||||
</p>
|
||||
}
|
||||
</span>
|
||||
|
||||
@@ -177,6 +177,12 @@ export class AppMenuitemComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
formatCount(count: number | null | undefined): string {
|
||||
if (count == null) return '0';
|
||||
if (count >= 1000) return Math.floor(count / 1000) + 'K';
|
||||
return count.toString();
|
||||
}
|
||||
|
||||
getIconSelection(): IconSelection | null {
|
||||
if (!this.item.icon) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user