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:
+52
@@ -0,0 +1,52 @@
|
||||
<div class="multi-book-editor-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">Edit Metadata</h2>
|
||||
<p class="panel-description">{{ filteredBooks().length }} book{{ filteredBooks().length !== 1 ? 's' : '' }} selected</p>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[rounded]="true"
|
||||
[text]="true"
|
||||
severity="secondary"
|
||||
(click)="ref.close()"
|
||||
class="close-button">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<p-tabs [value]="'edit'" lazy="true">
|
||||
<p-tablist>
|
||||
@if (admin || canEditMetadata) {
|
||||
<p-tab value="edit">Edit Metadata</p-tab>
|
||||
}
|
||||
@if (admin || canEditMetadata) {
|
||||
<p-tab value="match">Search Metadata</p-tab>
|
||||
}
|
||||
</p-tablist>
|
||||
<p-tabpanels>
|
||||
@if (admin || canEditMetadata) {
|
||||
<p-tabpanel value="edit">
|
||||
<app-metadata-editor
|
||||
[book]="currentBook()"
|
||||
[disableNext]="disableNext"
|
||||
[disablePrevious]="disablePrevious"
|
||||
(nextBookClicked)="handleNextBook()"
|
||||
(previousBookClicked)="handlePreviousBook()"
|
||||
(closeDialogButtonClicked)="handleCloseDialogButton()"
|
||||
[showNavigationButtons]="true"
|
||||
></app-metadata-editor>
|
||||
</p-tabpanel>
|
||||
}
|
||||
@if (admin || canEditMetadata) {
|
||||
<p-tabpanel value="match">
|
||||
<app-metadata-searcher [book]="currentBook()"></app-metadata-searcher>
|
||||
</p-tabpanel>
|
||||
}
|
||||
</p-tabpanels>
|
||||
</p-tabs>
|
||||
</div>
|
||||
</div>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
@use '../../../../shared/styles/panel-shared' as panel;
|
||||
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.multi-book-editor-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
@include panel.panel-header;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
background: var(--card-background);
|
||||
border: 1px solid var(--border-color);
|
||||
border-top: none;
|
||||
border-radius: 0 0 10px 10px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||
|
||||
::ng-deep {
|
||||
p-tabs {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.p-tabpanels {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
import {Component, computed, effect, inject, signal} from '@angular/core';
|
||||
import {Tab, TabList, TabPanel, TabPanels, Tabs} from 'primeng/tabs';
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {MetadataEditorComponent} from '../book-metadata-center/metadata-editor/metadata-editor.component';
|
||||
import {MetadataSearcherComponent} from '../book-metadata-center/metadata-searcher/metadata-searcher.component';
|
||||
import {Button} from 'primeng/button';
|
||||
import {injectQuery} from '@tanstack/angular-query-experimental';
|
||||
|
||||
@Component({
|
||||
selector: 'app-multi-book-metadata-editor-component',
|
||||
imports: [
|
||||
MetadataEditorComponent,
|
||||
MetadataSearcherComponent,
|
||||
Tab,
|
||||
TabList,
|
||||
TabPanel,
|
||||
TabPanels,
|
||||
Tabs,
|
||||
Button
|
||||
],
|
||||
templateUrl: './multi-book-metadata-editor-component.html',
|
||||
standalone: true,
|
||||
styleUrl: './multi-book-metadata-editor-component.scss'
|
||||
})
|
||||
export class MultiBookMetadataEditorComponent {
|
||||
|
||||
private readonly config = inject(DynamicDialogConfig);
|
||||
readonly ref = inject(DynamicDialogRef);
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly userService = inject(UserService);
|
||||
bookIds: number[] = this.config.data?.bookIds ?? [];
|
||||
loading = false;
|
||||
|
||||
filteredBooks = computed(() => this.bookService.books().filter(book =>
|
||||
!!book.metadata && this.bookIds.includes(book.id)
|
||||
));
|
||||
private currentIndex = signal(0);
|
||||
private currentBookId = computed(() => this.filteredBooks()[this.currentIndex()]?.id ?? null);
|
||||
private bookDetailQuery = injectQuery(() => ({
|
||||
...this.bookService.bookDetailQueryOptions(this.currentBookId() ?? -1, true),
|
||||
enabled: this.currentBookId() != null,
|
||||
}));
|
||||
readonly currentBook = computed(() => this.bookDetailQuery.data() ?? null);
|
||||
|
||||
canEditMetadata = false;
|
||||
admin = false;
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const user = this.userService.currentUser();
|
||||
if (!user) return;
|
||||
this.canEditMetadata = user.permissions?.canEditMetadata ?? false;
|
||||
this.admin = user.permissions?.admin ?? false;
|
||||
});
|
||||
}
|
||||
|
||||
handleNextBook() {
|
||||
const next = this.currentIndex() + 1;
|
||||
if (next < this.filteredBooks().length) {
|
||||
this.currentIndex.set(next);
|
||||
}
|
||||
}
|
||||
|
||||
handlePreviousBook() {
|
||||
const prev = this.currentIndex() - 1;
|
||||
if (prev >= 0) {
|
||||
this.currentIndex.set(prev);
|
||||
}
|
||||
}
|
||||
|
||||
handleCloseDialogButton() {
|
||||
this.ref.close();
|
||||
}
|
||||
|
||||
get disableNext(): boolean {
|
||||
return this.currentIndex() >= this.filteredBooks().length - 1;
|
||||
}
|
||||
|
||||
get disablePrevious(): boolean {
|
||||
return this.currentIndex() <= 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user