No more need to create coverUrl
This commit is contained in:
+2
-2
@@ -1,10 +1,10 @@
|
||||
<form [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" *ngIf="bookMetadata$ | async as bookMetadata" class="pt-2 flex flex-col h-full">
|
||||
<form [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" *ngIf="bookMetadata$ | async as metadata" class="pt-2 flex flex-col h-full">
|
||||
|
||||
<div class="overflow-y-scroll flex-1">
|
||||
|
||||
<div class="flex flex-row w-full gap-4">
|
||||
|
||||
<img [src]="bookMetadata.coverUrl" alt="Image" width="225"/>
|
||||
<img [src]="baseUrl + '/v1/book/' + metadata.bookId + '/cover?' + metadata?.coverUpdatedOn" alt="Image" width="225"/>
|
||||
|
||||
<div class="flex flex-col flex-grow pl-2">
|
||||
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import {BookService} from '../../../book/service/book.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {MetadataService} from '../../service/metadata.service';
|
||||
import {Book, BookMetadata} from '../../../book/model/book.model';
|
||||
import {API_CONFIG} from '../../../config/api-config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-editor',
|
||||
@@ -39,7 +40,7 @@ export class MetadataEditorComponent implements OnInit {
|
||||
bookMetadata$: Observable<BookMetadata | null> = this.metadataCenterService.currentMetadata$;
|
||||
bookMetadataForm: FormGroup;
|
||||
currentBookId!: number;
|
||||
|
||||
baseUrl = API_CONFIG.BASE_URL;
|
||||
|
||||
constructor() {
|
||||
this.bookMetadataForm = new FormGroup({
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@
|
||||
<div class="form-row">
|
||||
<label class="label"></label>
|
||||
<div class="input-container">
|
||||
<img *ngIf="!updateThumbnailUrl" [src]="coverImageSrc(currentBookId)" alt="Book Thumbnail" class="thumbnail"/>
|
||||
<img *ngIf="!updateThumbnailUrl" [src]="baseUrl + '/v1/book/' + currentBookId + '/cover?' + metadata?.coverUpdatedOn" alt="Book Thumbnail" class="thumbnail"/>
|
||||
<img *ngIf="updateThumbnailUrl" [src]="fetchedMetadata.thumbnailUrl" alt="Fetched Thumbnail" class="thumbnail"/>
|
||||
<p-button
|
||||
[icon]="thumbnailSaved ? 'pi pi-check' : 'pi pi-arrow-left'"
|
||||
|
||||
+4
@@ -11,6 +11,7 @@ import {BookMetadataCenterService} from '../book-metadata-center.service';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {MetadataService} from '../../service/metadata.service';
|
||||
import {API_CONFIG} from '../../../config/api-config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-picker',
|
||||
@@ -47,6 +48,8 @@ export class MetadataPickerComponent implements OnInit {
|
||||
private metadataService = inject(MetadataService);
|
||||
|
||||
currentMetadata$: Observable<BookMetadata | null> = this.metadataCenterService.currentMetadata$;
|
||||
baseUrl = API_CONFIG.BASE_URL;
|
||||
protected metadata!: BookMetadata;
|
||||
|
||||
constructor() {
|
||||
this.metadataForm = new FormGroup({
|
||||
@@ -70,6 +73,7 @@ export class MetadataPickerComponent implements OnInit {
|
||||
this.currentMetadata$.subscribe((metadata) => {
|
||||
if (metadata) {
|
||||
this.currentBookId = metadata.bookId;
|
||||
this.metadata = metadata;
|
||||
this.metadataForm.setValue({
|
||||
title: metadata.title,
|
||||
subtitle: metadata.subtitle,
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<div class="book-metadata-container flex-shrink-0" *ngIf="metadata$ | async as metadata">
|
||||
<div class="flex flex-row w-full">
|
||||
|
||||
<img [src]="metadata.coverUrl" class="book-cover placeholder" alt="Cover of {{ metadata.title }}" loading="lazy" width="225"/>
|
||||
<img [src]="baseUrl + '/v1/book/' + metadata.bookId + '/cover?' + metadata?.coverUpdatedOn" class="book-cover placeholder" alt="Cover of {{ metadata.title }}" loading="lazy" width="225"/>
|
||||
|
||||
<div class="pl-6 flex flex-col w-full space-y-4">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
|
||||
+2
@@ -10,6 +10,7 @@ import {Tag} from 'primeng/tag';
|
||||
import {Author, Book, BookMetadata} from '../../../book/model/book.model';
|
||||
import {FileService} from '../../../book/service/file.service';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {API_CONFIG} from '../../../config/api-config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-viewer',
|
||||
@@ -25,6 +26,7 @@ export class MetadataViewerComponent {
|
||||
private metadataCenterService = inject(BookMetadataCenterService);
|
||||
|
||||
metadata$: Observable<BookMetadata | null> = this.metadataCenterService.currentMetadata$;
|
||||
baseUrl = API_CONFIG.BASE_URL;
|
||||
|
||||
readBook(bookId: number): void {
|
||||
this.bookService.readBook(bookId);
|
||||
|
||||
@@ -7,13 +7,14 @@ import {catchError, map, tap} from "rxjs/operators";
|
||||
import {BookService} from "../../book/service/book.service";
|
||||
import {MetadataRefreshRequest} from '../model/request/metadata-refresh-request.model';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MetadataService {
|
||||
|
||||
private readonly url = 'http://localhost:8080/v1/metadata';
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/v1/metadata`;
|
||||
|
||||
private http = inject(HttpClient);
|
||||
private bookService = inject(BookService);
|
||||
|
||||
Reference in New Issue
Block a user