Introduce reading session tracking with visual insights (#1957)
* Introduce reading session tracking with visual insights (#1957) --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -53,9 +53,14 @@
|
||||
</li>
|
||||
}
|
||||
<li>
|
||||
<a class="topbar-item" (click)="navigateToStats()" pTooltip="Stats" tooltipPosition="bottom">
|
||||
<button
|
||||
class="topbar-item"
|
||||
(click)="statsMenu.toggle($event)"
|
||||
pTooltip="Stats"
|
||||
tooltipPosition="bottom">
|
||||
<i class="pi pi-chart-bar text-surface-100"></i>
|
||||
</a>
|
||||
</button>
|
||||
<p-menu #statsMenu [model]="statsMenuItems" [popup]="true" appendTo="body" />
|
||||
</li>
|
||||
@if (userService.userState$ | async; as userState) {
|
||||
<li>
|
||||
@@ -192,11 +197,12 @@
|
||||
<li>
|
||||
<button
|
||||
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
|
||||
(click)="navigateToStats(); mobileMenu.hide()"
|
||||
(click)="statsMenu.toggle($event)"
|
||||
>
|
||||
<i class="pi pi-chart-bar text-surface-100"></i>
|
||||
Charts
|
||||
</button>
|
||||
<p-menu #statsMenuMobile [model]="statsMenuItems" [popup]="true" />
|
||||
</li>
|
||||
<li>
|
||||
<button
|
||||
|
||||
@@ -24,6 +24,7 @@ import {BookdropFileService} from '../../../../features/bookdrop/service/bookdro
|
||||
import {DialogLauncherService} from '../../../services/dialog-launcher.service';
|
||||
import {UnifiedNotificationBoxComponent} from '../../../components/unified-notification-popover/unified-notification-popover-component';
|
||||
import {Severity, LogNotification} from '../../../websocket/model/log-notification.model';
|
||||
import {Menu} from 'primeng/menu';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topbar',
|
||||
@@ -45,11 +46,13 @@ import {Severity, LogNotification} from '../../../websocket/model/log-notificati
|
||||
Popover,
|
||||
UnifiedNotificationBoxComponent,
|
||||
NgStyle,
|
||||
Menu,
|
||||
],
|
||||
})
|
||||
export class AppTopBarComponent implements OnDestroy {
|
||||
items!: MenuItem[];
|
||||
ref?: DynamicDialogRef;
|
||||
statsMenuItems: MenuItem[] = [];
|
||||
|
||||
@ViewChild('menubutton') menuButton!: ElementRef;
|
||||
@ViewChild('topbarmenubutton') topbarMenuButton!: ElementRef;
|
||||
@@ -80,6 +83,7 @@ export class AppTopBarComponent implements OnDestroy {
|
||||
private bookdropFileService: BookdropFileService,
|
||||
private dialogLauncher: DialogLauncherService
|
||||
) {
|
||||
this.initializeStatsMenu();
|
||||
this.subscribeToMetadataProgress();
|
||||
this.subscribeToNotifications();
|
||||
|
||||
@@ -143,7 +147,11 @@ export class AppTopBarComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
navigateToStats() {
|
||||
this.router.navigate(['/stats']);
|
||||
this.router.navigate(['/library-stats']);
|
||||
}
|
||||
|
||||
navigateToUserStats() {
|
||||
this.router.navigate(['/reading-stats']);
|
||||
}
|
||||
|
||||
logout() {
|
||||
@@ -191,6 +199,21 @@ export class AppTopBarComponent implements OnDestroy {
|
||||
this.hasActiveOrCompletedTasks = this.hasActiveOrCompletedTasks || this.hasPendingBookdropFiles;
|
||||
}
|
||||
|
||||
private initializeStatsMenu() {
|
||||
this.statsMenuItems = [
|
||||
{
|
||||
label: 'Library Stats',
|
||||
icon: 'pi pi-chart-line',
|
||||
command: () => this.navigateToStats()
|
||||
},
|
||||
{
|
||||
label: 'Reading Stats',
|
||||
icon: 'pi pi-users',
|
||||
command: () => this.navigateToUserStats()
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
get iconClass(): string {
|
||||
if (this.progressHighlight) return 'pi-spinner spin';
|
||||
if (this.iconPulsating) return 'pi-wave-pulse';
|
||||
|
||||
Reference in New Issue
Block a user