Improve live notification

This commit is contained in:
aditya.chandel
2025-01-12 15:26:09 -07:00
parent e603333c08
commit 6bcb10b292
8 changed files with 67 additions and 102 deletions
@@ -20,32 +20,31 @@
<div class="topbar-right-items">
<app-book-searcher></app-book-searcher>
<ul class="topbar-items">
<div class="flex gap-6">
<li>
<a class="topbar-item">
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
pTooltip="Create New Library" tooltipPosition="top"></i>
</a>
</li>
<li>
<a class="topbar-item">
<i class="pi pi-upload text-surface-700 dark:text-surface-100" (click)="openFileUploadDialog()"
pTooltip="Upload book" tooltipPosition="top"></i>
</a>
</li>
</div>
<p-divider layout="vertical" />
<li>
<i class="pi pi-wave-pulse" style="font-size: 1.5rem"
(click)="toggleEventDisplay()"
(mouseenter)="onMouseEnter()"
(mouseleave)="onMouseLeave()"
[class.pulsating]="eventHighlight"
[class.highlight]="eventHighlight"></i>
<div *ngIf="showEvents" class="live-event-container" (mouseleave)="onMouseLeave()">
<p *ngIf="latestEvent.timestamp">{{ latestEvent.timestamp }}</p>
<p>{{ latestEvent.message }}</p>
</div>
<li class="relative">
<button type="button" class="topbar-item" enterActiveClass="animate-scalein" enterFromClass="hidden" leaveActiveClass="animate-fadeout" leaveToClass="hidden" pStyleClass="@next" [hideOnOutsideClick]="true">
<i class="pi pi-wave-pulse" style="font-size: 1.5rem"
[class.pulsating]="eventHighlight"
[class.highlight]="eventHighlight"></i>
</button>
<app-live-notification-box class="config-panel notification-box"></app-live-notification-box>
</li>
<p-divider layout="vertical" />
<li>
<a class="topbar-item">
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
pTooltip="Create New Library" tooltipPosition="top"></i>
</a>
</li>
<li>
<a class="topbar-item">
<i class="pi pi-upload text-surface-700 dark:text-surface-100" (click)="openFileUploadDialog()"
pTooltip="Upload book" tooltipPosition="top"></i>
</a>
</li>
<li class="relative">
<button type="button" class="topbar-item config-item" enterActiveClass="animate-scalein" enterFromClass="hidden" leaveActiveClass="animate-fadeout" leaveToClass="hidden" pStyleClass="@next" [hideOnOutsideClick]="true">
<i class="pi pi-palette"></i>
@@ -1,18 +1,3 @@
.live-event-container {
position: absolute;
top: 43px;
right: -180px;
width: 500px;
background: var(--card-background);
border: 0.5px solid var(--primary-color);
border-radius: 4px;
padding: 12px;
overflow-x: hidden;
/*z-index: 1000;*/
word-wrap: break-word;
white-space: normal;
}
.highlight {
color: red !important;
}
@@ -9,13 +9,14 @@ import {FormsModule} from '@angular/forms';
import {InputTextModule} from 'primeng/inputtext';
import {BookSearcherComponent} from '../../../book/components/book-searcher/book-searcher.component';
import {FileUploadComponent} from '../../../utilities/component/file-upload/file-upload.component';
import {NgClass, NgIf} from '@angular/common';
import {NgClass} from '@angular/common';
import {EventService} from '../../../shared/websocket/event.service';
import {LogNotification} from '../../../shared/websocket/model/log-notification.model';
import {Button} from 'primeng/button';
import {StyleClass} from 'primeng/styleclass';
import {Divider} from 'primeng/divider';
import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurator.component';
import {LiveNotificationBoxComponent} from '../../../live-notification-box/live-notification-box.component';
@Component({
selector: 'app-topbar',
@@ -27,19 +28,18 @@ import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurat
FormsModule,
InputTextModule,
BookSearcherComponent,
NgIf,
Button,
ThemeConfiguratorComponent,
StyleClass,
NgClass,
Divider
Divider,
LiveNotificationBoxComponent
],
})
export class AppTopBarComponent implements OnDestroy {
items!: MenuItem[];
ref: DynamicDialogRef | undefined;
latestEvent: LogNotification = {message: 'No recent notifications...'};
eventHighlight: boolean = false;
showEvents: boolean = false;
eventTimeout: any;
@@ -49,9 +49,6 @@ export class AppTopBarComponent implements OnDestroy {
@ViewChild('topbarmenu') menu!: ElementRef;
constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService, private eventService: EventService) {
this.eventService.latestEvent$.subscribe(event => {
this.latestEvent = event;
});
this.eventService.eventHighlight$.subscribe(highlight => {
this.eventHighlight = highlight;
});
@@ -32,7 +32,7 @@
<div class="config-panel-settings">
<span class="config-panel-label">Presets</span>
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small"/>
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small"></p-selectbutton>
</div>
<div class="flex">
<div class="flex-1">