Improve live notification
This commit is contained in:
@@ -20,20 +20,7 @@
|
|||||||
<div class="topbar-right-items">
|
<div class="topbar-right-items">
|
||||||
<app-book-searcher></app-book-searcher>
|
<app-book-searcher></app-book-searcher>
|
||||||
<ul class="topbar-items">
|
<ul class="topbar-items">
|
||||||
<p-divider layout="vertical" />
|
<div class="flex gap-6">
|
||||||
<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>
|
|
||||||
<p-divider layout="vertical" />
|
|
||||||
<li>
|
<li>
|
||||||
<a class="topbar-item">
|
<a class="topbar-item">
|
||||||
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
|
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
|
||||||
@@ -46,6 +33,18 @@
|
|||||||
pTooltip="Upload book" tooltipPosition="top"></i>
|
pTooltip="Upload book" tooltipPosition="top"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p-divider layout="vertical" />
|
||||||
|
<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 class="relative">
|
<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">
|
<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>
|
<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 {
|
.highlight {
|
||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ import {FormsModule} from '@angular/forms';
|
|||||||
import {InputTextModule} from 'primeng/inputtext';
|
import {InputTextModule} from 'primeng/inputtext';
|
||||||
import {BookSearcherComponent} from '../../../book/components/book-searcher/book-searcher.component';
|
import {BookSearcherComponent} from '../../../book/components/book-searcher/book-searcher.component';
|
||||||
import {FileUploadComponent} from '../../../utilities/component/file-upload/file-upload.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 {EventService} from '../../../shared/websocket/event.service';
|
||||||
import {LogNotification} from '../../../shared/websocket/model/log-notification.model';
|
import {LogNotification} from '../../../shared/websocket/model/log-notification.model';
|
||||||
import {Button} from 'primeng/button';
|
import {Button} from 'primeng/button';
|
||||||
import {StyleClass} from 'primeng/styleclass';
|
import {StyleClass} from 'primeng/styleclass';
|
||||||
import {Divider} from 'primeng/divider';
|
import {Divider} from 'primeng/divider';
|
||||||
import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurator.component';
|
import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurator.component';
|
||||||
|
import {LiveNotificationBoxComponent} from '../../../live-notification-box/live-notification-box.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-topbar',
|
selector: 'app-topbar',
|
||||||
@@ -27,19 +28,18 @@ import {ThemeConfiguratorComponent} from '../theme-configurator/theme-configurat
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
InputTextModule,
|
InputTextModule,
|
||||||
BookSearcherComponent,
|
BookSearcherComponent,
|
||||||
NgIf,
|
|
||||||
Button,
|
Button,
|
||||||
ThemeConfiguratorComponent,
|
ThemeConfiguratorComponent,
|
||||||
StyleClass,
|
StyleClass,
|
||||||
NgClass,
|
NgClass,
|
||||||
Divider
|
Divider,
|
||||||
|
LiveNotificationBoxComponent
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppTopBarComponent implements OnDestroy {
|
export class AppTopBarComponent implements OnDestroy {
|
||||||
items!: MenuItem[];
|
items!: MenuItem[];
|
||||||
ref: DynamicDialogRef | undefined;
|
ref: DynamicDialogRef | undefined;
|
||||||
|
|
||||||
latestEvent: LogNotification = {message: 'No recent notifications...'};
|
|
||||||
eventHighlight: boolean = false;
|
eventHighlight: boolean = false;
|
||||||
showEvents: boolean = false;
|
showEvents: boolean = false;
|
||||||
eventTimeout: any;
|
eventTimeout: any;
|
||||||
@@ -49,9 +49,6 @@ export class AppTopBarComponent implements OnDestroy {
|
|||||||
@ViewChild('topbarmenu') menu!: ElementRef;
|
@ViewChild('topbarmenu') menu!: ElementRef;
|
||||||
|
|
||||||
constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService, private eventService: EventService) {
|
constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService, private eventService: EventService) {
|
||||||
this.eventService.latestEvent$.subscribe(event => {
|
|
||||||
this.latestEvent = event;
|
|
||||||
});
|
|
||||||
this.eventService.eventHighlight$.subscribe(highlight => {
|
this.eventService.eventHighlight$.subscribe(highlight => {
|
||||||
this.eventHighlight = highlight;
|
this.eventHighlight = highlight;
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="config-panel-settings">
|
<div class="config-panel-settings">
|
||||||
<span class="config-panel-label">Presets</span>
|
<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>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div class="flex flex-col min-w-20">
|
||||||
|
<p>{{latestEvent.timestamp}}</p>
|
||||||
|
<p>{{latestEvent.message}}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import {Component, Input} from '@angular/core';
|
||||||
|
import {LogNotification} from '../shared/websocket/model/log-notification.model';
|
||||||
|
import {EventService} from '../shared/websocket/event.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-live-notification-box',
|
||||||
|
standalone: true,
|
||||||
|
templateUrl: './live-notification-box.component.html',
|
||||||
|
styleUrl: './live-notification-box.component.scss',
|
||||||
|
host: {
|
||||||
|
class: 'config-panel hidden'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export class LiveNotificationBoxComponent {
|
||||||
|
|
||||||
|
latestEvent: LogNotification = {message: 'No recent notifications...'};
|
||||||
|
|
||||||
|
constructor(private eventService: EventService) {
|
||||||
|
|
||||||
|
this.eventService.latestEvent$.subscribe(event => {
|
||||||
|
this.latestEvent = event;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
|
|
||||||
.config-panel {
|
.config-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(100% + 2px);
|
top: calc(100% + 4px);
|
||||||
inset-inline-end: 0;
|
inset-inline-end: 0;
|
||||||
width: 18rem;
|
width: 18rem;
|
||||||
padding: .75rem;
|
padding: .75rem;
|
||||||
@@ -215,6 +215,14 @@
|
|||||||
transform-origin: top;
|
transform-origin: top;
|
||||||
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||||
|
|
||||||
|
&.notification-box {
|
||||||
|
width: 30rem;
|
||||||
|
background-color: var(--card-background);
|
||||||
|
border: 0.25px solid var(--primary-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
min-height: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.config-panel-content {
|
.config-panel-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -262,61 +270,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-item {
|
|
||||||
width: auto;
|
|
||||||
padding: 0.5rem;
|
|
||||||
|
|
||||||
.version-text {
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.version-icon {
|
|
||||||
margin-left: .25rem;
|
|
||||||
color: var(--text-secondary-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.versions-panel {
|
|
||||||
padding: .25rem;
|
|
||||||
background-color: var(--overlay-background);
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: calc(100% + 2px);
|
|
||||||
border-radius: 6px;
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
||||||
transform-origin: top;
|
|
||||||
|
|
||||||
ul {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
|
|
||||||
li {
|
|
||||||
margin: 2px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
display: inline-flex;
|
|
||||||
padding: 0.5rem .75rem;
|
|
||||||
border-radius: 6px;
|
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
color: var(--text-color);
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--hover-background);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar-right-items {
|
.topbar-right-items {
|
||||||
|
|||||||
Reference in New Issue
Block a user