Checkpoint
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<button
|
||||
class="p-link layout-topbar-button"
|
||||
[ngClass]="{'glowing-icon': glowing}">
|
||||
<i class="pi pi-bolt"></i>
|
||||
<span>Progress</span>
|
||||
</button>
|
||||
@@ -0,0 +1,3 @@
|
||||
.glowing-icon {
|
||||
color: yellow;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import {Component, OnInit, OnDestroy} from '@angular/core';
|
||||
import {BookProgressService} from '../../service/book-progress-service';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {NgClass} from '@angular/common';
|
||||
import {BookUpdateEvent} from '../../model/book.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-notification',
|
||||
templateUrl: './notification.component.html',
|
||||
imports: [
|
||||
NgClass
|
||||
],
|
||||
styleUrls: ['./notification.component.scss']
|
||||
})
|
||||
export class NotificationComponent implements OnInit, OnDestroy {
|
||||
glowing: boolean = false;
|
||||
private eventSubscription!: Subscription;
|
||||
|
||||
constructor(private bookProgressService: BookProgressService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
/*this.eventSubscription = this.bookProgressService.connect(1).subscribe({
|
||||
next: (event: BookUpdateEvent) => {
|
||||
this.handleNewNotification(event);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error receiving progress updates:', error);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
handleNewNotification(event: BookUpdateEvent): void {
|
||||
this.glowing = true;
|
||||
setTimeout(() => {
|
||||
this.glowing = false;
|
||||
console.log("reset")
|
||||
}, 200);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.eventSubscription) {
|
||||
this.eventSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user