Implement public review fetching from metadata providers
This commit is contained in:
committed by
Aditya Chandel
parent
22b2c013bd
commit
c660497e0b
+54
-35
@@ -465,10 +465,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="px-4 pb-2 pt-4 border border-[var(--border-color)] rounded-xl">
|
||||
<div class="px-4 pb-2 pt-4 mb-6 mx-2 border border-[var(--border-color)] rounded-xl">
|
||||
<div [ngClass]="{ 'line-clamp-5': !isExpanded, 'line-clamp-none': isExpanded }" class="transition-all duration-300 overflow-hidden description-container">
|
||||
<div class="readonly-editor px-2">
|
||||
<p-editor #quillEditor [readonly]="true" [style]="{height: '225px'}" [(ngModel)]="book.metadata!.description">
|
||||
<p-editor #quillEditor [readonly]="true" [style]="{height: '200px'}" [(ngModel)]="book.metadata!.description">
|
||||
<ng-template #header>
|
||||
</ng-template>
|
||||
</p-editor>
|
||||
@@ -486,44 +486,63 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="pt-4 space-y-4 pb-6">
|
||||
@if (bookInSeries.length > 0) {
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold pt-2">More in the Series</h3>
|
||||
<div class="dashboard-scroller-infinite"
|
||||
infiniteScroll
|
||||
[infiniteScrollDistance]="2"
|
||||
[infiniteScrollThrottle]="50"
|
||||
[horizontal]="true">
|
||||
@for (book of bookInSeries; track book) {
|
||||
<div class="dashboard-scroller-card">
|
||||
<app-book-card-lite-component
|
||||
[book]="book"
|
||||
></app-book-card-lite-component>
|
||||
<p-tabs lazy="true" class="custom-p-tabs" [value]="defaultTabValue" scrollable>
|
||||
<p-tablist>
|
||||
@if (bookInSeries.length > 0) {
|
||||
<p-tab [value]="1">
|
||||
<i class="pi pi-ethereum"></i> More in Series
|
||||
</p-tab>
|
||||
}
|
||||
<p-tab [value]="2">
|
||||
<i class="pi pi-bookmark"></i> Similar Books
|
||||
</p-tab>
|
||||
<p-tab [value]="3">
|
||||
<i class="pi pi-comments"></i> Reviews
|
||||
</p-tab>
|
||||
</p-tablist>
|
||||
<p-tabpanels>
|
||||
<p-tabpanel [value]="1">
|
||||
<div class="pt-2">
|
||||
@if (bookInSeries.length > 0) {
|
||||
<div>
|
||||
<div class="dashboard-scroller-infinite"
|
||||
infiniteScroll
|
||||
[infiniteScrollDistance]="2"
|
||||
[infiniteScrollThrottle]="50"
|
||||
[horizontal]="true">
|
||||
@for (book of bookInSeries; track book) {
|
||||
<div class="dashboard-scroller-card">
|
||||
<app-book-card-lite-component [book]="book"></app-book-card-lite-component>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
}
|
||||
@if (recommendedBooks.length > 0) {
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold">Similar Books</h3>
|
||||
<div class="dashboard-scroller-infinite"
|
||||
infiniteScroll
|
||||
[infiniteScrollDistance]="2"
|
||||
[infiniteScrollThrottle]="50"
|
||||
[horizontal]="true">
|
||||
@for (book of recommendedBooks; track book) {
|
||||
<div class="dashboard-scroller-card">
|
||||
<app-book-card-lite-component
|
||||
[book]="book.book"
|
||||
></app-book-card-lite-component>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel [value]="2">
|
||||
<div class="pt-2">
|
||||
@if (recommendedBooks.length > 0) {
|
||||
<div>
|
||||
<div class="dashboard-scroller-infinite"
|
||||
infiniteScroll
|
||||
[infiniteScrollDistance]="2"
|
||||
[infiniteScrollThrottle]="50"
|
||||
[horizontal]="true">
|
||||
@for (book of recommendedBooks; track book) {
|
||||
<div class="dashboard-scroller-card">
|
||||
<app-book-card-lite-component [book]="book.book"></app-book-card-lite-component>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel [value]="3">
|
||||
<app-book-reviews [bookId]="book.id"></app-book-reviews>
|
||||
</p-tabpanel>
|
||||
</p-tabpanels>
|
||||
</p-tabs>
|
||||
}
|
||||
</div>
|
||||
|
||||
+10
-3
@@ -46,14 +46,14 @@
|
||||
}
|
||||
|
||||
.dashboard-scroller-card {
|
||||
width: 101px;
|
||||
width: 115px;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: 101px;
|
||||
flex-basis: 115px;
|
||||
}
|
||||
|
||||
.description-container {
|
||||
max-height: 58px;
|
||||
max-height: 60px;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease-in-out;
|
||||
}
|
||||
@@ -104,6 +104,13 @@
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.custom-p-tabs > .p-tabpanels {
|
||||
padding-top: 10px !important;
|
||||
padding-bottom: 0 !important;
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .p-inputchips {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
+9
-4
@@ -7,7 +7,6 @@ import {Rating, RatingRateEvent} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Tag} from 'primeng/tag';
|
||||
import {Book, BookMetadata, BookRecommendation, ReadStatus} from '../../../book/model/book.model';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {UrlHelperService} from '../../../utilities/service/url-helper.service';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {SplitButton} from 'primeng/splitbutton';
|
||||
@@ -30,13 +29,15 @@ import {InfiniteScrollDirective} from 'ngx-infinite-scroll';
|
||||
import {BookCardLiteComponent} from '../../../book/components/book-card-lite/book-card-lite-component';
|
||||
import {ResetProgressType, ResetProgressTypes} from '../../../shared/constants/reset-progress-type';
|
||||
import {DatePicker} from 'primeng/datepicker';
|
||||
import {Tab, TabList, TabPanel, TabPanels, Tabs} from 'primeng/tabs';
|
||||
import {BookReviewsComponent} from '../../../components/book-reviews/book-reviews.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-viewer',
|
||||
standalone: true,
|
||||
templateUrl: './metadata-viewer.component.html',
|
||||
styleUrl: './metadata-viewer.component.scss',
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe, Editor, ProgressBar, Menu, InfiniteScrollDirective, BookCardLiteComponent, DatePicker]
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, SplitButton, NgClass, Tooltip, DecimalPipe, Editor, ProgressBar, Menu, InfiniteScrollDirective, BookCardLiteComponent, DatePicker, Tab, TabList, TabPanel, TabPanels, Tabs, BookReviewsComponent]
|
||||
})
|
||||
export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
@Input() book$!: Observable<Book | null>;
|
||||
@@ -221,6 +222,10 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
);
|
||||
}
|
||||
|
||||
get defaultTabValue(): number {
|
||||
return this.bookInSeries && this.bookInSeries.length > 0 ? 1 : 2;
|
||||
}
|
||||
|
||||
toggleExpand(): void {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
}
|
||||
@@ -607,9 +612,9 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
|
||||
saveDateFinished(book: Book): void {
|
||||
if (!book) return;
|
||||
|
||||
|
||||
const dateToSave = this.editDateFinished ? this.editDateFinished.toISOString() : null;
|
||||
|
||||
|
||||
this.bookService.updateDateFinished(book.id, dateToSave).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({
|
||||
|
||||
Reference in New Issue
Block a user