Layout improvement for metadata-editor

This commit is contained in:
aditya.chandel
2025-01-04 18:27:55 -07:00
parent 77fb080757
commit d4de5df2bf
7 changed files with 41 additions and 25 deletions
@@ -9,7 +9,7 @@
<app-book-metadata-viewer></app-book-metadata-viewer>
</p-tabpanel>
<p-tabpanel value="1" style="height: 100%; overflow: hidden;">
<app-book-details></app-book-details>
<app-book-metadata-editor></app-book-metadata-editor>
</p-tabpanel>
<p-tabpanel value="2" style="height: 100%; overflow: hidden;">
<app-book-match></app-book-match>
@@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {Tab, TabList, TabPanel, TabPanels, Tabs} from 'primeng/tabs';
import {BookDetailsComponent} from './book-details/book-details.component';
import {BookMetadataEditorComponent} from './book-metadata-editor/book-metadata-editor.component';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {BookService} from '../book/service/book.service';
import {MessageService} from 'primeng/api';
@@ -20,7 +20,7 @@ import {BookMetadataViewerComponent} from './book-metadata-viewer/book-metadata-
TabList,
Tab,
TabPanels,
BookDetailsComponent,
BookMetadataEditorComponent,
TabPanel,
BookMatchComponent,
BookMetadataViewerComponent,
@@ -1,6 +1,7 @@
<div *ngIf="bookMetadata$ | async as bookMetadata" class="container pt-2 flex flex-col h-full">
<form [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" class="space-y-4 overflow-y-auto flex-1">
<div class="flex w-full gap-x-4">
<form [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" *ngIf="bookMetadata$ | async as bookMetadata" class="h-full flex pt-2 flex-col">
<div [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" class="overflow-y-scroll flex-1">
<div class="flex w-full gap-x-4 pb-4">
<div class="flex flex-col gap-1 w-2/3">
<label for="title">Title</label>
<input pInputText id="title" class="w-full" formControlName="title"/>
@@ -10,7 +11,7 @@
<input pInputText id="subtitle" class="w-full" formControlName="subtitle"/>
</div>
</div>
<div class="flex w-full gap-x-4">
<div class="flex w-full gap-x-4 pb-4">
<div class="flex flex-col gap-1 w-3/4">
<label for="authors">Authors</label>
<input pInputText id="authors" class="w-full" formControlName="authors" placeholder="Enter authors separated by commas"/>
@@ -20,15 +21,15 @@
<input pInputText id="publish" class="w-full" formControlName="publishedDate"/>
</div>
</div>
<div class="flex flex-col gap-1 w-full">
<div class="flex flex-col gap-1 w-full pb-4">
<label for="description">Description</label>
<textarea id="description" rows="5" cols="30" pTextarea formControlName="description"></textarea>
</div>
<div class="flex flex-grow w-full justify-between gap-4">
<div class="w-1/3 flex justify-center items-center pt-4 pr-4 pb-4">
<div class="flex w-full gap-x-4 pb-4">
<div class="w-1/3 flex justify-center items-center">
<p-image [src]="coverImageSrc(bookMetadata.bookId)" alt="Image" width="250"></p-image>
</div>
<div class="w-2/3 space-y-2">
<div class="w-2/3 space-y-4">
<div class="flex flex-col gap-1 w-full">
<label for="categories">Categories</label>
<input pInputText id="categories" class="w-full" formControlName="categories"/>
@@ -38,7 +39,7 @@
<label for="publisher">Publisher</label>
<input pInputText id="publisher" class="w-full" formControlName="publisher"/>
</div>
<div class="flex flex-col w-1/2">
<div class="flex flex-col gap-1 w-1/2">
<label for="language">Language</label>
<input pInputText id="language" class="w-full" formControlName="language"/>
</div>
@@ -48,33 +49,35 @@
<label for="isbn10">ISBN10</label>
<input pInputText id="isbn10" class="w-full" formControlName="isbn10"/>
</div>
<div class="flex flex-col w-1/2">
<div class="flex flex-col gap-1 w-1/2">
<label for="isbn13">ISBN13</label>
<input pInputText id="isbn13" class="w-full" formControlName="isbn13"/>
</div>
</div>
<div class="flex w-full gap-x-4">
<div class="flex flex-col w-1/3">
<div class="flex flex-col gap-1 w-1/3">
<label for="rating">Rating</label>
<input pInputText id="rating" class="w-full" formControlName="rating"/>
</div>
<div class="flex flex-col w-1/3">
<div class="flex flex-col gap-1 w-1/3">
<label for="reviewCount">Review Count</label>
<input pInputText id="reviewCount" class="w-full" formControlName="reviewCount"/>
</div>
<div class="flex flex-col w-1/3">
<div class="flex flex-col gap-1 w-1/3">
<label for="page-count">Page Count</label>
<input pInputText id="page-count" class="w-full" formControlName="pageCount"/>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="flex flex-col gap-x-4 mt-auto">
<p-divider></p-divider>
<div class="flex gap-x-4 justify-end">
<div class="flex gap-x-4 justify-end pt-4">
<p-button label="Cancel" icon="pi pi-times" severity="secondary" (onClick)="closeDialog()"></p-button>
<p-button label="Save" icon="pi pi-check" type="submit"></p-button>
</div>
</div>
</div>
</form>
@@ -13,10 +13,10 @@ import {BookMetadataBI} from '../../book/model/book-metadata-for-book-info.model
import {MessageService} from 'primeng/api';
@Component({
selector: 'app-book-details',
selector: 'app-book-metadata-editor',
standalone: true,
templateUrl: './book-details.component.html',
styleUrl: './book-details.component.scss',
templateUrl: './book-metadata-editor.component.html',
styleUrl: './book-metadata-editor.component.scss',
imports: [
InputText,
Textarea,
@@ -29,7 +29,7 @@ import {MessageService} from 'primeng/api';
ReactiveFormsModule
]
})
export class BookDetailsComponent implements OnInit {
export class BookMetadataEditorComponent implements OnInit {
bookMetadata$: Observable<BookMetadataBI | null>;
bookMetadataForm: FormGroup;
@@ -2,7 +2,7 @@
<div class="book-metadata-container flex-shrink-0" *ngIf="bookMetadata$ | async as bookMetadata">
<div class="flex flex-row w-full">
<img [src]="coverImageSrc(bookMetadata.bookId)" class="book-cover placeholder" alt="Cover of {{ bookMetadata.title }}" loading="lazy" width="200"/>
<img [src]="coverImageSrc(bookMetadata.bookId)" class="book-cover placeholder" alt="Cover of {{ bookMetadata.title }}" loading="lazy" width="225"/>
<div class="pl-4 flex flex-col w-full space-y-4">
<div class="flex flex-row items-center justify-between">
@@ -8,7 +8,7 @@
icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '2rem', 'padding-right': '2rem'}"
[outlined]="true"
[pTooltip]="'Copy all missing metadata'"
pTooltip="Select all missing field" tooltipPosition="bottom"
(onClick)="copyMissing()"></p-button>
<p>Fetched Metadata</p>
</div>
@@ -196,6 +196,18 @@
</div>
</div>
<div class="flex justify-center items-center" [ngStyle]="{'padding-bottom': '0.75rem', 'padding-left': '4.95rem'}">
<p class="ml-3">Current Metadata</p>
<p-button
severity="info"
icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '2rem', 'padding-right': '2rem'}"
[outlined]="true"
pTooltip="Select all missing field" tooltipPosition="top"
(onClick)="copyMissing()"></p-button>
<p>Fetched Metadata</p>
</div>
</div>
<div class="flex flex-col gap-x-4 mt-auto">
@@ -208,4 +220,5 @@
</div>
</div>
</div>
</form>