fix(ui): add missing page titles (#2073)
This commit is contained in:
+2
@@ -13,6 +13,7 @@ import {Book} from '../../../book/model/book.model';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {BookMetadataCenterComponent} from './book-metadata-center.component';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
describe('BookMetadataCenterComponent', () => {
|
||||
let appSettingsSignal: WritableSignal<AppSettings | null>;
|
||||
@@ -55,6 +56,7 @@ describe('BookMetadataCenterComponent', () => {
|
||||
{provide: UserService, useValue: {currentUser: currentUserSignal}},
|
||||
{provide: AppSettingsService, useValue: {appSettings: appSettingsSignal}},
|
||||
{provide: BookMetadataHostService, useValue: {bookSwitches$: new Subject<number>()}},
|
||||
{provide: TranslocoService, useValue: {translate: (key: string) => key}},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
+7
-1
@@ -10,13 +10,14 @@ import {Tab, TabList, TabPanel, TabPanels, Tabs,} from '@openng/optimus-ui/tabs'
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from '@openng/optimus-ui/dynamicdialog';
|
||||
import {Button} from '@openng/optimus-ui/button';
|
||||
import {BookMetadataHostService} from '../../../../shared/service/book-metadata-host.service';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {MetadataViewerComponent} from './metadata-viewer/metadata-viewer.component';
|
||||
import {MetadataEditorComponent} from './metadata-editor/metadata-editor.component';
|
||||
import {MetadataSearcherComponent} from './metadata-searcher/metadata-searcher.component';
|
||||
import {SidecarViewerComponent} from './sidecar-viewer/sidecar-viewer.component';
|
||||
import {injectQuery, queryOptions} from '@tanstack/angular-query-experimental';
|
||||
import {bookRecommendationsQueryKey} from '../../../book/service/book-query-keys';
|
||||
import {PageTitleService} from '../../../../shared/service/page-title.service';
|
||||
|
||||
enum BookMetadataTab {
|
||||
View = 'view',
|
||||
@@ -52,6 +53,8 @@ export class BookMetadataCenterComponent implements OnInit {
|
||||
private appSettingsService = inject(AppSettingsService);
|
||||
private metadataHostService = inject(BookMetadataHostService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
private pageTitle = inject(PageTitleService);
|
||||
private t = inject(TranslocoService);
|
||||
readonly config = inject(DynamicDialogConfig, {optional: true});
|
||||
readonly ref = inject(DynamicDialogRef, {optional: true});
|
||||
BookMetadataTab = BookMetadataTab;
|
||||
@@ -128,6 +131,9 @@ export class BookMetadataCenterComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.config) {
|
||||
this.pageTitle.setPageTitle(this.t.translate('metadata.center.title'));
|
||||
}
|
||||
const bookIdFromDialog: number | undefined = this.config?.data?.bookId;
|
||||
if (bookIdFromDialog != null) {
|
||||
this.currentBookId.set(bookIdFromDialog);
|
||||
|
||||
@@ -35,6 +35,7 @@ import {TranslocoPipe} from '@jsverse/transloco';
|
||||
import {RelocateProgressData} from './state/progress.service';
|
||||
import {WakeLockService} from '../../../shared/service/wake-lock.service';
|
||||
import {ViewEvent} from './core/view-manager.service';
|
||||
import {PageTitleService} from '../../../shared/service/page-title.service';
|
||||
|
||||
interface PendingInitialChapterRestore {
|
||||
href: string;
|
||||
@@ -96,6 +97,7 @@ export class EbookReaderComponent implements OnInit {
|
||||
private noteService = inject(ReaderNoteService);
|
||||
private wakeLockService = inject(WakeLockService);
|
||||
private messageService = inject(MessageService);
|
||||
private pageTitle = inject(PageTitleService);
|
||||
|
||||
public sidebarService = inject(ReaderSidebarService);
|
||||
public leftSidebarService = inject(ReaderLeftSidebarService);
|
||||
@@ -214,6 +216,7 @@ export class EbookReaderComponent implements OnInit {
|
||||
]).pipe(
|
||||
switchMap(([, book]) => {
|
||||
this.book.set(book);
|
||||
this.pageTitle.setBookPageTitle(book);
|
||||
const bookType = (this.altBookType as BookType | undefined) ?? book.primaryFile?.bookType;
|
||||
if (!bookType) {
|
||||
return throwError(() => new Error('Book type not found'));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, computed, inject} from '@angular/core';
|
||||
import {Component, computed, inject, OnInit} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {CdkDragDrop, DragDropModule, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||
import {Select} from '@openng/optimus-ui/select';
|
||||
@@ -18,6 +18,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {LibraryService} from '../../../book/service/library.service';
|
||||
import {StatsChartThemeService} from '../shared/stats-chart-theme.service';
|
||||
import {PageTitleService} from '../../../../shared/service/page-title.service';
|
||||
|
||||
interface ChartConfig {
|
||||
id: string;
|
||||
@@ -51,13 +52,14 @@ import {provideCharts, withDefaultRegisterables} from 'ng2-charts';
|
||||
templateUrl: './library-stats.component.html',
|
||||
styleUrls: ['./library-stats.component.scss']
|
||||
})
|
||||
export class LibraryStatsComponent {
|
||||
export class LibraryStatsComponent implements OnInit {
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly librariesSummaryService = inject(LibrariesSummaryService);
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryService = inject(LibraryService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly chartTheme = inject(StatsChartThemeService);
|
||||
private readonly pageTitle = inject(PageTitleService);
|
||||
|
||||
public readonly isLoading = computed(() =>
|
||||
this.bookService.isBooksLoading() || this.libraryService.isLibrariesLoading()
|
||||
@@ -83,6 +85,10 @@ export class LibraryStatsComponent {
|
||||
this.chartTheme.activate();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pageTitle.setPageTitle(this.t.translate('statsLibrary.main.title'));
|
||||
}
|
||||
|
||||
onLibraryChange(selectedLibrary: LibraryOption | null): void {
|
||||
if (!selectedLibrary) {
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {UserChartConfigService} from './service/user-chart-config.service';
|
||||
import {UserStatsComponent} from './user-stats.component';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
describe('UserStatsComponent', () => {
|
||||
let chartConfigService: {
|
||||
@@ -38,6 +39,7 @@ describe('UserStatsComponent', () => {
|
||||
},
|
||||
},
|
||||
{provide: UserChartConfigService, useValue: chartConfigService},
|
||||
{provide: TranslocoService, useValue: {translate: (key: string) => key }},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Component, computed, inject, signal} from '@angular/core';
|
||||
import {Component, computed, inject, OnInit, signal} from '@angular/core';
|
||||
import {CdkDragDrop, DragDropModule} from '@angular/cdk/drag-drop';
|
||||
import {Dialog} from '@openng/optimus-ui/dialog';
|
||||
import {Button} from '@openng/optimus-ui/button';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {PeakHoursChartComponent} from './charts/peak-hours-chart/peak-hours-chart.component';
|
||||
import {FavoriteDaysChartComponent} from './charts/favorite-days-chart/favorite-days-chart.component';
|
||||
import {ReadingDNAChartComponent} from './charts/reading-dna-chart/reading-dna-chart.component';
|
||||
@@ -29,8 +29,8 @@ import {PublicationEraChartComponent} from './charts/publication-era-chart/publi
|
||||
import {SessionArchetypesChartComponent} from './charts/session-archetypes-chart/session-archetypes-chart.component';
|
||||
import {UserChartConfig, UserChartConfigService} from './service/user-chart-config.service';
|
||||
import {StatsChartThemeService} from '../shared/stats-chart-theme.service';
|
||||
|
||||
import {provideCharts, withDefaultRegisterables} from 'ng2-charts';
|
||||
import {PageTitleService} from '../../../../shared/service/page-title.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-stats',
|
||||
@@ -68,10 +68,12 @@ import {provideCharts, withDefaultRegisterables} from 'ng2-charts';
|
||||
templateUrl: './user-stats.component.html',
|
||||
styleUrls: ['./user-stats.component.scss']
|
||||
})
|
||||
export class UserStatsComponent {
|
||||
export class UserStatsComponent implements OnInit {
|
||||
private userService = inject(UserService);
|
||||
private chartConfigService = inject(UserChartConfigService);
|
||||
private readonly chartTheme = inject(StatsChartThemeService);
|
||||
private readonly pageTitle = inject(PageTitleService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
public currentYear = new Date().getFullYear();
|
||||
public readonly userName = computed(() => {
|
||||
@@ -86,6 +88,10 @@ export class UserStatsComponent {
|
||||
this.chartTheme.activate();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pageTitle.setPageTitle(this.t.translate('statsUser.main.titleBarTitle'))
|
||||
}
|
||||
|
||||
toggleChart(chartId: string): void {
|
||||
this.chartConfigService.toggleChart(chartId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "",
|
||||
"titleBarTitle": "",
|
||||
"customizeLayout": "",
|
||||
"chartConfig": "",
|
||||
"resetLayout": "",
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
"close": "",
|
||||
"customizeLayout": "",
|
||||
"title": "",
|
||||
"titleBarTitle": "",
|
||||
"hideAll": "",
|
||||
"showAll": ""
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}s Lesestatistiken",
|
||||
"titleBarTitle": "Lesestatistiken",
|
||||
"customizeLayout": "Layout anpassen",
|
||||
"chartConfig": "Diagrammkonfiguration",
|
||||
"resetLayout": "Layout zurücksetzen",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}'s Reading Statistics",
|
||||
"titleBarTitle": "Reading Statistics",
|
||||
"customizeLayout": "Customize Layout",
|
||||
"chartConfig": "Chart Configuration",
|
||||
"resetLayout": "Reset Layout",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Estadísticas de lectura de {{ name }}",
|
||||
"titleBarTitle": "Estadísticas de lectura",
|
||||
"customizeLayout": "Personalizar diseño",
|
||||
"chartConfig": "Configuración de gráficos",
|
||||
"resetLayout": "Restablecer diseño",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Statistiques de lecture de {{ name }}",
|
||||
"titleBarTitle": "Statistiques de lecture",
|
||||
"customizeLayout": "Personnaliser la disposition",
|
||||
"chartConfig": "Configuration des graphiques",
|
||||
"resetLayout": "Réinitialiser la disposition",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Statistika čitanja korisnika {{ name }}",
|
||||
"titleBarTitle": "Statistika čitanja",
|
||||
"customizeLayout": "Prilagodi raspored",
|
||||
"chartConfig": "Konfiguracija grafikona",
|
||||
"resetLayout": "Vrati raspored",
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
"close": "",
|
||||
"customizeLayout": "",
|
||||
"title": "",
|
||||
"titleBarTitle": "",
|
||||
"hideAll": "",
|
||||
"showAll": ""
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Statistik Bacaan {{ name }}",
|
||||
"titleBarTitle": "Statistik Bacaan",
|
||||
"chartConfig": "Konfigurasi Bagan",
|
||||
"close": "Tutup",
|
||||
"resetLayout": "",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Statistiche di lettura di {{ name }}",
|
||||
"titleBarTitle": "Statistiche di lettura",
|
||||
"customizeLayout": "Personalizza layout",
|
||||
"chartConfig": "Configurazione grafici",
|
||||
"resetLayout": "Ripristina layout",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}さんの読書統計",
|
||||
"titleBarTitle": "統計情報の読み方",
|
||||
"customizeLayout": "レイアウトをカスタマイズ",
|
||||
"chartConfig": "チャート設定",
|
||||
"resetLayout": "レイアウトをリセット",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "",
|
||||
"titleBarTitle": "",
|
||||
"customizeLayout": "",
|
||||
"chartConfig": "",
|
||||
"resetLayout": "",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}'s Lees Statistieken",
|
||||
"titleBarTitle": "Lees Statistieken",
|
||||
"customizeLayout": "Lay-out aanpassen",
|
||||
"resetLayout": "Lay-out opnieuw instellen",
|
||||
"hideAll": "Alles verbergen",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Statystyki czytania {{ name }}",
|
||||
"titleBarTitle": "Statystyki czytania",
|
||||
"customizeLayout": "Dostosuj układ",
|
||||
"chartConfig": "Konfiguracja wykresów",
|
||||
"resetLayout": "Resetuj układ",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Estatísticas de Leitura de {{ name }}",
|
||||
"titleBarTitle": "Estatísticas de Leitura",
|
||||
"customizeLayout": "Personalizar Layout",
|
||||
"chartConfig": "Configuração de Gráficos",
|
||||
"resetLayout": "Redefinir Layout",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Статистика чтения {{ name }}",
|
||||
"titleBarTitle": "Статистика чтения",
|
||||
"customizeLayout": "Настроить макет",
|
||||
"chartConfig": "Настройка графиков",
|
||||
"resetLayout": "Сбросить макет",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Štatistiky čítania používateľa {{ name }}",
|
||||
"titleBarTitle": "Štatistiky čítania",
|
||||
"customizeLayout": "Uprav rozloženie",
|
||||
"chartConfig": "",
|
||||
"resetLayout": "",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Bralna statistika uporabnika {{ name }}",
|
||||
"titleBarTitle": "Bralna statistika",
|
||||
"customizeLayout": "Prilagodi postavitev",
|
||||
"chartConfig": "Konfiguracija grafov",
|
||||
"resetLayout": "Ponastavi postavitev",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}s lasstatistik",
|
||||
"titleBarTitle": "Lässtatistik",
|
||||
"customizeLayout": "Anpassa layout",
|
||||
"chartConfig": "Diagramkonfiguration",
|
||||
"resetLayout": "Aterstall layout",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Статистика читання {{ name }}",
|
||||
"titleBarTitle": "Статистика читання",
|
||||
"customizeLayout": "Налаштувати макет",
|
||||
"chartConfig": "Налаштування графіків",
|
||||
"resetLayout": "Скинути макет",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }} 的阅读统计",
|
||||
"titleBarTitle": "的阅读统计",
|
||||
"customizeLayout": "自定义布局",
|
||||
"chartConfig": "图表配置",
|
||||
"resetLayout": "重置布局",
|
||||
|
||||
Reference in New Issue
Block a user