refactor(frontend): rename booklore-ui to frontend
- Frontend path: - rename the tracked Angular app tree from `booklore-ui/` to `frontend/` - preserve file contents during the move so this commit stays focused on the path change itself - Frontend docs: - update the moved frontend README and contribution guide where they refer to the renamed folder - keep those edits limited to path references introduced by the directory rename
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
<div class="metadata-review-container">
|
||||
<div class="panel-header">
|
||||
<div class="header-icon-wrapper">
|
||||
<i class="pi pi-pencil header-icon"></i>
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h2 class="panel-title">Review Metadata Proposal</h2>
|
||||
<p class="panel-description">Review and accept fetched metadata</p>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[rounded]="true"
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(click)="close()"
|
||||
class="close-button">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
@if (!loading) {
|
||||
<div class="dialog-content">
|
||||
@if (currentProposal?.metadataJson; as proposed) {
|
||||
<app-metadata-picker
|
||||
[fetchedMetadata]="proposed"
|
||||
[book]="currentBook()"
|
||||
(goBack)="close()"
|
||||
[reviewMode]="true">
|
||||
</app-metadata-picker>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<div class="footer-info">
|
||||
<div class="progress-group" pTooltip="{{ currentIndex() + 1 }} of {{ proposals().length }} processed ({{ ((currentIndex() + 1) / proposals().length * 100) | number: '1.0-0' }}%)" tooltipPosition="top">
|
||||
<p-progressBar
|
||||
[value]="((currentIndex() + 1) / proposals().length) * 100"
|
||||
class="progress-bar"
|
||||
showValue="false">
|
||||
</p-progressBar>
|
||||
<span class="progress-text">
|
||||
Book {{ currentIndex() + 1 }} / {{ proposals().length }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer-actions">
|
||||
<p-button
|
||||
label="Close"
|
||||
icon="pi pi-times-circle"
|
||||
severity="secondary"
|
||||
[outlined]="true"
|
||||
(click)="close()">
|
||||
</p-button>
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
|
||||
<p-button
|
||||
label="Lock All"
|
||||
icon="pi pi-lock"
|
||||
severity="warn"
|
||||
[outlined]="true"
|
||||
(click)="lockAllMetadata()">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
label="Unlock All"
|
||||
icon="pi pi-lock-open"
|
||||
severity="success"
|
||||
[outlined]="true"
|
||||
(click)="unlockAllMetadata()">
|
||||
</p-button>
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
|
||||
<p-button
|
||||
label="Accept & Save"
|
||||
icon="pi pi-check-circle"
|
||||
iconPos="right"
|
||||
severity="success"
|
||||
[outlined]="true"
|
||||
(click)="onSave()">
|
||||
</p-button>
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
|
||||
<p-button
|
||||
[label]="isLast ? 'Finish & Close' : 'Next'"
|
||||
[icon]="isLast ? 'pi pi-check-circle' : 'pi pi-angle-right'"
|
||||
iconPos="right"
|
||||
severity="info"
|
||||
[outlined]="true"
|
||||
(click)="onNext()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="dialog-content loading-state">
|
||||
<p-progressSpinner class="spinner" strokeWidth="4"></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
@use '../../../../shared/styles/panel-shared' as panel;
|
||||
|
||||
.metadata-review-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
@include panel.panel-header;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
height: calc(95dvh - 90px - 80px);
|
||||
overflow-y: auto;
|
||||
padding: 1rem;
|
||||
background: var(--card-background);
|
||||
border: 1px solid var(--border-color);
|
||||
border-top: none;
|
||||
|
||||
&.loading-state {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 0 0 10px 10px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
@include panel.dialog-footer;
|
||||
flex-shrink: 0;
|
||||
|
||||
.footer-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.progress-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
cursor: help;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 10rem;
|
||||
height: 0.75rem;
|
||||
|
||||
@media (max-width: 640px) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary-color);
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.footer-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
.footer-info {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.progress-group {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.footer-actions {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
import {Component, computed, effect, inject, OnInit, signal, ViewChild} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {FetchedProposal, MetadataTaskService} from '../../../book/service/metadata-task';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {Book} from '../../../book/model/book.model';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {MetadataProgressService} from '../../../../shared/service/metadata-progress.service';
|
||||
import {MetadataPickerComponent} from '../book-metadata-center/metadata-picker/metadata-picker.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-review-dialog-component',
|
||||
standalone: true,
|
||||
templateUrl: './metadata-review-dialog-component.html',
|
||||
styleUrls: ['./metadata-review-dialog-component.scss'],
|
||||
imports: [CommonModule, MetadataPickerComponent, ProgressSpinner, Button, Divider, ProgressBar, Tooltip],
|
||||
})
|
||||
export class MetadataReviewDialogComponent implements OnInit {
|
||||
|
||||
@ViewChild(MetadataPickerComponent)
|
||||
pickerComponent!: MetadataPickerComponent;
|
||||
|
||||
private config = inject(DynamicDialogConfig);
|
||||
private dialogRef = inject(DynamicDialogRef);
|
||||
private metadataTaskService = inject(MetadataTaskService);
|
||||
private bookService = inject(BookService);
|
||||
private progressService = inject(MetadataProgressService);
|
||||
|
||||
loading = true;
|
||||
readonly proposals = signal<FetchedProposal[]>([]);
|
||||
readonly currentIndex = signal(0);
|
||||
readonly currentBook = computed<Book | null>(() => {
|
||||
const proposal = this.proposals()[this.currentIndex()];
|
||||
if (!proposal) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.bookService.findBookById(proposal.bookId) ?? null;
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const proposals = this.proposals();
|
||||
if (proposals.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bookIds = new Set(proposals.map(proposal => proposal.bookId));
|
||||
const matchedBooks = this.bookService.books().filter(book => bookIds.has(book.id));
|
||||
this.loading = matchedBooks.length !== bookIds.size;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const taskId = this.config.data?.taskId;
|
||||
if (!taskId) {
|
||||
this.dialogRef.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.metadataTaskService.getTaskWithProposals(taskId).subscribe({
|
||||
next: (task) => {
|
||||
this.proposals.set(task.proposals || []);
|
||||
this.currentIndex.set(0);
|
||||
},
|
||||
error: () => {
|
||||
this.dialogRef.close();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
get currentProposal(): FetchedProposal | null {
|
||||
return this.proposals()[this.currentIndex()] ?? null;
|
||||
}
|
||||
|
||||
onSave(): void {
|
||||
const currentProposal = this.currentProposal;
|
||||
if (!currentProposal) return;
|
||||
this.pickerComponent.onSave();
|
||||
this.metadataTaskService.updateProposalStatus(currentProposal.taskId, currentProposal.proposalId, 'ACCEPTED').subscribe({
|
||||
next: () => {
|
||||
if (this.isLast) {
|
||||
this.metadataTaskService.deleteTask(currentProposal.taskId).subscribe(() => {
|
||||
this.progressService.clearTask(currentProposal.taskId);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onNext(): void {
|
||||
const nextIndex = this.currentIndex() + 1;
|
||||
if (nextIndex >= this.proposals().length) {
|
||||
this.dialogRef.close();
|
||||
} else {
|
||||
this.currentIndex.set(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
lockAllMetadata(): void {
|
||||
this.pickerComponent?.lockAll();
|
||||
}
|
||||
|
||||
unlockAllMetadata(): void {
|
||||
this.pickerComponent?.unlockAll();
|
||||
}
|
||||
|
||||
get isLast(): boolean {
|
||||
return this.currentIndex() === this.proposals().length - 1;
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user