Checkpoint

This commit is contained in:
aditya.chandel
2024-12-15 22:41:13 -07:00
parent 0aa1c1b923
commit 767c6604e8
51 changed files with 297 additions and 212 deletions
@@ -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();
}
}
}