Checkpoint
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<div class="book-metadata-container">
|
||||
<div class="book-metadata">
|
||||
<div class="book-header">
|
||||
<div class="cover-container">
|
||||
<img [src]="coverImageSrc(book?.id)" class="book-cover placeholder" alt="Cover of {{ book?.metadata?.title }}" loading="lazy"/>
|
||||
<div>
|
||||
<div class="book-navigation">
|
||||
<p-button
|
||||
icon="pi pi-arrow-left"
|
||||
class="navigation-button"
|
||||
severity="help"
|
||||
(click)="navigateToBook(previousBookId, book?.libraryId!)"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
[disabled]="!canGoPrevious()">
|
||||
</p-button>
|
||||
<p-button
|
||||
icon="pi pi-arrow-right"
|
||||
class="navigation-button"
|
||||
severity="help"
|
||||
(click)="navigateToBook(nextBookId, book?.libraryId!)"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
[disabled]="!canGoNext()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<div class="title-row">
|
||||
<h1 class="book-title">
|
||||
{{ book?.metadata?.title }}<span *ngIf="book?.metadata?.subtitle">: {{ book?.metadata?.subtitle }}</span>
|
||||
</h1>
|
||||
<div class="button-group">
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="openEditDialog(book?.id, book?.libraryId)" icon="pi pi-pencil"></p-button>
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="readBook(book?.id)" icon="pi pi-eye"></p-button>
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" icon="pi pi-download"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="author">Author — {{ getAuthorNames(book) }}</p>
|
||||
<div class="categories">
|
||||
<p-button *ngFor="let category of book?.metadata?.categories" label="{{category.name}}" severity="info" [rounded]="true" [outlined]="true" size="small"></p-button>
|
||||
</div>
|
||||
<div class="details">
|
||||
<p><strong>Publisher:</strong> {{ book?.metadata?.publisher || 'N/A' }}</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata?.publishedDate || 'Unknown' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata?.language || 'Unknown' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="book-description">
|
||||
<p [innerHTML]="book?.metadata?.description || 'No description available.'"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,101 @@
|
||||
.book-metadata-container {
|
||||
height: calc(100vh - 10rem); /* Full height minus header and footer */
|
||||
overflow-y: auto; /* Enable vertical scrolling */
|
||||
transition: transform 0.2s, left 0.2s; /* Smooth transition for movements */
|
||||
background-color: var(--surface-card);
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem 2rem; /* Adjust padding */
|
||||
}
|
||||
|
||||
.book-metadata {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.book-header {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cover-container {
|
||||
max-width: 200px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.book-cover {
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.metadata {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
justify-content: space-between; /* Ensures title and buttons are spaced out */
|
||||
align-items: center;
|
||||
margin-bottom: 0.6rem;
|
||||
}
|
||||
|
||||
.book-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 1.5rem; /* Spacing between buttons */
|
||||
}
|
||||
|
||||
.p-button-sm {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.p-button-text {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 1.1rem;
|
||||
color: var(--text-color-secondary);
|
||||
margin: 9px 0;
|
||||
}
|
||||
|
||||
.categories {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.category {
|
||||
background-color: var(--text-color);
|
||||
color: #555;
|
||||
font-size: 0.8rem;
|
||||
padding: 4px 8px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.details p {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.book-description {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.book-navigation {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0.8rem 1rem 0;
|
||||
}
|
||||
|
||||
.book-subtitle {
|
||||
font-size: 1rem;
|
||||
color: var(--text-color-secondary);
|
||||
margin-top: 0.25rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {BookService} from '../../service/book.service';
|
||||
import {Book} from '../../model/book.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
import {BooksMetadataDialogComponent} from '../books-metadata-dialog/books-metadata-dialog.component';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {TagModule} from 'primeng/tag';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-metadata',
|
||||
templateUrl: './book-metadata.component.html',
|
||||
styleUrls: ['./book-metadata.component.scss'],
|
||||
imports: [
|
||||
Button,
|
||||
NgForOf,
|
||||
TagModule,
|
||||
NgIf
|
||||
]
|
||||
})
|
||||
export class BookMetadataComponent implements OnInit, OnDestroy {
|
||||
book: Book | null = null;
|
||||
nextBookId: number | null = null;
|
||||
previousBookId: number | null = null;
|
||||
|
||||
private routeSubscription!: Subscription;
|
||||
private dialogRef: DynamicDialogRef | undefined;
|
||||
private dialogSubscription?: Subscription;
|
||||
|
||||
constructor(
|
||||
private bookService: BookService, private activatedRoute: ActivatedRoute,
|
||||
private dialogService: DialogService, private router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.routeSubscription = this.activatedRoute.paramMap.subscribe((paramMap) => {
|
||||
const bookId = +paramMap.get('bookId')!;
|
||||
const libraryId = +paramMap.get('libraryId')!;
|
||||
if (bookId && libraryId) {
|
||||
this.loadBookWithNeighbors(bookId, libraryId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private loadBookWithNeighbors(libraryId: number, bookId: number): void {
|
||||
this.bookService.getBookWithNeighbours(bookId, libraryId).subscribe((response) => {
|
||||
this.book = response.currentBook;
|
||||
this.nextBookId = response.nextBookId;
|
||||
this.previousBookId = response.previousBookId;
|
||||
});
|
||||
}
|
||||
|
||||
navigateToBook(bookId: number | null, libraryId: number | null): void {
|
||||
if (bookId && libraryId) {
|
||||
this.router.navigate(['/library', libraryId, 'book', bookId, 'info']);
|
||||
}
|
||||
}
|
||||
|
||||
canGoNext(): boolean {
|
||||
return this.nextBookId !== null;
|
||||
}
|
||||
|
||||
canGoPrevious(): boolean {
|
||||
return this.previousBookId !== null;
|
||||
}
|
||||
|
||||
getAuthorNames(book: Book | null): string {
|
||||
if (book && book.metadata && book.metadata.authors) {
|
||||
return book.metadata.authors.map((author) => author.name).join(', ');
|
||||
}
|
||||
return 'No authors available';
|
||||
}
|
||||
|
||||
openEditDialog(bookId: number | undefined, libraryId: number | undefined) {
|
||||
this.dialogRef = this.dialogService.open(BooksMetadataDialogComponent, {
|
||||
header: 'Metadata: Google Books',
|
||||
modal: false,
|
||||
width: '65%',
|
||||
height: '85%',
|
||||
data: {
|
||||
bookId: bookId,
|
||||
libraryId: libraryId,
|
||||
bookTitle: this.book?.metadata.title,
|
||||
},
|
||||
});
|
||||
|
||||
this.dialogSubscription = this.dialogRef.onClose.subscribe(() => {
|
||||
if (this.book?.id && this.book.libraryId) {
|
||||
this.loadBookWithNeighbors(this.book.id, this.book.libraryId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
coverImageSrc(bookId: number | undefined): string {
|
||||
if (bookId === null) {
|
||||
return 'assets/book-cover-metadata.png';
|
||||
}
|
||||
return this.bookService.getBookCoverUrl(bookId!);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.routeSubscription) {
|
||||
this.routeSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
readBook(id: number | undefined) {
|
||||
const url = `/pdf-viewer/book/${id}`;
|
||||
window.open(url, '_blank');
|
||||
this.routeSubscription?.unsubscribe();
|
||||
this.dialogSubscription?.unsubscribe();
|
||||
this.dialogRef?.close();
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<div *ngIf="!isLoading && bookMetadataList.length > 0" class="metadata-list">
|
||||
<div *ngFor="let metadata of bookMetadataList" class="book-metadata">
|
||||
<div class="metadata-header">
|
||||
<div class="book-image-container">
|
||||
<img class="book-image" src="{{ metadata.thumbnail }}" alt="Book Cover" />
|
||||
<p-button class="select-button" (click)="selectMetadata(metadata)">Select</p-button>
|
||||
</div>
|
||||
<div>
|
||||
<h3>
|
||||
{{ metadata.title }}<span *ngIf="metadata.subtitle">: {{ metadata.subtitle }}</span>
|
||||
</h3>
|
||||
<p><strong>Authors:</strong> {{ metadata.authors.join(', ') || 'No authors available' }}</p>
|
||||
<p><strong>Publisher:</strong> {{ metadata.publisher }}</p>
|
||||
<p><strong>Published Date:</strong> {{ metadata.publishedDate }}</p>
|
||||
<p><strong>ISBN:</strong> {{ metadata.isbn10 }}</p>
|
||||
<p><strong>Description:</strong> {{ truncateDescription(metadata.description) }}</p>
|
||||
<p><strong>Page Count:</strong> {{ metadata.pageCount }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
.search-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 10px; /* Add space between the text box and button */
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
padding: 10px;
|
||||
font-size: 1rem;
|
||||
width: 90%; /* Adjust width as necessary */
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 15px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.metadata-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.metadata-header {
|
||||
display: flex;
|
||||
gap: 20px; /* Space between image and text */
|
||||
}
|
||||
|
||||
.book-image {
|
||||
width: 100px; /* Adjust the width as needed */
|
||||
height: 150px; /* Adjust the height as needed */
|
||||
object-fit: cover; /* Ensure the image covers the area without distorting */
|
||||
border-radius: 5px;
|
||||
margin-bottom: 10px; /* Add spacing between the image and the button */
|
||||
}
|
||||
|
||||
.select-button {
|
||||
width: auto; /* Button width adjusts to content */
|
||||
padding: 8px 15px; /* Adjust the button padding */
|
||||
margin-top: 10px; /* Space between the image and button */
|
||||
text-align: center; /* Ensure text is centered in the button */
|
||||
}
|
||||
|
||||
.book-metadata {
|
||||
background-color: var(--surface-50);
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.5rem;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 5px 0;
|
||||
color: var(--text-color-secondary);
|
||||
font-size: 1.0rem;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 15px;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {BookMetadata} from '../../model/book.model';
|
||||
import {BookService} from '../../service/book.service';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
import {FormBuilder, FormsModule} from '@angular/forms';
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {Router} from '@angular/router';
|
||||
import {Button} from 'primeng/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-books-metadata-dialog',
|
||||
templateUrl: './books-metadata-dialog.component.html',
|
||||
imports: [
|
||||
NgIf,
|
||||
NgForOf,
|
||||
FormsModule,
|
||||
Button
|
||||
],
|
||||
styleUrls: ['./books-metadata-dialog.component.scss']
|
||||
})
|
||||
export class BooksMetadataDialogComponent implements OnInit {
|
||||
bookMetadataList: BookMetadata[] = [];
|
||||
isLoading = true;
|
||||
errorMessage: string | null = null;
|
||||
searchText: string = '';
|
||||
bookId: number = 0;
|
||||
libraryId: number = 0;
|
||||
|
||||
constructor(private bookService: BookService, public dynamicDialogConfig: DynamicDialogConfig, private dynamicDialogRef: DynamicDialogRef, private router: Router) {
|
||||
this.searchText = dynamicDialogConfig.data.bookTitle;
|
||||
this.bookId = this.dynamicDialogConfig.data.bookId;
|
||||
this.libraryId = this.dynamicDialogConfig.data.libraryId;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.bookService.fetchBookMetadataByBookId(this.bookId).subscribe({
|
||||
next: (metadataList) => {
|
||||
this.bookMetadataList = metadataList;
|
||||
this.isLoading = false;
|
||||
},
|
||||
error: (error) => {
|
||||
this.errorMessage = 'Failed to load metadata';
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
selectMetadata(metadata: BookMetadata): void {
|
||||
this.bookService.setBookMetadata(metadata.googleBookId, this.bookId).subscribe({
|
||||
next: () => {
|
||||
this.dynamicDialogRef.close();
|
||||
this.router.navigate(['/library', this.libraryId, 'book', this.bookId, 'info']);
|
||||
},
|
||||
error: (error) => {
|
||||
this.errorMessage = 'Failed to save book metadata';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
truncateDescription(description: string): string {
|
||||
const maxLength = 1500;
|
||||
return description && description.length > maxLength ? description.substring(0, maxLength) + '...' : description;
|
||||
}
|
||||
|
||||
populateTitle() {
|
||||
this.bookService.fetchBookMetadataByTerm(this.searchText).subscribe({
|
||||
next: (metadataList) => {
|
||||
this.bookMetadataList = metadataList;
|
||||
this.isLoading = false;
|
||||
},
|
||||
error: (error) => {
|
||||
this.errorMessage = 'Failed to load metadata';
|
||||
this.isLoading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
<h4>{{ book.metadata.title }}</h4>
|
||||
<p>{{ getAuthorNames(book) }}</p>
|
||||
<p-button [rounded]="true" icon="pi pi-eye" class="view-btn" (click)="openBook(book.id)"></p-button>
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id)"></p-button>
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id, book.libraryId)"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ export class DashboardScrollerComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
openBookInfo(bookId: number) {
|
||||
this.router.navigate(['/book', bookId, 'info']);
|
||||
openBookInfo(bookId: number, libraryId: number) {
|
||||
this.router.navigate(['/library', libraryId, 'book', bookId, 'info']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface MenuChangeEvent {
|
||||
key: string;
|
||||
routeEvent?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="layout-footer">
|
||||
<img src="assets/layout/images/{{layoutService.config().colorScheme === 'light' ? 'logo-dark' : 'logo-white'}}.svg" alt="Logo" height="20" class="mr-2"/>
|
||||
by
|
||||
<span class="font-medium ml-2">Aditya C.</span>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { LayoutService } from "./service/app.layout.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer',
|
||||
templateUrl: './app.footer.component.html'
|
||||
})
|
||||
export class AppFooterComponent {
|
||||
constructor(public layoutService: LayoutService) { }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="layout-wrapper" [ngClass]="containerClass">
|
||||
<app-topbar></app-topbar>
|
||||
<div class="layout-sidebar layout-sidebar-custom">
|
||||
<app-sidebar></app-sidebar>
|
||||
</div>
|
||||
<div class="layout-main-container layout-main-container-custom">
|
||||
<div class="layout-main" >
|
||||
<router-outlet ></router-outlet>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
<app-config></app-config>
|
||||
<div class="layout-mask"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,132 @@
|
||||
import { Component, OnDestroy, Renderer2, ViewChild } from '@angular/core';
|
||||
import {NavigationEnd, Router, RouterOutlet} from '@angular/router';
|
||||
import { filter, Subscription } from 'rxjs';
|
||||
import { LayoutService } from "./service/app.layout.service";
|
||||
import { AppSidebarComponent } from "./app.sidebar.component";
|
||||
import { AppTopBarComponent } from './app.topbar.component';
|
||||
import {AppFooterComponent} from "./app.footer.component";
|
||||
import {AppConfigComponent} from "./config/app.config.component";
|
||||
import {NgClass} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout',
|
||||
imports: [
|
||||
RouterOutlet,
|
||||
AppFooterComponent,
|
||||
AppConfigComponent,
|
||||
AppSidebarComponent,
|
||||
AppTopBarComponent,
|
||||
NgClass
|
||||
],
|
||||
templateUrl: './app.layout.component.html'
|
||||
})
|
||||
export class AppLayoutComponent implements OnDestroy {
|
||||
|
||||
overlayMenuOpenSubscription: Subscription;
|
||||
|
||||
menuOutsideClickListener: any;
|
||||
|
||||
profileMenuOutsideClickListener: any;
|
||||
|
||||
@ViewChild(AppSidebarComponent) appSidebar!: AppSidebarComponent;
|
||||
|
||||
@ViewChild(AppTopBarComponent) appTopbar!: AppTopBarComponent;
|
||||
|
||||
constructor(public layoutService: LayoutService, public renderer: Renderer2, public router: Router) {
|
||||
this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
|
||||
if (!this.menuOutsideClickListener) {
|
||||
this.menuOutsideClickListener = this.renderer.listen('document', 'click', event => {
|
||||
const isOutsideClicked = !(this.appSidebar.el.nativeElement.isSameNode(event.target) || this.appSidebar.el.nativeElement.contains(event.target)
|
||||
|| this.appTopbar.menuButton.nativeElement.isSameNode(event.target) || this.appTopbar.menuButton.nativeElement.contains(event.target));
|
||||
|
||||
if (isOutsideClicked) {
|
||||
this.hideMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.profileMenuOutsideClickListener) {
|
||||
this.profileMenuOutsideClickListener = this.renderer.listen('document', 'click', event => {
|
||||
const isOutsideClicked = !(this.appTopbar.menu.nativeElement.isSameNode(event.target) || this.appTopbar.menu.nativeElement.contains(event.target)
|
||||
|| this.appTopbar.topbarMenuButton.nativeElement.isSameNode(event.target) || this.appTopbar.topbarMenuButton.nativeElement.contains(event.target));
|
||||
|
||||
if (isOutsideClicked) {
|
||||
this.hideProfileMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.layoutService.state.staticMenuMobileActive) {
|
||||
this.blockBodyScroll();
|
||||
}
|
||||
});
|
||||
|
||||
this.router.events.pipe(filter(event => event instanceof NavigationEnd))
|
||||
.subscribe(() => {
|
||||
this.hideMenu();
|
||||
this.hideProfileMenu();
|
||||
});
|
||||
}
|
||||
|
||||
hideMenu() {
|
||||
this.layoutService.state.overlayMenuActive = false;
|
||||
this.layoutService.state.staticMenuMobileActive = false;
|
||||
this.layoutService.state.menuHoverActive = false;
|
||||
if (this.menuOutsideClickListener) {
|
||||
this.menuOutsideClickListener();
|
||||
this.menuOutsideClickListener = null;
|
||||
}
|
||||
this.unblockBodyScroll();
|
||||
}
|
||||
|
||||
hideProfileMenu() {
|
||||
this.layoutService.state.profileSidebarVisible = false;
|
||||
if (this.profileMenuOutsideClickListener) {
|
||||
this.profileMenuOutsideClickListener();
|
||||
this.profileMenuOutsideClickListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
blockBodyScroll(): void {
|
||||
if (document.body.classList) {
|
||||
document.body.classList.add('blocked-scroll');
|
||||
}
|
||||
else {
|
||||
document.body.className += ' blocked-scroll';
|
||||
}
|
||||
}
|
||||
|
||||
unblockBodyScroll(): void {
|
||||
if (document.body.classList) {
|
||||
document.body.classList.remove('blocked-scroll');
|
||||
}
|
||||
else {
|
||||
document.body.className = document.body.className.replace(new RegExp('(^|\\b)' +
|
||||
'blocked-scroll'.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
||||
}
|
||||
}
|
||||
|
||||
get containerClass() {
|
||||
return {
|
||||
'layout-theme-light': this.layoutService.config().colorScheme === 'light',
|
||||
'layout-theme-dark': this.layoutService.config().colorScheme === 'dark',
|
||||
'layout-overlay': this.layoutService.config().menuMode === 'overlay',
|
||||
'layout-static': this.layoutService.config().menuMode === 'static',
|
||||
'layout-static-inactive': this.layoutService.state.staticMenuDesktopInactive && this.layoutService.config().menuMode === 'static',
|
||||
'layout-overlay-active': this.layoutService.state.overlayMenuActive,
|
||||
'layout-mobile-active': this.layoutService.state.staticMenuMobileActive,
|
||||
'p-input-filled': this.layoutService.config().inputStyle === 'filled',
|
||||
'p-ripple-disabled': !this.layoutService.config().ripple
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.overlayMenuOpenSubscription) {
|
||||
this.overlayMenuOpenSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
if (this.menuOutsideClickListener) {
|
||||
this.menuOutsideClickListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { SidebarModule } from 'primeng/sidebar';
|
||||
import { BadgeModule } from 'primeng/badge';
|
||||
import { RadioButtonModule } from 'primeng/radiobutton';
|
||||
import { InputSwitchModule } from 'primeng/inputswitch';
|
||||
import { RippleModule } from 'primeng/ripple';
|
||||
import { AppMenuComponent } from './app.menu.component';
|
||||
import { AppMenuitemComponent } from './app.menuitem.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AppTopBarComponent } from './app.topbar.component';
|
||||
import { AppFooterComponent } from './app.footer.component';
|
||||
import { AppConfigModule } from './config/config.module';
|
||||
import { AppSidebarComponent } from "./app.sidebar.component";
|
||||
import { AppLayoutComponent } from "./app.layout.component";
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
InputTextModule,
|
||||
SidebarModule,
|
||||
BadgeModule,
|
||||
RadioButtonModule,
|
||||
InputSwitchModule,
|
||||
RippleModule,
|
||||
RouterModule,
|
||||
AppConfigModule,
|
||||
AppMenuitemComponent,
|
||||
AppTopBarComponent,
|
||||
AppFooterComponent,
|
||||
AppMenuComponent,
|
||||
AppSidebarComponent,
|
||||
AppLayoutComponent
|
||||
],
|
||||
exports: [AppLayoutComponent]
|
||||
})
|
||||
export class AppLayoutModule { }
|
||||
@@ -0,0 +1,13 @@
|
||||
<ul class="layout-menu">
|
||||
<ng-container *ngFor="let item of home; let i = index;">
|
||||
<li app-menuitem *ngIf="!item.separator" [item]="item" [index]="i" [root]="true"></li>
|
||||
<li *ngIf="item.separator" class="menu-separator"></li>
|
||||
</ng-container>
|
||||
</ul>
|
||||
|
||||
<ul class="layout-menu">
|
||||
<ng-container *ngFor="let item of libraryMenu(); let i = index;">
|
||||
<li app-menuitem *ngIf="!item.separator" [item]="item" [index]="i" [root]="true"></li>
|
||||
<li *ngIf="item.separator" class="menu-separator"></li>
|
||||
</ng-container>
|
||||
</ul>
|
||||
@@ -0,0 +1,47 @@
|
||||
import {Component, computed, OnInit} from '@angular/core';
|
||||
import {AppMenuitemComponent} from './app.menuitem.component';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
import {MenuModule} from 'primeng/menu';
|
||||
import {LibraryService} from '../../service/library.service';
|
||||
import {Library} from '../../model/library.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
imports: [AppMenuitemComponent, NgIf, NgForOf, MenuModule],
|
||||
templateUrl: './app.menu.component.html',
|
||||
})
|
||||
export class AppMenuComponent implements OnInit {
|
||||
home: any[] = [];
|
||||
libraries: any;
|
||||
|
||||
libraryMenu = computed(() => [
|
||||
{
|
||||
label: 'Library',
|
||||
separator: false,
|
||||
items: this.libraries().map((lib: Library) => ({
|
||||
label: lib.name,
|
||||
icon: 'pi pi-fw pi-home',
|
||||
routerLink: [`/library/${lib.id}/books`]
|
||||
})),
|
||||
},
|
||||
]);
|
||||
|
||||
constructor(private libraryService: LibraryService) {
|
||||
this.libraries = this.libraryService.libraries;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.populateHome();
|
||||
}
|
||||
|
||||
private populateHome() {
|
||||
this.home = [
|
||||
{
|
||||
label: 'Home',
|
||||
items: [
|
||||
{label: 'Dashboard', icon: 'pi pi-fw pi-home', routerLink: ['/']},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { MenuChangeEvent } from './api/menuchangeevent';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MenuService {
|
||||
|
||||
private menuSource = new Subject<MenuChangeEvent>();
|
||||
private resetSource = new Subject();
|
||||
|
||||
menuSource$ = this.menuSource.asObservable();
|
||||
resetSource$ = this.resetSource.asObservable();
|
||||
|
||||
onMenuStateChange(event: MenuChangeEvent) {
|
||||
this.menuSource.next(event);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.resetSource.next(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
import { ChangeDetectorRef, Component, Host, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import {NavigationEnd, Router, RouterLink, RouterLinkActive} from '@angular/router';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { MenuService } from './app.menu.service';
|
||||
import { LayoutService } from './service/app.layout.service';
|
||||
import {NgClass, NgForOf, NgIf} from '@angular/common';
|
||||
import {Ripple} from 'primeng/ripple';
|
||||
|
||||
@Component({
|
||||
// eslint-disable-next-line @angular-eslint/component-selector
|
||||
selector: '[app-menuitem]',
|
||||
template: `
|
||||
<ng-container>
|
||||
<div *ngIf="root && item.visible !== false" class="layout-menuitem-root-text">{{ item.label }}</div>
|
||||
<a *ngIf="(!item.routerLink || item.items) && item.visible !== false" [attr.href]="item.url"
|
||||
(click)="itemClick($event)"
|
||||
[ngClass]="item.class" [attr.target]="item.target" tabindex="0" pRipple>
|
||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||
<span class="layout-menuitem-text">{{ item.label }}</span>
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" *ngIf="item.items"></i>
|
||||
</a>
|
||||
<a *ngIf="(item.routerLink && !item.items) && item.visible !== false" (click)="itemClick($event)"
|
||||
[ngClass]="item.class"
|
||||
[routerLink]="item.routerLink" routerLinkActive="active-route"
|
||||
[routerLinkActiveOptions]="item.routerLinkActiveOptions||{ paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
|
||||
[fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling"
|
||||
[preserveFragment]="item.preserveFragment"
|
||||
[skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state"
|
||||
[queryParams]="item.queryParams"
|
||||
[attr.target]="item.target" tabindex="0" pRipple>
|
||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||
<span class="layout-menuitem-text">{{ item.label }}</span>
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" *ngIf="item.items"></i>
|
||||
</a>
|
||||
|
||||
<ul *ngIf="item.items && item.visible !== false" [@children]="submenuAnimation">
|
||||
<ng-template ngFor let-child let-i="index" [ngForOf]="item.items">
|
||||
<li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child.badgeClass"></li>
|
||||
</ng-template>
|
||||
</ul>
|
||||
</ng-container>
|
||||
`,
|
||||
imports: [
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
NgClass,
|
||||
NgForOf,
|
||||
Ripple,
|
||||
NgIf
|
||||
],
|
||||
animations: [
|
||||
trigger('children', [
|
||||
state('collapsed', style({
|
||||
height: '0'
|
||||
})),
|
||||
state('expanded', style({
|
||||
height: '*'
|
||||
})),
|
||||
transition('collapsed <=> expanded', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
|
||||
])
|
||||
]
|
||||
})
|
||||
export class AppMenuitemComponent implements OnInit, OnDestroy {
|
||||
|
||||
@Input() item: any;
|
||||
|
||||
@Input() index!: number;
|
||||
|
||||
@Input() @HostBinding('class.layout-root-menuitem') root!: boolean;
|
||||
|
||||
@Input() parentKey!: string;
|
||||
|
||||
active = false;
|
||||
|
||||
menuSourceSubscription: Subscription;
|
||||
|
||||
menuResetSubscription: Subscription;
|
||||
|
||||
key: string = "";
|
||||
|
||||
constructor(public layoutService: LayoutService, private cd: ChangeDetectorRef, public router: Router, private menuService: MenuService) {
|
||||
this.menuSourceSubscription = this.menuService.menuSource$.subscribe(value => {
|
||||
Promise.resolve(null).then(() => {
|
||||
if (value.routeEvent) {
|
||||
this.active = (value.key === this.key || value.key.startsWith(this.key + '-')) ? true : false;
|
||||
}
|
||||
else {
|
||||
if (value.key !== this.key && !value.key.startsWith(this.key + '-')) {
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.menuResetSubscription = this.menuService.resetSource$.subscribe(() => {
|
||||
this.active = false;
|
||||
});
|
||||
|
||||
this.router.events.pipe(filter(event => event instanceof NavigationEnd))
|
||||
.subscribe(params => {
|
||||
if (this.item.routerLink) {
|
||||
this.updateActiveStateFromRoute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.key = this.parentKey ? this.parentKey + '-' + this.index : String(this.index);
|
||||
|
||||
if (this.item.routerLink) {
|
||||
this.updateActiveStateFromRoute();
|
||||
}
|
||||
}
|
||||
|
||||
updateActiveStateFromRoute() {
|
||||
let activeRoute = this.router.isActive(this.item.routerLink[0], { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' });
|
||||
|
||||
if (activeRoute) {
|
||||
this.menuService.onMenuStateChange({ key: this.key, routeEvent: true });
|
||||
}
|
||||
}
|
||||
|
||||
itemClick(event: Event) {
|
||||
// avoid processing disabled items
|
||||
if (this.item.disabled) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// execute command
|
||||
if (this.item.command) {
|
||||
this.item.command({ originalEvent: event, item: this.item });
|
||||
}
|
||||
|
||||
// toggle active state
|
||||
if (this.item.items) {
|
||||
this.active = !this.active;
|
||||
}
|
||||
|
||||
this.menuService.onMenuStateChange({ key: this.key });
|
||||
}
|
||||
|
||||
get submenuAnimation() {
|
||||
return this.root ? 'expanded' : (this.active ? 'expanded' : 'collapsed');
|
||||
}
|
||||
|
||||
@HostBinding('class.active-menuitem')
|
||||
get activeClass() {
|
||||
return this.active && !this.root;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.menuSourceSubscription) {
|
||||
this.menuSourceSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
if (this.menuResetSubscription) {
|
||||
this.menuResetSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<app-menu></app-menu>
|
||||
@@ -0,0 +1,3 @@
|
||||
.layout-sidebar-custom {
|
||||
width: 250px !important;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, ElementRef } from '@angular/core';
|
||||
import { LayoutService } from "./service/app.layout.service";
|
||||
import {AppMenuComponent} from './app.menu.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sidebar',
|
||||
imports: [
|
||||
AppMenuComponent
|
||||
],
|
||||
templateUrl: './app.sidebar.component.html'
|
||||
})
|
||||
export class AppSidebarComponent {
|
||||
constructor(public layoutService: LayoutService, public el: ElementRef) { }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<div class="layout-topbar">
|
||||
<a class="layout-topbar-logo" routerLink="">
|
||||
<img src="assets/layout/images/{{layoutService.config().colorScheme === 'light' ? 'logo-dark' : 'logo-white'}}.svg"
|
||||
alt="logo">
|
||||
<span>BookLore</span>
|
||||
</a>
|
||||
|
||||
<button #menubutton class="p-link layout-menu-button layout-topbar-button" (click)="layoutService.onMenuToggle()">
|
||||
<i class="pi pi-bars"></i>
|
||||
</button>
|
||||
|
||||
<app-search></app-search>
|
||||
|
||||
<button #topbarmenubutton class="p-link layout-topbar-menu-button layout-topbar-button"
|
||||
(click)="layoutService.showProfileSidebar()">
|
||||
<i class="pi pi-ellipsis-v"></i>
|
||||
</button>
|
||||
|
||||
<div #topbarmenu class="layout-topbar-menu">
|
||||
<button
|
||||
class="p-link layout-menu-button layout-topbar-button"
|
||||
(click)="openLibraryCreatorDialog()"
|
||||
pTooltip="Create New Library"
|
||||
tooltipPosition="top">
|
||||
<i class="pi pi-plus-circle"></i>
|
||||
</button>
|
||||
<button class="p-link layout-topbar-button">
|
||||
<i class="pi pi-user"></i>
|
||||
<span>Profile</span>
|
||||
</button>
|
||||
<button class="p-link layout-topbar-button" [routerLink]="'/documentation'">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>Settings</span>
|
||||
</button>
|
||||
<app-notification></app-notification>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { LayoutService } from './service/app.layout.service';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { DialogService as PrimeDialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||
import { LibraryCreatorComponent } from '../library-creator/library-creator.component';
|
||||
import { TooltipModule } from 'primeng/tooltip';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { SearchComponent } from '../search/search.component';
|
||||
import { NotificationComponent } from '../notification/notification.component'; // Import the NotificationComponent
|
||||
|
||||
@Component({
|
||||
selector: 'app-topbar',
|
||||
imports: [
|
||||
RouterLink,
|
||||
TooltipModule,
|
||||
FormsModule,
|
||||
InputTextModule,
|
||||
SearchComponent,
|
||||
NotificationComponent // Add NotificationComponent to imports
|
||||
],
|
||||
templateUrl: './app.topbar.component.html',
|
||||
})
|
||||
export class AppTopBarComponent implements OnDestroy {
|
||||
items!: MenuItem[];
|
||||
ref: DynamicDialogRef | undefined;
|
||||
|
||||
@ViewChild('menubutton') menuButton!: ElementRef;
|
||||
@ViewChild('topbarmenubutton') topbarMenuButton!: ElementRef;
|
||||
@ViewChild('topbarmenu') menu!: ElementRef;
|
||||
|
||||
constructor(public layoutService: LayoutService, public dialogService: PrimeDialogService) {}
|
||||
|
||||
openLibraryCreatorDialog(): void {
|
||||
this.ref = this.dialogService.open(LibraryCreatorComponent, {
|
||||
header: 'Create New Library',
|
||||
modal: false,
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.ref) {
|
||||
this.ref.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
<button class="layout-config-button p-link" type="button" (click)="onConfigButtonClick()">
|
||||
<i class="pi pi-cog"></i>
|
||||
</button>
|
||||
|
||||
<p-sidebar [(visible)]="visible" position="right" [transitionOptions]="'.3s cubic-bezier(0, 0, 0.2, 1)'" styleClass="layout-config-sidebar w-20rem">
|
||||
<h5>Scale</h5>
|
||||
<div class="flex align-items-center">
|
||||
<button icon="pi pi-minus" type="button" pButton (click)="decrementScale()" class="p-button-text p-button-rounded w-2rem h-2rem mr-2" [disabled]="scale === scales[0]"></button>
|
||||
<div class="flex gap-2 align-items-center">
|
||||
<i class="pi pi-circle-fill text-300" *ngFor="let s of scales" [ngClass]="{'text-primary-500': s === scale}"></i>
|
||||
</div>
|
||||
<button icon="pi pi-plus" type="button" pButton (click)="incrementScale()" class="p-button-text p-button-rounded w-2rem h-2rem ml-2" [disabled]="scale === scales[scales.length - 1]"></button>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="!minimal">
|
||||
<h5>Menu Type</h5>
|
||||
<div class="field-radiobutton">
|
||||
<p-radioButton name="menuMode" value="static" [(ngModel)]="menuMode" inputId="mode1"></p-radioButton>
|
||||
<label for="mode1">Static</label>
|
||||
</div>
|
||||
<div class="field-radiobutton">
|
||||
<p-radioButton name="menuMode" value="overlay" [(ngModel)]="menuMode" inputId="mode2"></p-radioButton>
|
||||
<label for="mode2">Overlay</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!minimal">
|
||||
<h5>Input Style</h5>
|
||||
<div class="flex">
|
||||
<div class="field-radiobutton flex-1">
|
||||
<p-radioButton name="inputStyle" value="outlined" [(ngModel)]="inputStyle" inputId="outlined_input"></p-radioButton>
|
||||
<label for="outlined_input">Outlined</label>
|
||||
</div>
|
||||
<div class="field-radiobutton flex-1">
|
||||
<p-radioButton name="inputStyle" value="filled" [(ngModel)]="inputStyle" inputId="filled_input"></p-radioButton>
|
||||
<label for="filled_input">Filled</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Ripple Effect</h5>
|
||||
<p-inputSwitch [(ngModel)]="ripple"></p-inputSwitch>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<h5>Bootstrap</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('bootstrap4-light-blue', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/bootstrap4-light-blue.svg" class="w-2rem h-2rem" alt="Bootstrap Light Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('bootstrap4-light-purple', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/bootstrap4-light-purple.svg" class="w-2rem h-2rem" alt="Bootstrap Light Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('bootstrap4-dark-blue', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/bootstrap4-dark-blue.svg" class="w-2rem h-2rem" alt="Bootstrap Dark Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('bootstrap4-dark-purple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/bootstrap4-dark-purple.svg" class="w-2rem h-2rem" alt="Bootstrap Dark Purple">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Material Design</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('md-light-indigo', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-light-indigo.svg" class="w-2rem h-2rem" alt="Material Light Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('md-light-deeppurple', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-light-deeppurple.svg" class="w-2rem h-2rem" alt="Material Light DeepPurple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('md-dark-indigo', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-dark-indigo.svg" class="w-2rem h-2rem" alt="Material Dark Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('md-dark-deeppurple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-dark-deeppurple.svg" class="w-2rem h-2rem" alt="Material Dark DeepPurple">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Material Design Compact</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('mdc-light-indigo', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-light-indigo.svg" class="w-2rem h-2rem" alt="Material Light Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('mdc-light-deeppurple', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-light-deeppurple.svg" class="w-2rem h-2rem" alt="Material Light Deep Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('mdc-dark-indigo', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-dark-indigo.svg" class="w-2rem h-2rem" alt="Material Dark Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('mdc-dark-deeppurple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/md-dark-deeppurple.svg" class="w-2rem h-2rem" alt="Material Dark Deep Purple">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Tailwind</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('tailwind-light', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/tailwind-light.png" class="w-2rem h-2rem" alt="Tailwind Light">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Fluent UI</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('fluent-light', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/fluent-light.png" class="w-2rem h-2rem" alt="Fluent Light">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>PrimeOne Design - 2022</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-light-indigo', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-light-indigo.png" class="w-2rem h-2rem" alt="Lara Light Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-light-blue', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-light-blue.png" class="w-2rem h-2rem" alt="Lara Light Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-light-purple', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-light-purple.png" class="w-2rem h-2rem" alt="Lara Light Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-light-teal', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-light-teal.png" class="w-2rem h-2rem" alt="Lara Light Teal">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-dark-indigo', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-dark-indigo.png" class="w-2rem h-2rem" alt="Lara Dark Indigo">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-dark-blue', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-dark-blue.png" class="w-2rem h-2rem" alt="Lara Dark Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-dark-purple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-dark-purple.png" class="w-2rem h-2rem" alt="Lara Dark Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('lara-dark-teal', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/lara-dark-teal.png" class="w-2rem h-2rem" alt="Lara Dark Teal">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>PrimeOne Design - 2021</h5>
|
||||
<div class="grid">
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('saga-blue', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/saga-blue.png" class="w-2rem h-2rem" alt="Saga Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('saga-green', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/saga-green.png" class="w-2rem h-2rem" alt="Saga Green">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('saga-orange', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/saga-orange.png" class="w-2rem h-2rem" alt="Saga Orange">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('saga-purple', 'light')">
|
||||
<img src="../../../../../assets/layout/images/themes/saga-purple.png" class="w-2rem h-2rem" alt="Saga Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('vela-blue', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/vela-blue.png" class="w-2rem h-2rem" alt="Vela Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('vela-green', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/vela-green.png" class="w-2rem h-2rem" alt="Vela Green">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('vela-orange', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/vela-orange.png" class="w-2rem h-2rem" alt="Vela Orange">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('vela-purple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/vela-purple.png" class="w-2rem h-2rem" alt="Vela Purple">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('arya-blue', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/arya-blue.png" class="w-2rem h-2rem" alt="Arya Blue">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('arya-green', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/arya-green.png" class="w-2rem h-2rem" alt="Arya Green">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('arya-orange', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/arya-orange.png" class="w-2rem h-2rem" alt="Arya Orange">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button class="p-link w-2rem h-2rem" (click)="changeTheme('arya-purple', 'dark')">
|
||||
<img src="../../../../../assets/layout/images/themes/arya-purple.png" class="w-2rem h-2rem" alt="Arya Purple">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</p-sidebar>
|
||||
@@ -0,0 +1,115 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { LayoutService } from '../service/app.layout.service';
|
||||
import { MenuService } from '../app.menu.service';
|
||||
import {RadioButtonModule} from 'primeng/radiobutton';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {InputSwitchModule} from 'primeng/inputswitch';
|
||||
import {NgClass, NgForOf, NgIf, NgOptimizedImage} from '@angular/common';
|
||||
import {SidebarModule} from 'primeng/sidebar';
|
||||
import {ButtonDirective} from 'primeng/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-config',
|
||||
templateUrl: './app.config.component.html',
|
||||
imports: [
|
||||
RadioButtonModule,
|
||||
FormsModule,
|
||||
InputSwitchModule,
|
||||
NgIf,
|
||||
SidebarModule,
|
||||
NgClass,
|
||||
ButtonDirective,
|
||||
NgForOf
|
||||
]
|
||||
})
|
||||
export class AppConfigComponent {
|
||||
@Input() minimal: boolean = false;
|
||||
|
||||
scales: number[] = [12, 13, 14, 15, 16];
|
||||
|
||||
constructor(
|
||||
public layoutService: LayoutService,
|
||||
public menuService: MenuService
|
||||
) {}
|
||||
|
||||
get visible(): boolean {
|
||||
return this.layoutService.state.configSidebarVisible;
|
||||
}
|
||||
set visible(_val: boolean) {
|
||||
this.layoutService.state.configSidebarVisible = _val;
|
||||
}
|
||||
|
||||
get scale(): number {
|
||||
return this.layoutService.config().scale;
|
||||
}
|
||||
set scale(_val: number) {
|
||||
this.layoutService.config.update((config) => ({
|
||||
...config,
|
||||
scale: _val,
|
||||
}));
|
||||
}
|
||||
|
||||
get menuMode(): string {
|
||||
return this.layoutService.config().menuMode;
|
||||
}
|
||||
set menuMode(_val: string) {
|
||||
this.layoutService.config.update((config) => ({
|
||||
...config,
|
||||
menuMode: _val,
|
||||
}));
|
||||
}
|
||||
|
||||
get inputStyle(): string {
|
||||
return this.layoutService.config().inputStyle;
|
||||
}
|
||||
set inputStyle(_val: string) {
|
||||
this.layoutService.config().inputStyle = _val;
|
||||
}
|
||||
|
||||
get ripple(): boolean {
|
||||
return this.layoutService.config().ripple;
|
||||
}
|
||||
set ripple(_val: boolean) {
|
||||
this.layoutService.config.update((config) => ({
|
||||
...config,
|
||||
ripple: _val,
|
||||
}));
|
||||
}
|
||||
|
||||
set theme(val: string) {
|
||||
this.layoutService.config.update((config) => ({
|
||||
...config,
|
||||
theme: val,
|
||||
}));
|
||||
}
|
||||
get theme(): string {
|
||||
return this.layoutService.config().theme;
|
||||
}
|
||||
|
||||
set colorScheme(val: string) {
|
||||
this.layoutService.config.update((config) => ({
|
||||
...config,
|
||||
colorScheme: val,
|
||||
}));
|
||||
}
|
||||
get colorScheme(): string {
|
||||
return this.layoutService.config().colorScheme;
|
||||
}
|
||||
|
||||
onConfigButtonClick() {
|
||||
this.layoutService.showConfigSidebar();
|
||||
}
|
||||
|
||||
changeTheme(theme: string, colorScheme: string) {
|
||||
this.theme = theme;
|
||||
this.colorScheme = colorScheme;
|
||||
}
|
||||
|
||||
decrementScale() {
|
||||
this.scale--;
|
||||
}
|
||||
|
||||
incrementScale() {
|
||||
this.scale++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SidebarModule } from 'primeng/sidebar';
|
||||
import { RadioButtonModule } from 'primeng/radiobutton';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { InputSwitchModule } from 'primeng/inputswitch';
|
||||
import { AppConfigComponent } from './app.config.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
SidebarModule,
|
||||
RadioButtonModule,
|
||||
ButtonModule,
|
||||
InputSwitchModule,
|
||||
AppConfigComponent
|
||||
],
|
||||
declarations: [
|
||||
|
||||
],
|
||||
exports: [
|
||||
AppConfigComponent
|
||||
]
|
||||
})
|
||||
export class AppConfigModule { }
|
||||
@@ -0,0 +1,159 @@
|
||||
import { Injectable, effect, signal } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
export interface AppConfig {
|
||||
inputStyle: string;
|
||||
colorScheme: string;
|
||||
theme: string;
|
||||
ripple: boolean;
|
||||
menuMode: string;
|
||||
scale: number;
|
||||
}
|
||||
|
||||
interface LayoutState {
|
||||
staticMenuDesktopInactive: boolean;
|
||||
overlayMenuActive: boolean;
|
||||
profileSidebarVisible: boolean;
|
||||
configSidebarVisible: boolean;
|
||||
staticMenuMobileActive: boolean;
|
||||
menuHoverActive: boolean;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LayoutService {
|
||||
_config: AppConfig = {
|
||||
ripple: false,
|
||||
inputStyle: 'outlined',
|
||||
menuMode: 'static',
|
||||
colorScheme: 'light',
|
||||
theme: 'lara-light-indigo',
|
||||
scale: 14,
|
||||
};
|
||||
|
||||
config = signal<AppConfig>(this._config);
|
||||
|
||||
state: LayoutState = {
|
||||
staticMenuDesktopInactive: false,
|
||||
overlayMenuActive: false,
|
||||
profileSidebarVisible: false,
|
||||
configSidebarVisible: false,
|
||||
staticMenuMobileActive: false,
|
||||
menuHoverActive: false,
|
||||
};
|
||||
|
||||
private configUpdate = new Subject<AppConfig>();
|
||||
|
||||
private overlayOpen = new Subject<any>();
|
||||
|
||||
configUpdate$ = this.configUpdate.asObservable();
|
||||
|
||||
overlayOpen$ = this.overlayOpen.asObservable();
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const config = this.config();
|
||||
if (this.updateStyle(config)) {
|
||||
this.changeTheme();
|
||||
}
|
||||
this.changeScale(config.scale);
|
||||
this.onConfigUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
updateStyle(config: AppConfig) {
|
||||
return (
|
||||
config.theme !== this._config.theme ||
|
||||
config.colorScheme !== this._config.colorScheme
|
||||
);
|
||||
}
|
||||
|
||||
onMenuToggle() {
|
||||
if (this.isOverlay()) {
|
||||
this.state.overlayMenuActive = !this.state.overlayMenuActive;
|
||||
if (this.state.overlayMenuActive) {
|
||||
this.overlayOpen.next(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isDesktop()) {
|
||||
this.state.staticMenuDesktopInactive =
|
||||
!this.state.staticMenuDesktopInactive;
|
||||
} else {
|
||||
this.state.staticMenuMobileActive =
|
||||
!this.state.staticMenuMobileActive;
|
||||
|
||||
if (this.state.staticMenuMobileActive) {
|
||||
this.overlayOpen.next(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showProfileSidebar() {
|
||||
this.state.profileSidebarVisible = !this.state.profileSidebarVisible;
|
||||
if (this.state.profileSidebarVisible) {
|
||||
this.overlayOpen.next(null);
|
||||
}
|
||||
}
|
||||
|
||||
showConfigSidebar() {
|
||||
this.state.configSidebarVisible = true;
|
||||
}
|
||||
|
||||
isOverlay() {
|
||||
return this.config().menuMode === 'overlay';
|
||||
}
|
||||
|
||||
isDesktop() {
|
||||
return window.innerWidth > 991;
|
||||
}
|
||||
|
||||
isMobile() {
|
||||
return !this.isDesktop();
|
||||
}
|
||||
|
||||
onConfigUpdate() {
|
||||
this._config = { ...this.config() };
|
||||
this.configUpdate.next(this.config());
|
||||
}
|
||||
|
||||
changeTheme() {
|
||||
const config = this.config();
|
||||
const themeLink = <HTMLLinkElement>document.getElementById('theme-css');
|
||||
const themeLinkHref = themeLink.getAttribute('href')!;
|
||||
const newHref = themeLinkHref
|
||||
.split('/')
|
||||
.map((el) =>
|
||||
el == this._config.theme
|
||||
? (el = config.theme)
|
||||
: el == `theme-${this._config.colorScheme}`
|
||||
? (el = `theme-${config.colorScheme}`)
|
||||
: el
|
||||
)
|
||||
.join('/');
|
||||
|
||||
this.replaceThemeLink(newHref);
|
||||
}
|
||||
replaceThemeLink(href: string) {
|
||||
const id = 'theme-css';
|
||||
let themeLink = <HTMLLinkElement>document.getElementById(id);
|
||||
const cloneLinkElement = <HTMLLinkElement>themeLink.cloneNode(true);
|
||||
|
||||
cloneLinkElement.setAttribute('href', href);
|
||||
cloneLinkElement.setAttribute('id', id + '-clone');
|
||||
|
||||
themeLink.parentNode!.insertBefore(
|
||||
cloneLinkElement,
|
||||
themeLink.nextSibling
|
||||
);
|
||||
cloneLinkElement.addEventListener('load', () => {
|
||||
themeLink.remove();
|
||||
cloneLinkElement.setAttribute('id', id);
|
||||
});
|
||||
}
|
||||
|
||||
changeScale(value: number) {
|
||||
document.documentElement.style.fontSize = `${value}px`;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<h4>{{ book.metadata.title }}</h4>
|
||||
<p>{{ getAuthorNames(book) }}</p>
|
||||
<p-button [rounded]="true" icon="pi pi-eye" class="view-btn" (click)="readBook(book.id)"></p-button>
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id)"></p-button>
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id, book.libraryId)"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BookProgressService } from '../../service/book-progress-service';
|
||||
import { BookUpdateEvent } from '../../model/book-update-event.model';
|
||||
import { BookService } from '../../service/book.service';
|
||||
import { Book } from '../../model/book.model';
|
||||
import {Book, BookUpdateEvent} from '../../model/book.model';
|
||||
import { combineLatest } from 'rxjs';
|
||||
import {InfiniteScrollDirective} from 'ngx-infinite-scroll';
|
||||
import {Button} from 'primeng/button';
|
||||
@@ -105,7 +104,7 @@ export class LibraryBrowserComponent implements OnInit {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
openBookInfo(bookId: number) {
|
||||
this.router.navigate(['/book', bookId, 'info']);
|
||||
openBookInfo(bookId: number, libraryId: number) {
|
||||
this.router.navigate(['/library', libraryId, 'book', bookId, 'info']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
<button *ngIf="searchQuery" pButton icon="pi pi-times" (click)="clearSearch()" class="clear-btn" type="button" aria-label="Clear Search"></button>
|
||||
</span>
|
||||
|
||||
<div class="search-dropdown layout-menu" [class.show]="(books.length > 0 || (searchQuery?.length ?? 0) > 0)">
|
||||
<div class="search-dropdown layout-menu" [class.show]="(books.length > 0)">
|
||||
<ng-container *ngIf="books.length > 0; else noResults">
|
||||
<div class="search-dropdown-item" *ngFor="let book of books" (click)="onBookClick(book)">
|
||||
<img [src]="getBookCoverUrl(book.id)" alt="Book Cover" class="search-book-cover" />
|
||||
|
||||
Reference in New Issue
Block a user