Merge pull request #675 from adityachandelgit/develop
Merge Develop into Master for release
This commit is contained in:
+194
@@ -0,0 +1,194 @@
|
||||
# Contributing to Booklore
|
||||
|
||||
🎉 Thanks for your interest in contributing to **Booklore**, a modern, self-hostable digital library system for books and comics. Whether you're fixing bugs, adding features, improving documentation, or asking questions - your contribution matters!
|
||||
|
||||
---
|
||||
|
||||
## 📚 Overview
|
||||
|
||||
**Booklore** is a self-hostable platform designed to manage and read books and comics. It includes:
|
||||
|
||||
- **Frontend**: Angular 20, TypeScript, PrimeNG 19, Tailwind CSS
|
||||
- **Backend**: Java 21, Spring Boot 3.5
|
||||
- **Authentication**: Local JWT + optional OIDC (e.g. Authentik)
|
||||
- **Database**: MariaDB
|
||||
- **Deployment**: Docker-compatible, reverse proxy-ready
|
||||
|
||||
---
|
||||
|
||||
## 📦 Project Structure
|
||||
|
||||
```
|
||||
booklore/
|
||||
├── booklore-ui/ # Angular frontend
|
||||
├── booklore-api/ # Spring Boot backend
|
||||
├── assets/ # Shared assets
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
1. **Fork the repository** on GitHub
|
||||
2. **Clone your fork** locally:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/adityachandelgit/BookLore.git
|
||||
cd booklore
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧱 Local Development Setup
|
||||
|
||||
### 1. Prerequisites
|
||||
|
||||
- **Java 21+**
|
||||
- **Node.js 18+**
|
||||
- **MariaDB**
|
||||
- **Docker and Docker Compose**
|
||||
|
||||
---
|
||||
|
||||
### 2. Frontend Setup
|
||||
|
||||
To set up the Angular frontend:
|
||||
|
||||
```bash
|
||||
cd booklore-ui
|
||||
npm install
|
||||
ng serve
|
||||
```
|
||||
|
||||
The dev server runs at `http://localhost:4200/`.
|
||||
|
||||
> ⚠️ Use `--force` with `npm install` only as a last resort for dependency conflicts.
|
||||
|
||||
---
|
||||
|
||||
### 3. Backend Setup
|
||||
|
||||
#### a. Configure `application-dev.yml`
|
||||
|
||||
Create or edit `booklore-api/src/main/resources/application-dev.yml`:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
path-book: '/path/to/booklore/books' # Directory for book/comic files
|
||||
path-config: '/path/to/booklore/config' # Directory for thumbnails, metadata, etc.
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
url: jdbc:mariadb://localhost:3333/booklore?createDatabaseIfNotExist=true
|
||||
username: root
|
||||
password: Password123
|
||||
```
|
||||
|
||||
> 🔧 Replace `/path/to/...` with actual local paths
|
||||
|
||||
#### b. Run the Backend
|
||||
|
||||
```bash
|
||||
cd booklore-api
|
||||
./gradlew bootRun
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Frontend
|
||||
|
||||
Run unit tests using:
|
||||
|
||||
```bash
|
||||
cd booklore-ui
|
||||
ng test
|
||||
```
|
||||
|
||||
### Backend
|
||||
|
||||
Run backend tests using:
|
||||
|
||||
```bash
|
||||
cd booklore-api
|
||||
./gradlew test
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Contributing Guidelines
|
||||
|
||||
### 💡 Bug Reports
|
||||
|
||||
- Check [existing issues](https://github.com/adityachandelgit/BookLore/issues)
|
||||
- Include reproduction steps, expected vs. actual behavior, and logs if possible
|
||||
|
||||
### 🌟 Feature Requests
|
||||
|
||||
- Clearly explain the use case and benefit
|
||||
- Label the issue with `feature`
|
||||
|
||||
### 🔃 Code Contributions
|
||||
|
||||
- Create a feature branch:
|
||||
|
||||
```bash
|
||||
git checkout -b feat/my-feature
|
||||
```
|
||||
|
||||
- For bug fixes:
|
||||
|
||||
```bash
|
||||
git checkout -b fix/my-fix
|
||||
```
|
||||
|
||||
- Follow code conventions, keep PRs focused and scoped
|
||||
- Link the relevant issue in your PR
|
||||
- Test your changes
|
||||
- Target the `master` branch when opening PRs
|
||||
|
||||
---
|
||||
|
||||
## 🧼 Code Style & Conventions
|
||||
|
||||
- **Angular**: Follow the [official style guide](https://angular.io/guide/styleguide)
|
||||
- **Java**: Use modern features (Java 17+), clean structure
|
||||
- **Format**: Use linters and Prettier where applicable
|
||||
- **UI**: Use Tailwind CSS and PrimeNG components consistently
|
||||
|
||||
---
|
||||
|
||||
## 📝 Commit Message Format
|
||||
|
||||
Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
||||
|
||||
Examples:
|
||||
|
||||
- `feat: add column visibility setting to book table`
|
||||
- `fix: correct metadata locking behavior`
|
||||
- `docs: improve contributing instructions`
|
||||
|
||||
---
|
||||
|
||||
## 🙏 Code of Conduct
|
||||
|
||||
Please be respectful, inclusive, and collaborative. Harassment, abuse, or discrimination of any kind will not be tolerated.
|
||||
|
||||
---
|
||||
|
||||
## 💬 Community & Support
|
||||
|
||||
- Use [GitHub Discussions](https://github.com/adityachandelgit/BookLore/discussions)
|
||||
- Discord server: https://discord.gg/Ee5hd458Uz
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
Booklore is open-source and licensed under the MIT License. See [`LICENSE`](./LICENSE) for details.
|
||||
|
||||
---
|
||||
|
||||
Happy contributing!
|
||||
@@ -124,4 +124,11 @@ public class BookController {
|
||||
bookService.updateReadStatus(bookId, request.status());
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@PostMapping("/{bookId}/reset-progress")
|
||||
@CheckBookAccess(bookIdParam = "bookId")
|
||||
public ResponseEntity<Book> resetProgress(@PathVariable long bookId) {
|
||||
Book book = bookService.resetProgress(bookId);
|
||||
return ResponseEntity.ok(book);
|
||||
}
|
||||
}
|
||||
+6
@@ -6,12 +6,14 @@ import com.adityachandel.booklore.model.dto.settings.SidebarSortOption;
|
||||
import com.adityachandel.booklore.model.dto.settings.UserSettingKey;
|
||||
import com.adityachandel.booklore.model.entity.BookLoreUserEntity;
|
||||
import com.adityachandel.booklore.model.entity.UserSettingEntity;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@@ -58,6 +60,10 @@ public class BookLoreUserTransformer {
|
||||
case SIDEBAR_LIBRARY_SORTING -> userSettings.setSidebarLibrarySorting(objectMapper.readValue(value, SidebarSortOption.class));
|
||||
case SIDEBAR_SHELF_SORTING -> userSettings.setSidebarShelfSorting(objectMapper.readValue(value, SidebarSortOption.class));
|
||||
case ENTITY_VIEW_PREFERENCES -> userSettings.setEntityViewPreferences(objectMapper.readValue(value, BookLoreUser.UserSettings.EntityViewPreferences.class));
|
||||
case TABLE_COLUMN_PREFERENCE -> userSettings.setTableColumnPreference(
|
||||
objectMapper.readValue(value, new TypeReference<>() {
|
||||
})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
switch (settingKey) {
|
||||
|
||||
@@ -42,9 +42,20 @@ public class BookLoreUser {
|
||||
public SidebarSortOption sidebarLibrarySorting;
|
||||
public SidebarSortOption sidebarShelfSorting;
|
||||
public EntityViewPreferences entityViewPreferences;
|
||||
public List<TableColumnPreference> tableColumnPreference;
|
||||
public String filterSortingMode;
|
||||
public String metadataCenterViewMode;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class TableColumnPreference {
|
||||
private String field;
|
||||
private Boolean visible;
|
||||
private Integer order;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ public enum UserSettingKey {
|
||||
SIDEBAR_LIBRARY_SORTING("sidebarLibrarySorting", true),
|
||||
SIDEBAR_SHELF_SORTING("sidebarShelfSorting", true),
|
||||
ENTITY_VIEW_PREFERENCES("entityViewPreferences", true),
|
||||
TABLE_COLUMN_PREFERENCE("tableColumnPreference", true),
|
||||
FILTER_SORTING_MODE("filterSortingMode", false),
|
||||
METADATA_CENTER_VIEW_MODE("metadataCenterViewMode", false);
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import lombok.*;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@@ -41,10 +40,6 @@ public class BookEntity {
|
||||
@Column(name = "metadata_match_score")
|
||||
private Float metadataMatchScore;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "read_status")
|
||||
private ReadStatus readStatus;
|
||||
|
||||
@OneToOne(mappedBy = "book", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private BookMetadataEntity metadata;
|
||||
|
||||
|
||||
+5
@@ -1,5 +1,6 @@
|
||||
package com.adityachandel.booklore.model.entity;
|
||||
|
||||
import com.adityachandel.booklore.model.enums.ReadStatus;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
@@ -46,4 +47,8 @@ public class UserBookProgressEntity {
|
||||
|
||||
@Column(name = "cbx_progress_percent")
|
||||
private Float cbxProgressPercent;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "read_status")
|
||||
private ReadStatus readStatus;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,8 @@ import com.adityachandel.booklore.model.entity.*;
|
||||
import com.adityachandel.booklore.model.enums.BookFileType;
|
||||
import com.adityachandel.booklore.model.enums.ReadStatus;
|
||||
import com.adityachandel.booklore.repository.*;
|
||||
import com.adityachandel.booklore.service.appsettings.AppSettingService;
|
||||
import com.adityachandel.booklore.util.FileService;
|
||||
import com.adityachandel.booklore.util.FileUtils;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
@@ -270,6 +268,7 @@ public class BookService {
|
||||
.build());
|
||||
}
|
||||
book.setFilePath(FileUtils.getBookFullPath(bookEntity));
|
||||
book.setReadStatus(String.valueOf(userProgress.getReadStatus()));
|
||||
|
||||
if (!withDescription) {
|
||||
book.getMetadata().setDescription(null);
|
||||
@@ -278,6 +277,24 @@ public class BookService {
|
||||
return book;
|
||||
}
|
||||
|
||||
public Book resetProgress(long bookId) {
|
||||
BookLoreUser user = authenticationService.getAuthenticatedUser();
|
||||
BookEntity bookEntity = bookRepository.findById(bookId).orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
|
||||
|
||||
UserBookProgressEntity progress = userBookProgressRepository.findByUserIdAndBookId(user.getId(), bookId).orElse(new UserBookProgressEntity());
|
||||
progress.setBook(bookEntity);
|
||||
progress.setReadStatus(null);
|
||||
progress.setLastReadTime(null);
|
||||
progress.setPdfProgress(null);
|
||||
progress.setPdfProgressPercent(null);
|
||||
progress.setEpubProgress(null);
|
||||
progress.setEpubProgressPercent(null);
|
||||
progress.setCbxProgress(null);
|
||||
progress.setCbxProgressPercent(null);
|
||||
userBookProgressRepository.save(progress);
|
||||
return bookMapper.toBook(bookEntity);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public List<Book> assignShelvesToBooks(Set<Long> bookIds, Set<Long> shelfIdsToAssign, Set<Long> shelfIdsToUnassign) {
|
||||
@@ -336,6 +353,18 @@ public class BookService {
|
||||
userBookProgressRepository.save(userBookProgress);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateReadStatus(Long bookId, String status) {
|
||||
BookEntity book = bookRepository.findById(bookId).orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
|
||||
BookLoreUser user = authenticationService.getAuthenticatedUser();
|
||||
UserBookProgressEntity userBookProgress = userBookProgressRepository.findByUserIdAndBookId(user.getId(), book.getId()).orElse(new UserBookProgressEntity());
|
||||
userBookProgress.setUser(userRepository.findById(user.getId()).orElseThrow(() -> new UsernameNotFoundException("User not found")));
|
||||
userBookProgress.setBook(book);
|
||||
ReadStatus readStatus = EnumUtils.getEnumIgnoreCase(ReadStatus.class, status);
|
||||
userBookProgress.setReadStatus(readStatus);
|
||||
userBookProgressRepository.save(userBookProgress);
|
||||
}
|
||||
|
||||
public ResponseEntity<Resource> downloadBook(Long bookId) {
|
||||
try {
|
||||
BookEntity bookEntity = bookRepository.findById(bookId).orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
|
||||
@@ -455,11 +484,4 @@ public class BookService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateReadStatus(long bookId, @NotBlank String status) {
|
||||
BookEntity bookEntity = bookRepository.findById(bookId).orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
|
||||
ReadStatus readStatus = EnumUtils.getEnumIgnoreCase(ReadStatus.class, status);
|
||||
bookEntity.setReadStatus(readStatus);
|
||||
bookRepository.save(bookEntity);
|
||||
}
|
||||
}
|
||||
+1
@@ -29,6 +29,7 @@ public class DefaultUserSettingsProvider {
|
||||
defaultSettings.put(UserSettingKey.SIDEBAR_LIBRARY_SORTING, this::buildDefaultSidebarLibrarySorting);
|
||||
defaultSettings.put(UserSettingKey.SIDEBAR_SHELF_SORTING, this::buildDefaultSidebarShelfSorting);
|
||||
defaultSettings.put(UserSettingKey.ENTITY_VIEW_PREFERENCES, this::buildDefaultEntityViewPreferences);
|
||||
defaultSettings.put(UserSettingKey.TABLE_COLUMN_PREFERENCE, () -> null);
|
||||
defaultSettings.put(UserSettingKey.FILTER_SORTING_MODE, () -> "count");
|
||||
defaultSettings.put(UserSettingKey.METADATA_CENTER_VIEW_MODE, () -> "route");
|
||||
}
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE user_book_progress
|
||||
ADD COLUMN read_status VARCHAR(20);
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-4 flex-shrink-0">
|
||||
<div class="flex flex-wrap items-center gap-4">
|
||||
<div class="flex flex-wrap items-center gap-4 md:gap-6">
|
||||
@if (isFilterActive) {
|
||||
<a class="topbar-items topbar-item" (click)="clearFilter()">
|
||||
<i
|
||||
@@ -48,6 +48,42 @@
|
||||
</i>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (currentViewMode === 'table') {
|
||||
<div>
|
||||
<a class="topbar-items topbar-item" (click)="columnPopover.toggle($event)">
|
||||
<i
|
||||
class="pi pi-eye"
|
||||
pTooltip="Visible columns"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
</a>
|
||||
<p-popover #columnPopover [dismissable]="true" appendTo="body">
|
||||
<div class="w-[200px]">
|
||||
<p-multiSelect
|
||||
optionLabel="header"
|
||||
[options]="columnPreferenceService.allColumns"
|
||||
[(ngModel)]="visibleColumns"
|
||||
(ngModelChange)="onVisibleColumnsChange($event)"
|
||||
display="chip"
|
||||
placeholder="Select Columns"
|
||||
[style]="{ width: '100%' }"
|
||||
[filter]="true"
|
||||
[showClear]="true"
|
||||
></p-multiSelect>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 pt-4 pl-1">
|
||||
<p>Set as default?</p>
|
||||
<p-button
|
||||
label="Save"
|
||||
outlined
|
||||
size="small"
|
||||
(click)="columnPreferenceService.saveVisibleColumns(visibleColumns)"></p-button>
|
||||
</div>
|
||||
</p-popover>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
<a
|
||||
class="topbar-items topbar-item"
|
||||
@@ -82,7 +118,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label class="font-medium text-sm">Sidbar Filter Sort:</label>
|
||||
<label class="font-medium text-sm">Sidebar Filter Sort:</label>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
@@ -181,7 +217,6 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
<p-button
|
||||
class="pr-2"
|
||||
icon="pi pi-chevron-right"
|
||||
@@ -223,6 +258,7 @@
|
||||
[books]="books"
|
||||
(selectedBooksChange)="onSelectedBooksChange($event)"
|
||||
[sortOption]="this.bookSorter.selectedSort!"
|
||||
[visibleColumns]="visibleColumns"
|
||||
></app-book-table>
|
||||
}
|
||||
@if (currentViewMode === 'grid') {
|
||||
|
||||
@@ -41,6 +41,8 @@ import {Slider} from 'primeng/slider';
|
||||
import {Select} from 'primeng/select';
|
||||
import {FilterSortPreferenceService} from './filters/filter-sorting-preferences.service';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {MultiSelect} from 'primeng/multiselect';
|
||||
import {TableColumnPreferenceService} from './table-column-preference-service';
|
||||
|
||||
export enum EntityType {
|
||||
LIBRARY = 'Library',
|
||||
@@ -73,7 +75,7 @@ const SORT_DIRECTION = {
|
||||
standalone: true,
|
||||
templateUrl: './book-browser.component.html',
|
||||
styleUrls: ['./book-browser.component.scss'],
|
||||
imports: [Button, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, PrimeTemplate, NgStyle, OverlayPanelModule, DropdownModule, Checkbox, Popover, Slider, Select, Divider],
|
||||
imports: [Button, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, PrimeTemplate, NgStyle, OverlayPanelModule, DropdownModule, Checkbox, Popover, Slider, Select, Divider, MultiSelect],
|
||||
providers: [SeriesCollapseFilter],
|
||||
animations: [
|
||||
trigger('slideInOut', [
|
||||
@@ -113,6 +115,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild(BookTableComponent) bookTableComponent!: BookTableComponent;
|
||||
@ViewChild(BookFilterComponent) bookFilterComponent!: BookFilterComponent;
|
||||
|
||||
visibleColumns: { field: string; header: string }[] = [];
|
||||
|
||||
selectedFilter = new BehaviorSubject<Record<string, any> | null>(null);
|
||||
selectedFilterMode = new BehaviorSubject<'and' | 'or'>('and');
|
||||
protected resetFilterSubject = new Subject<void>();
|
||||
@@ -122,6 +126,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
protected userService = inject(UserService);
|
||||
protected coverScalePreferenceService = inject(CoverScalePreferenceService);
|
||||
protected filterSortPreferenceService = inject(FilterSortPreferenceService);
|
||||
protected columnPreferenceService = inject(TableColumnPreferenceService);
|
||||
|
||||
private activatedRoute = inject(ActivatedRoute);
|
||||
private messageService = inject(MessageService);
|
||||
@@ -142,7 +147,6 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
|
||||
currentViewMode: string | undefined = undefined;
|
||||
lastAppliedSort: SortOption | null = null;
|
||||
filterVisibility = true;
|
||||
private settingFiltersFromUrl = false;
|
||||
protected metadataMenuItems: MenuItem[] | undefined;
|
||||
currentBooks: Book[] = [];
|
||||
@@ -161,6 +165,13 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
this.coverScalePreferenceService.setScale(this.coverScalePreferenceService.scaleFactor);
|
||||
}
|
||||
|
||||
onVisibleColumnsChange(selected: any[]) {
|
||||
const allFields = this.bookTableComponent.allColumns.map(col => col.field);
|
||||
this.visibleColumns = selected.sort(
|
||||
(a, b) => allFields.indexOf(a.field) - allFields.indexOf(b.field)
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.coverScalePreferenceService.scaleChange$.pipe(debounceTime(1000)).subscribe();
|
||||
|
||||
@@ -218,6 +229,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
combineLatest({
|
||||
paramMap: this.activatedRoute.queryParamMap,
|
||||
user: this.userService.userState$.pipe(
|
||||
@@ -229,7 +241,6 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
const viewParam = paramMap.get(QUERY_PARAMS.VIEW);
|
||||
const sortParam = paramMap.get(QUERY_PARAMS.SORT);
|
||||
const directionParam = paramMap.get(QUERY_PARAMS.DIRECTION);
|
||||
const sidebarParam = paramMap.get(QUERY_PARAMS.SIDEBAR);
|
||||
const filterParams = paramMap.get(QUERY_PARAMS.FILTER);
|
||||
|
||||
const parsedFilters: Record<string, string[]> = {};
|
||||
@@ -270,6 +281,9 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
const currentEntityTypeStr = this.entityType ? this.entityType.toString().toUpperCase() : undefined;
|
||||
this.coverScalePreferenceService.initScaleValue(user?.userSettings?.entityViewPreferences?.global?.coverSize);
|
||||
this.filterSortPreferenceService.initValue(user?.userSettings?.filterSortingMode);
|
||||
this.columnPreferenceService.initPreferences(user.userSettings?.tableColumnPreference);
|
||||
this.visibleColumns = this.columnPreferenceService.visibleColumns;
|
||||
|
||||
|
||||
const override = this.entityViewPreferences?.overrides?.find(o =>
|
||||
o.entityType?.toUpperCase() === currentEntityTypeStr &&
|
||||
|
||||
+14
-7
@@ -4,13 +4,20 @@
|
||||
(mouseout)="isHovered = false">
|
||||
|
||||
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
[class.loaded]="isImageLoaded"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
loading="lazy"
|
||||
(load)="onImageLoad()"/>
|
||||
<div
|
||||
class="cover-container"
|
||||
[ngClass]="{
|
||||
'center-info-btn': readButtonHidden,
|
||||
'loaded': isImageLoaded
|
||||
}">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
[class.loaded]="isImageLoaded"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
loading="lazy"
|
||||
(load)="onImageLoad()" />
|
||||
</div>
|
||||
|
||||
@if (book.metadata?.seriesNumber != null) {
|
||||
<div class="series-number-overlay">
|
||||
|
||||
+7
-14
@@ -1,6 +1,6 @@
|
||||
.book-card {
|
||||
background-color: var(--card-background);
|
||||
border-radius: 0 0 8px 8px;
|
||||
border-radius: 8px 8px 8px 8px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: border 0.2s;
|
||||
@@ -13,25 +13,18 @@
|
||||
.cover-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 5/7;
|
||||
background-color: var(--card-background);
|
||||
border-radius: 8px 8px 0 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.cover-container.shimmer {
|
||||
/*background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 2.5s infinite linear;*/
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
.cover-container.loaded {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.book-cover {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Optional, Output, ViewChild} from '@angular/core';
|
||||
import {Book, BookMetadata} from '../../../model/book.model';
|
||||
import {Component, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Output, ViewChild} from '@angular/core';
|
||||
import {Book} from '../../../model/book.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MenuModule} from 'primeng/menu';
|
||||
import {ConfirmationService, MenuItem, MessageService} from 'primeng/api';
|
||||
@@ -20,7 +20,6 @@ import {TieredMenu} from 'primeng/tieredmenu';
|
||||
import {BookSenderComponent} from '../../book-sender/book-sender.component';
|
||||
import {Router} from '@angular/router';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {BookMetadataHostService} from '../../../../book-metadata-host-service';
|
||||
import {BookMetadataCenterComponent} from '../../../metadata/book-metadata-center/book-metadata-center.component';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
|
||||
@@ -32,9 +31,10 @@ import {takeUntil} from 'rxjs/operators';
|
||||
standalone: true
|
||||
})
|
||||
export class BookCardComponent implements OnInit, OnDestroy {
|
||||
@Input() index!: number;
|
||||
|
||||
@Output() checkboxClick = new EventEmitter<{ index: number; bookId: number; selected: boolean; shiftKey: boolean }>();
|
||||
|
||||
@Input() index!: number;
|
||||
@Input() book!: Book;
|
||||
@Input() isCheckboxEnabled: boolean = false;
|
||||
@Input() onBookSelect?: (bookId: number, selected: boolean) => void;
|
||||
@@ -62,7 +62,6 @@ export class BookCardComponent implements OnInit, OnDestroy {
|
||||
private metadataCenterViewMode: 'route' | 'dialog' = 'route';
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.userService.userState$
|
||||
.pipe(
|
||||
@@ -312,12 +311,6 @@ export class BookCardComponent implements OnInit, OnDestroy {
|
||||
return this.isAdmin() || (this.userPermissions?.canDeleteBook ?? false);
|
||||
}
|
||||
|
||||
isMetadataFullyLocked(metadata: BookMetadata): boolean {
|
||||
const lockedKeys = Object.keys(metadata).filter(key => key.endsWith('Locked'));
|
||||
if (lockedKeys.length === 0) return false;
|
||||
return lockedKeys.every(key => metadata[key] === true);
|
||||
}
|
||||
|
||||
private lastMouseEvent: MouseEvent | null = null;
|
||||
|
||||
captureMouseEvent(event: MouseEvent): void {
|
||||
|
||||
+38
-93
@@ -1,9 +1,12 @@
|
||||
<p-table
|
||||
[value]="books"
|
||||
[columns]="visibleColumns"
|
||||
[dataKey]="'id'"
|
||||
[resizableColumns]="true"
|
||||
[metaKeySelection]="true"
|
||||
[reorderableColumns]="true"
|
||||
columnResizeMode="expand"
|
||||
[rowTrackBy]="trackByBookId"
|
||||
[metaKeySelection]="true"
|
||||
showGridlines
|
||||
stripedRows
|
||||
[scrollable]="true"
|
||||
@@ -13,39 +16,26 @@
|
||||
[(selection)]="selectedBooks"
|
||||
(onHeaderCheckboxToggle)="onHeaderCheckboxToggle($event)"
|
||||
(onRowSelect)="onRowSelect($event)"
|
||||
(onRowUnselect)="onRowUnselect($event)">
|
||||
<ng-template #header>
|
||||
(onRowUnselect)="onRowUnselect($event)"
|
||||
>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>
|
||||
<p-tableHeaderCheckbox/>
|
||||
</th>
|
||||
<th pResizableColumn></th>
|
||||
<th></th>
|
||||
<th class="max-w-14 min-w-14"></th>
|
||||
<th pResizableColumn>Title</th>
|
||||
<th pResizableColumn>Authors</th>
|
||||
<th pResizableColumn>Publisher</th>
|
||||
<th pResizableColumn>Series</th>
|
||||
<th pResizableColumn>#</th>
|
||||
<th pResizableColumn>Genres</th>
|
||||
<th>Published</th>
|
||||
<th>Last Read</th>
|
||||
<th>Added</th>
|
||||
<th>File Size</th>
|
||||
<th>Lang</th>
|
||||
<th>Pages</th>
|
||||
<th>Amazon</th>
|
||||
<th>Amz #</th>
|
||||
<th>Goodreads</th>
|
||||
<th>GR #</th>
|
||||
<th>Hardcover</th>
|
||||
<th>HC #</th>
|
||||
@for (col of visibleColumns; track col.field) {
|
||||
<th pResizableColumn>{{ col.header }}</th>
|
||||
}
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-book>
|
||||
|
||||
<ng-template pTemplate="body" let-book>
|
||||
@if (book.metadata; as metadata) {
|
||||
<tr style="height:46px">
|
||||
<td class="max-w-16">
|
||||
<p-tableCheckbox [value]="book"></p-tableCheckbox>
|
||||
<td>
|
||||
<p-tableCheckbox [value]="book"/>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<p-button
|
||||
@@ -59,75 +49,30 @@
|
||||
</p-button>
|
||||
</td>
|
||||
<td (click)="openMetadataCenter(book.id)">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
<img [attr.src]="urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
</td>
|
||||
<td class="min-w-[18rem] max-w-[25rem] overflow-hidden truncate" [title]="metadata.title">{{ metadata.title }}</td>
|
||||
<td class="min-w-[10rem] max-w-[20rem] overflow-hidden truncate" [title]="getAuthorNames(metadata.authors)">{{ getAuthorNames(metadata.authors) }}</td>
|
||||
<td class="min-w-[10rem] max-w-[25rem] overflow-hidden truncate" [title]="metadata.publisher">{{ metadata.publisher }}</td>
|
||||
<td class="min-w-[10rem] max-w-[25rem] overflow-hidden truncate" [title]="metadata.seriesName">{{ metadata.seriesName }}</td>
|
||||
<td class="min-w-[1rem] max-w-[4rem] overflow-hidden truncate" [title]="metadata.seriesNumber">{{ metadata.seriesNumber }}</td>
|
||||
<td class="min-w-[12rem] max-w-[18rem] overflow-hidden truncate" [title]="getGenres(metadata.categories)">{{ getGenres(metadata.categories) }}</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate">
|
||||
{{ metadata.publishedDate ? (metadata.publishedDate | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.lastReadTime ? (book.lastReadTime | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.addedOn ? (book.addedOn | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[9rem] overflow-hidden truncate"
|
||||
[title]="book.fileSizeKb + ' KB'">
|
||||
{{ formatFileSize(book.fileSizeKb) }}
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.language }}</td>
|
||||
<td class="min-w-[4rem] max-w-[5rem] overflow-hidden truncate">{{ metadata.pageCount }}</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.amazonRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.amazonRating)">
|
||||
</p-rating>
|
||||
@if (metadata.amazonRating != null) {
|
||||
<span>({{ metadata.amazonRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.amazonReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.goodreadsRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.goodreadsRating)">
|
||||
</p-rating>
|
||||
@if (metadata.goodreadsRating != null) {
|
||||
<span>({{ metadata.goodreadsRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.goodreadsReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.hardcoverRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.hardcoverRating)">
|
||||
</p-rating>
|
||||
@if (metadata.hardcoverRating != null) {
|
||||
<span>({{ metadata.hardcoverRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.hardcoverReviewCount }}</td>
|
||||
|
||||
@for (col of visibleColumns; track col.field) {
|
||||
@if (col.field === 'amazonRating' || col.field === 'goodreadsRating' || col.field === 'hardcoverRating') {
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata[col.field]"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata[col.field])"
|
||||
></p-rating>
|
||||
@if (metadata[col.field] != null) {
|
||||
<span>({{ metadata[col.field]?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
} @else {
|
||||
<td [title]="getCellValue(metadata, book, col.field)" class="overflow-hidden truncate text-right min-w-[6rem] max-w-[12rem]">
|
||||
{{ getCellValue(metadata, book, col.field) }}
|
||||
</td>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
+96
-9
@@ -1,4 +1,4 @@
|
||||
import {Component, EventEmitter, inject, Input, OnChanges, OnInit, Output} from '@angular/core';
|
||||
import {Component, EventEmitter, inject, Input, OnChanges, OnDestroy, OnInit, Output} from '@angular/core';
|
||||
import {TableModule} from 'primeng/table';
|
||||
import {DatePipe} from '@angular/common';
|
||||
import {Rating} from 'primeng/rating';
|
||||
@@ -10,10 +10,11 @@ import {Button} from 'primeng/button';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {Router} from '@angular/router';
|
||||
import {filter} from 'rxjs';
|
||||
import {filter, Subject} from 'rxjs';
|
||||
import {UserService} from '../../../../settings/user-management/user.service';
|
||||
import {BookMetadataCenterComponent} from '../../../metadata/book-metadata-center/book-metadata-center.component';
|
||||
import {DialogService} from 'primeng/dynamicdialog';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-table',
|
||||
@@ -23,18 +24,19 @@ import {DialogService} from 'primeng/dynamicdialog';
|
||||
TableModule,
|
||||
Rating,
|
||||
FormsModule,
|
||||
Button,
|
||||
DatePipe
|
||||
Button
|
||||
],
|
||||
styleUrl: './book-table.component.scss'
|
||||
styleUrls: ['./book-table.component.scss'],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
export class BookTableComponent implements OnInit, OnChanges {
|
||||
export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
|
||||
selectedBooks: Book[] = [];
|
||||
selectedBookIds = new Set<number>();
|
||||
|
||||
@Output() selectedBooksChange = new EventEmitter<Set<number>>();
|
||||
@Input() books: Book[] = [];
|
||||
@Input() sortOption: SortOption | null = null;
|
||||
@Input() visibleColumns: any[] = [];
|
||||
|
||||
protected urlHelper = inject(UrlHelperService);
|
||||
private bookService = inject(BookService);
|
||||
@@ -42,18 +44,43 @@ export class BookTableComponent implements OnInit, OnChanges {
|
||||
private userService = inject(UserService);
|
||||
private dialogService = inject(DialogService);
|
||||
private router = inject(Router);
|
||||
private datePipe = inject(DatePipe);
|
||||
|
||||
private metadataCenterViewMode: 'route' | 'dialog' = 'route';
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
readonly allColumns = [
|
||||
{field: 'title', header: 'Title'},
|
||||
{field: 'authors', header: 'Authors'},
|
||||
{field: 'publisher', header: 'Publisher'},
|
||||
{field: 'seriesName', header: 'Series'},
|
||||
{field: 'seriesNumber', header: 'Series #'},
|
||||
{field: 'categories', header: 'Genres'},
|
||||
{field: 'publishedDate', header: 'Published'},
|
||||
{field: 'lastReadTime', header: 'Last Read'},
|
||||
{field: 'addedOn', header: 'Added'},
|
||||
{field: 'fileSizeKb', header: 'File Size'},
|
||||
{field: 'language', header: 'Language'},
|
||||
{field: 'pageCount', header: 'Pages'},
|
||||
{field: 'amazonRating', header: 'Amazon'},
|
||||
{field: 'amazonReviewCount', header: 'AZ #'},
|
||||
{field: 'goodreadsRating', header: 'Goodreads'},
|
||||
{field: 'goodreadsReviewCount', header: 'GR #'},
|
||||
{field: 'hardcoverRating', header: 'Hardcover'},
|
||||
{field: 'hardcoverReviewCount', header: 'HC #'}
|
||||
];
|
||||
|
||||
ngOnInit(): void {
|
||||
this.userService.userState$
|
||||
.pipe(filter(user => !!user))
|
||||
.subscribe((user) => {
|
||||
.pipe(
|
||||
filter(user => !!user),
|
||||
takeUntil(this.destroy$)
|
||||
)
|
||||
.subscribe(user => {
|
||||
this.metadataCenterViewMode = user?.userSettings.metadataCenterViewMode ?? 'route';
|
||||
});
|
||||
}
|
||||
|
||||
// Hack to set virtual-scroller height
|
||||
ngOnChanges() {
|
||||
const wrapperElements: HTMLCollection = document.getElementsByClassName('p-virtualscroller');
|
||||
Array.prototype.forEach.call(wrapperElements, function (wrapperElement) {
|
||||
@@ -147,6 +174,61 @@ export class BookTableComponent implements OnInit, OnChanges {
|
||||
return mb >= 1 ? `${mb.toFixed(1)} MB` : `${mb.toFixed(2)} MB`;
|
||||
}
|
||||
|
||||
getCellValue(metadata: BookMetadata, book: Book, field: string): string | number {
|
||||
switch (field) {
|
||||
case 'title':
|
||||
return metadata.title ?? '';
|
||||
|
||||
case 'authors':
|
||||
return this.getAuthorNames(metadata.authors!);
|
||||
|
||||
case 'publisher':
|
||||
return metadata.publisher ?? '';
|
||||
|
||||
case 'seriesName':
|
||||
return metadata.seriesName ?? '';
|
||||
|
||||
case 'seriesNumber':
|
||||
return metadata.seriesNumber ?? '';
|
||||
|
||||
case 'categories':
|
||||
return this.getGenres(metadata.categories!);
|
||||
|
||||
case 'publishedDate':
|
||||
return metadata.publishedDate ? this.datePipe.transform(metadata.publishedDate, 'dd-MMM-yyyy') ?? '' : '';
|
||||
|
||||
case 'lastReadTime':
|
||||
return book.lastReadTime ? this.datePipe.transform(book.lastReadTime, 'dd-MMM-yyyy') ?? '' : '';
|
||||
|
||||
case 'addedOn':
|
||||
return book.addedOn ? this.datePipe.transform(book.addedOn, 'dd-MMM-yyyy') ?? '' : '';
|
||||
|
||||
case 'fileSizeKb':
|
||||
return this.formatFileSize(book.fileSizeKb);
|
||||
|
||||
case 'language':
|
||||
return metadata.language ?? '';
|
||||
|
||||
case 'pageCount':
|
||||
return metadata.pageCount ?? '';
|
||||
|
||||
case 'amazonRating':
|
||||
case 'goodreadsRating':
|
||||
case 'hardcoverRating': {
|
||||
const rating = metadata[field];
|
||||
return typeof rating === 'number' ? rating.toFixed(1) : '';
|
||||
}
|
||||
|
||||
case 'amazonReviewCount':
|
||||
case 'goodreadsReviewCount':
|
||||
case 'hardcoverReviewCount':
|
||||
return metadata[field] ?? '';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
toggleMetadataLock(metadata: BookMetadata): void {
|
||||
const lockKeys = Object.keys(metadata).filter(key => key.endsWith('Locked'));
|
||||
const allLocked = lockKeys.every(key => metadata[key] === true);
|
||||
@@ -169,4 +251,9 @@ export class BookTableComponent implements OnInit, OnChanges {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject} from 'rxjs';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TableColumnPreference, UserService} from '../../../settings/user-management/user.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TableColumnPreferenceService {
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly messageService = inject(MessageService);
|
||||
|
||||
private readonly preferencesSubject = new BehaviorSubject<TableColumnPreference[]>([]);
|
||||
readonly preferences$ = this.preferencesSubject.asObservable();
|
||||
|
||||
private readonly allAvailableColumns = [
|
||||
{field: 'title', header: 'Title'},
|
||||
{field: 'authors', header: 'Authors'},
|
||||
{field: 'publisher', header: 'Publisher'},
|
||||
{field: 'seriesName', header: 'Series'},
|
||||
{field: 'seriesNumber', header: 'Series #'},
|
||||
{field: 'categories', header: 'Genres'},
|
||||
{field: 'publishedDate', header: 'Published'},
|
||||
{field: 'lastReadTime', header: 'Last Read'},
|
||||
{field: 'addedOn', header: 'Added'},
|
||||
{field: 'fileSizeKb', header: 'File Size'},
|
||||
{field: 'language', header: 'Language'},
|
||||
{field: 'pageCount', header: 'Pages'},
|
||||
{field: 'amazonRating', header: 'Amazon'},
|
||||
{field: 'amazonReviewCount', header: 'AZ #'},
|
||||
{field: 'goodreadsRating', header: 'Goodreads'},
|
||||
{field: 'goodreadsReviewCount', header: 'GR #'},
|
||||
{field: 'hardcoverRating', header: 'Hardcover'},
|
||||
{field: 'hardcoverReviewCount', header: 'HC #'}
|
||||
];
|
||||
|
||||
private readonly fallbackPreferences: TableColumnPreference[] = this.allAvailableColumns.map((col, index) => ({
|
||||
field: col.field,
|
||||
visible: true,
|
||||
order: index
|
||||
}));
|
||||
|
||||
initPreferences(savedPrefs: TableColumnPreference[] | undefined): void {
|
||||
const effectivePrefs = savedPrefs?.length ? savedPrefs : this.fallbackPreferences;
|
||||
this.preferencesSubject.next(this.mergeWithAllColumns(effectivePrefs));
|
||||
}
|
||||
|
||||
get allColumns(): { field: string; header: string }[] {
|
||||
return this.allAvailableColumns;
|
||||
}
|
||||
|
||||
get visibleColumns(): { field: string; header: string }[] {
|
||||
return this.preferencesSubject.value
|
||||
.filter(pref => pref.visible)
|
||||
.sort((a, b) => a.order - b.order)
|
||||
.map(pref => ({
|
||||
field: pref.field,
|
||||
header: this.getColumnHeader(pref.field)
|
||||
}));
|
||||
}
|
||||
|
||||
get preferences(): TableColumnPreference[] {
|
||||
return this.preferencesSubject.value;
|
||||
}
|
||||
|
||||
saveVisibleColumns(selectedColumns: { field: string }[]): void {
|
||||
const selectedFieldSet = new Set(selectedColumns.map(c => c.field));
|
||||
|
||||
const updatedPreferences: TableColumnPreference[] = this.allAvailableColumns.map((col, index) => {
|
||||
const selectionIndex = selectedColumns.findIndex(c => c.field === col.field);
|
||||
return {
|
||||
field: col.field,
|
||||
visible: selectedFieldSet.has(col.field),
|
||||
order: selectionIndex >= 0 ? selectionIndex : index
|
||||
};
|
||||
});
|
||||
|
||||
this.preferencesSubject.next(updatedPreferences);
|
||||
|
||||
const currentUser = this.userService.getCurrentUser();
|
||||
if (!currentUser) return;
|
||||
|
||||
this.userService.updateUserSetting(currentUser.id, 'tableColumnPreference', updatedPreferences);
|
||||
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Preferences Saved',
|
||||
detail: 'Your column layout has been saved.',
|
||||
life: 1500
|
||||
});
|
||||
}
|
||||
|
||||
private getColumnHeader(field: string): string {
|
||||
return this.allAvailableColumns.find(col => col.field === field)?.header ?? field;
|
||||
}
|
||||
|
||||
private mergeWithAllColumns(savedPrefs: TableColumnPreference[]): TableColumnPreference[] {
|
||||
const savedPrefMap = new Map(savedPrefs.map(p => [p.field, p]));
|
||||
|
||||
return this.allAvailableColumns.map((col, index) => {
|
||||
const saved = savedPrefMap.get(col.field);
|
||||
return {
|
||||
field: col.field,
|
||||
visible: saved?.visible ?? true,
|
||||
order: saved?.order ?? index
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
+103
-63
@@ -1,14 +1,14 @@
|
||||
@if (book$ | async; as book) {
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full min-w-[80rem]">
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full md:min-w-[80rem]">
|
||||
@if (isLoading) {
|
||||
<div class="absolute inset-0 bg-black opacity-25 z-10 "></div>
|
||||
}
|
||||
@if (isLoading) {
|
||||
<p-progressSpinner [style]="{position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)'}"></p-progressSpinner>
|
||||
}
|
||||
<div class="flex-grow overflow-auto py-2 px-2">
|
||||
<div class="flex flex-row w-full gap-4">
|
||||
<div class="flex flex-col items-center gap-2 relative">
|
||||
<div class="flex-grow overflow-auto md:py-2 md:px-2 ">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4">
|
||||
<div class="flex flex-col items-center gap-4 relative">
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
alt="Image"
|
||||
@@ -56,8 +56,8 @@
|
||||
</div>
|
||||
<div class="flex flex-col flex-grow pl-2">
|
||||
|
||||
<div class="flex flex-row w-full gap-4 pb-1">
|
||||
<div class="flex flex-col gap-1 w-2/3">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-2/3">
|
||||
<label for="title">Title</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="title" formControlName="title" class="w-full"/>
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/3">
|
||||
<div class="flex flex-col gap-1 md:w-1/3">
|
||||
<label for="subtitle">Subtitle</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="subtitle" formControlName="subtitle" class="w-full"/>
|
||||
@@ -83,8 +83,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 basis-[71%]">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:basis-[71%]">
|
||||
<label for="authors">Authors</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<div class="w-full">
|
||||
@@ -98,7 +98,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 basis-[20%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[20%]">
|
||||
<label for="publisher">Publisher</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="publisher" formControlName="publisher" class="w-full"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 basis-[14%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[14%]">
|
||||
<label for="language">Language</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="language" formControlName="language" class="w-full"/>
|
||||
@@ -124,7 +124,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-full">
|
||||
<label for="categories">Categories</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
@@ -140,11 +140,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 basis-[75%]">
|
||||
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:basis-[75%]">
|
||||
<label for="seriesName">Series Name</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesName" formControlName="seriesName" class="w-full" />
|
||||
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
|
||||
@if (!book.metadata!['seriesNameLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
|
||||
}
|
||||
@@ -154,10 +155,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[10%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[10%]">
|
||||
<label for="seriesNumber">Book #</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full" />
|
||||
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
|
||||
@if (!book.metadata!['seriesNumberLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
|
||||
}
|
||||
@@ -167,10 +168,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[10%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[10%]">
|
||||
<label for="seriesTotal">Total Books</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full" />
|
||||
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
|
||||
@if (!book.metadata!['seriesTotalLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
|
||||
}
|
||||
@@ -180,10 +181,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[15%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[15%]">
|
||||
<label for="publishedDate">Publish Date</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full" />
|
||||
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full"/>
|
||||
@if (!book.metadata!['publishedDateLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
|
||||
}
|
||||
@@ -194,8 +195,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="isbn10">ISBN 10</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="isbn10" formControlName="isbn10" class="w-full"/>
|
||||
@@ -207,7 +208,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="isbn13">ISBN 13</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="isbn13" formControlName="isbn13" class="w-full"/>
|
||||
@@ -219,7 +220,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="asin">ASIN (Amazon ID)</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="asin" formControlName="asin" class="w-full"/>
|
||||
@@ -231,7 +232,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="amazonRating">Amazon ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="amazonRating" formControlName="amazonRating" class="w-full"/>
|
||||
@@ -243,7 +244,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="amazonRatingCount">Amazon Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="amazonRatingCount" formControlName="amazonReviewCount" class="w-full"/>
|
||||
@@ -255,7 +256,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="googleId">Google Books ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="googleId" formControlName="googleId" class="w-full"/>
|
||||
@@ -269,8 +270,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsId">Goodreads ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsId" formControlName="goodreadsId" class="w-full"/>
|
||||
@@ -282,7 +283,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsRating">Goodreads ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsRating" formControlName="goodreadsRating" class="w-full"/>
|
||||
@@ -294,7 +295,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsReviewCount">Goodreads Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsReviewCount" formControlName="goodreadsReviewCount" class="w-full"/>
|
||||
@@ -306,7 +307,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverId">Hardcover ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverId" formControlName="hardcoverId" class="w-full"/>
|
||||
@@ -318,7 +319,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverRating">Hardcover ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverRating" formControlName="hardcoverRating" class="w-full"/>
|
||||
@@ -330,7 +331,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverReviewCount">Hardcover Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverReviewCount" formControlName="hardcoverReviewCount" class="w-full"/>
|
||||
@@ -353,7 +354,7 @@
|
||||
<p-tab value="editor">WYSIWYG Editor</p-tab>
|
||||
<p-tab value="html">HTML Editor</p-tab>
|
||||
</p-tablist>
|
||||
<p-tabpanels>
|
||||
<p-tabpanels class="custom-tab-padding">
|
||||
<p-tabpanel value="editor">
|
||||
<form [formGroup]="metadataForm">
|
||||
<p-editor #quillEditor formControlName="description" [readonly]="quillDisabled()" [style]="{ height: '200px' }">
|
||||
@@ -412,35 +413,74 @@
|
||||
</div>
|
||||
<div class="mt-auto">
|
||||
<p-divider></p-divider>
|
||||
<div class="flex justify-between px-2 pt-1 pb-4 z-10">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-x-4">
|
||||
<p-button label="Close" icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<p-button label="Previous Book" [disabled]="disablePrevious" icon="pi pi-arrow-left" [outlined]="true" severity="info" (onClick)="onPrevious()"></p-button>
|
||||
<p-button label="Next Book" [disabled]="disableNext" icon="pi pi-arrow-right" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()"></p-button>
|
||||
</div>
|
||||
}
|
||||
<div class="flex gap-x-4 items-center ml-auto">
|
||||
<p-button
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button label="Restore" icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Revert all changes to original metadata" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<div class="flex flex-col gap-2 px-2 pt-1 md:pb-4 z-10">
|
||||
|
||||
<!-- Desktop Buttons -->
|
||||
<div class="hidden sm:flex justify-between w-full gap-4">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-x-4">
|
||||
<p-button label="Close" icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Previous Book" [disabled]="disablePrevious" icon="pi pi-arrow-left" [outlined]="true" severity="info" (onClick)="onPrevious()"></p-button>
|
||||
<p-button label="Next Book" [disabled]="disableNext" icon="pi pi-arrow-right" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()"></p-button>
|
||||
</div>
|
||||
}
|
||||
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock all metadata fields for editing" tooltipPosition="top"></p-button>
|
||||
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock all metadata fields to prevent changes" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
|
||||
<div class="flex gap-x-4 items-center ml-auto">
|
||||
<p-button
|
||||
[label]="isAutoFetching ? 'Fetching…' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button label="Restore" icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Revert all changes to original metadata" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
}
|
||||
|
||||
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock all metadata fields for editing" tooltipPosition="top"></p-button>
|
||||
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock all metadata fields to prevent changes" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mobile Buttons -->
|
||||
<div class="flex sm:hidden justify-between w-full flex-wrap">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-2 flex-wrap">
|
||||
<p-button icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()" pTooltip="Close" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-arrow-left" [disabled]="disablePrevious" [outlined]="true" severity="info" (onClick)="onPrevious()" pTooltip="Previous Book" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-arrow-right" [disabled]="disableNext" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()" pTooltip="Next Book" tooltipPosition="top"></p-button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="flex gap-4 items-center flex-wrap ml-auto">
|
||||
<p-button
|
||||
icon="pi pi-bolt"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Auto Fetch"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Restore" tooltipPosition="top"></p-button>
|
||||
}
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock All" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock All" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
::ng-deep .p-tabpanels .custom-tab-padding {
|
||||
padding: 1rem 0rem 0rem 0.5rem !important;
|
||||
|
||||
@media (min-width: 640px) {
|
||||
padding: var(--p-tabs-tabpanel-padding) !important;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@if (book$ | async; as book) {
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full w-full">
|
||||
<div class="flex-grow overflow-auto p-4">
|
||||
<div class="flex-grow overflow-auto p-0 md:p-4">
|
||||
<div class="flex justify-center items-center" [ngStyle]="{'padding-bottom': '0.75rem', 'padding-left': '7.6rem'}">
|
||||
<p class="ml-3 text-lg">Current Metadata</p>
|
||||
<p-button
|
||||
|
||||
+44
-20
@@ -7,48 +7,72 @@
|
||||
</app-metadata-picker>
|
||||
</div>
|
||||
} @else {
|
||||
<form class="flex flex-col w-full h-full pt-2 min-w-[60rem] pr-4" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="flex w-full gap-x-4 items-end">
|
||||
<div class="flex flex-col gap-1 w-3/12">
|
||||
<label>Providers</label>
|
||||
<p-multiselect id="provider" class="w-full" [filter]="false" showToggleAll="false" [options]="providers" formControlName="provider"
|
||||
placeholder="Select Providers"></p-multiselect>
|
||||
<form class="flex flex-col w-full h-full pt-2 min-w-full md:min-w-[60rem] pr-0 md:pr-2 pl-0 md:pl-2" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<!-- Responsive search inputs -->
|
||||
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-4 md:items-end">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-3/12">
|
||||
<label for="provider">Providers</label>
|
||||
<p-multiselect
|
||||
id="provider"
|
||||
class="w-full"
|
||||
[filter]="false"
|
||||
showToggleAll="false"
|
||||
[options]="providers"
|
||||
formControlName="provider"
|
||||
placeholder="Select Providers">
|
||||
</p-multiselect>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-5/12">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-5/12">
|
||||
<label for="title">Title</label>
|
||||
<input pInputText formControlName="title" id="title" class="w-full"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-4/12">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-4/12">
|
||||
<label for="author">Author</label>
|
||||
<input pInputText formControlName="author" id="author" class="w-full"/>
|
||||
</div>
|
||||
<div>
|
||||
<p-button label="Search" type="submit" outlined="true" [disabled]="!isSearchEnabled || loading"></p-button>
|
||||
|
||||
<div class="flex flex-col gap-1 w-full sm:w-fit md:w-auto">
|
||||
<label class="invisible md:visible h-0 md:h-auto">Search</label>
|
||||
<div class="flex justify-center md:justify-start">
|
||||
<p-button
|
||||
label="Search"
|
||||
type="submit"
|
||||
outlined="true"
|
||||
[disabled]="!isSearchEnabled || loading"
|
||||
class="w-full sm:w-fit md:w-auto">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@if (loading) {
|
||||
<div class="flex justify-center items-center">
|
||||
<div class="flex justify-center items-center mt-8">
|
||||
<p-progress-spinner ariaLabel="loading"/>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading) {
|
||||
<div class="mt-8 flex-1 overflow-y-auto">
|
||||
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
|
||||
@for (metadata of allFetchedMetadata; track metadata) {
|
||||
<div class="book-item flex flex-col w-full">
|
||||
<div class="flex w-full flex-row book-item-content" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-2"/>
|
||||
<div class=" flex flex-col w-full m-2">
|
||||
<div class="flex flex-row gap-4 justify-between">
|
||||
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 self-center md:self-start"/>
|
||||
<div class="flex flex-col w-full m-2">
|
||||
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
|
||||
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
|
||||
<p> | </p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Published: {{ metadata['publishedDate'] }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
|
||||
<p> | </p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
|
||||
</div>
|
||||
<p class="mt-4 truncate-text p-secondary">
|
||||
|
||||
+302
-262
@@ -1,56 +1,73 @@
|
||||
<div class="pt-2 flex flex-col h-full px-2 w-full">
|
||||
<div class="p-0 md:p-2 flex flex-col h-full w-full rounded-xl">
|
||||
@if (book$ | async; as book) {
|
||||
<div>
|
||||
<div class="flex flex-row">
|
||||
<div class="cover-wrapper relative">
|
||||
<div class="flex flex-col md:flex-row gap-6 pb-8">
|
||||
|
||||
<div class="flex justify-center md:justify-start">
|
||||
<div class="relative w-[250px] min-w-[250px] md:w-[250px]">
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book?.metadata!.bookId, book?.metadata!.coverUpdatedOn)"
|
||||
class="book-cover placeholder"
|
||||
class="rounded-xl w-full object-cover"
|
||||
alt="Cover of {{ book?.metadata!.title }}"
|
||||
loading="lazy"
|
||||
width="225"
|
||||
style="min-width: 225px;"
|
||||
/>
|
||||
|
||||
@if (book?.metadata!.seriesNumber != null) {
|
||||
<div class="series-number-overlay">
|
||||
<div class="absolute top-2 left-2 bg-black/60 text-white px-2 py-0.5 rounded-lg text-xs font-semibold">
|
||||
#{{ book?.metadata!.seriesNumber }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-progressBar
|
||||
[value]="getProgressPercent(book)"
|
||||
[showValue]="true"
|
||||
[ngClass]="{ 'progress-complete': getProgressPercent(book) === 100, 'progress-incomplete': getProgressPercent(book)! < 100 }"
|
||||
[style]="{ height: '10px' }">
|
||||
</p-progressBar>
|
||||
<div class="absolute bottom-0 left-0 right-0">
|
||||
<p-progressBar
|
||||
[value]="getProgressPercent(book)"
|
||||
[showValue]="false"
|
||||
[ngClass]="{
|
||||
'rounded-b-xl': true,
|
||||
'progress-complete': getProgressPercent(book) === 100,
|
||||
'progress-incomplete': getProgressPercent(book)! < 100
|
||||
}"
|
||||
[style]="{ height: '8px' }">
|
||||
</p-progressBar>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-col justify-between">
|
||||
<div class="pl-6 flex flex-col">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<div>
|
||||
@if (book?.metadata?.seriesName) {
|
||||
<p class="underline hover:opacity-80 cursor-pointer" (click)="goToSeries(book?.metadata?.seriesName!)">
|
||||
{{ book?.metadata?.seriesName }}
|
||||
@if (book?.metadata?.seriesNumber) {
|
||||
#{{ book?.metadata?.seriesNumber }}
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<div class="flex items-center gap-2">
|
||||
<p class="text-2xl font-bold m-0">{{ book?.metadata!.title }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col justify-between flex-grow">
|
||||
<div class="space-y-4">
|
||||
|
||||
<div class="flex items-start justify-between">
|
||||
<div class="flex flex-col text-center md:text-left w-full">
|
||||
@if (book?.metadata?.seriesName) {
|
||||
<p
|
||||
class="text-blue-600 cursor-pointer hover:underline"
|
||||
(click)="goToSeries(book?.metadata?.seriesName!)"
|
||||
>
|
||||
{{ book?.metadata?.seriesName }}
|
||||
@if (book?.metadata?.seriesNumber) {
|
||||
#{{ book?.metadata?.seriesNumber }}
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
||||
<div class="flex flex-col items-center md:items-start gap-1">
|
||||
<div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left">
|
||||
<h2 class="text-3xl font-extrabold text-gray-900 dark:text-white leading-tight">
|
||||
{{ book?.metadata!.title }}
|
||||
</h2>
|
||||
<i
|
||||
class="pi"
|
||||
class="pi align-middle"
|
||||
[ngClass]="isMetadataFullyLocked(book?.metadata!) ? 'pi-lock text-red-500' : 'pi-lock-open text-green-500'"
|
||||
[title]="isMetadataFullyLocked(book?.metadata!) ? 'Metadata is locked' : 'Metadata is unlocked'"
|
||||
style="font-size: 1.25rem;"
|
||||
pTooltip="{{ isMetadataFullyLocked(book?.metadata!) ? 'This book metadata is locked.' : 'This book metadata is unlocked.' }}"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p class="text-lg">
|
||||
|
||||
<p class="text-gray-600 dark:text-gray-300 text-lg">
|
||||
@for (author of book?.metadata!.authors; track author; let isLast = $last) {
|
||||
<a class="underline hover:opacity-80 cursor-pointer" (click)="goToAuthorBooks(author)">
|
||||
<a class="hover:underline dark:text-blue-400 cursor-pointer" (click)="goToAuthorBooks(author)">
|
||||
{{ author }}
|
||||
</a>
|
||||
@if (!isLast) {
|
||||
@@ -60,12 +77,13 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 pt-2">
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-start text-sm w-full">
|
||||
|
||||
<div class="flex justify-center sm:justify-start">
|
||||
<div class="flex items-center gap-2">
|
||||
<i class="pi pi-thumbs-up-fill"
|
||||
pTooltip="Personal Rating"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
<i class="pi pi-thumbs-up-fill text-yellow-500" pTooltip="Personal Rating" tooltipPosition="top"></i>
|
||||
<p-rating
|
||||
[ngModel]="book?.metadata!.personalRating"
|
||||
(onRate)="onPersonalRatingChange(book, $event)"
|
||||
@@ -73,268 +91,290 @@
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.personalRating, 10)">
|
||||
</p-rating>
|
||||
</div>
|
||||
@if (book?.metadata!.amazonRating || book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) {
|
||||
@if (book?.metadata!.amazonRating) {
|
||||
@if (book?.metadata!.asin) {
|
||||
<span>|</span>
|
||||
<a class="flex items-center gap-1" [href]="'https://www.amazon.com/dp/' + book?.metadata!.asin" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://www.amazon.com/favicon.ico" alt="Amazon"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.amazonRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://www.amazon.com/favicon.ico" alt="Amazon" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.amazonRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.amazonRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.amazonRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.amazonReviewCount | number:'1.0-0' }})</p>
|
||||
@if (book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.goodreadsRating) {
|
||||
@if (book?.metadata!.goodreadsId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://www.goodreads.com/book/show/' + book?.metadata!.goodreadsId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://www.goodreads.com/favicon.ico" alt="Goodreads"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.goodreadsRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://www.goodreads.com/favicon.ico" alt="Goodreads" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.goodreadsRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.goodreadsRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.goodreadsRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.goodreadsReviewCount | number:'1.0-0' }})</p>
|
||||
@if (book?.metadata!.hardcoverRating) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.hardcoverRating) {
|
||||
@if (book?.metadata!.hardcoverId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://hardcover.app/books/' + book?.metadata!.hardcoverId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://assets.hardcover.app/static/favicon.ico" alt="Hardcover"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.hardcoverRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://assets.hardcover.app/static/favicon.ico" alt="Hardcover" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.hardcoverRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.hardcoverRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.hardcoverRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.hardcoverReviewCount | number:'1.0-0' }})</p>
|
||||
@if ((book?.metadata!.amazonRating || book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) && book?.metadata!.googleId) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.googleId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://books.google.com/books?id=' + book?.metadata!.googleId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://books.google.com/favicon.ico" alt="Google Books"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.googleId) {
|
||||
<span class="hidden sm:inline text-gray-400 text-xl px-1 leading-none">|</span>
|
||||
}
|
||||
|
||||
<div class="flex flex-wrap justify-center sm:justify-start gap-4 pt-1">
|
||||
@if (book?.metadata?.amazonRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://www.amazon.com/dp/' + (book.metadata?.asin ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'amazon')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://www.amazon.com/favicon.ico"
|
||||
alt="Amazon"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.amazonRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.goodreadsRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://www.goodreads.com/book/show/' + (book.metadata?.goodreadsId ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'goodreads')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://www.goodreads.com/favicon.ico"
|
||||
alt="Goodreads"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.goodreadsRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.hardcoverRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://hardcover.app/books/' + (book.metadata?.hardcoverId ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'hardcover')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://assets.hardcover.app/static/favicon.ico"
|
||||
alt="Hardcover"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.hardcoverRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.googleId) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://books.google.com/books?id=' + book.metadata!.googleId"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
src="https://books.google.com/favicon.ico"
|
||||
alt="Google Books"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<div class="overflow-x-auto pt-4 scrollbar-hide max-w-full w-full">
|
||||
</div>
|
||||
|
||||
@if (book?.metadata?.categories?.length) {
|
||||
<div class="overflow-x-auto scrollbar-hide max-w-7xl pt-2 md:pt-0">
|
||||
<div class="flex gap-2 w-max max-w-[1150px]">
|
||||
@for (category of book?.metadata!.categories; track category) {
|
||||
@for (category of book.metadata!.categories; track category) {
|
||||
<a (click)="goToCategory(category)" class="shrink-0 no-underline cursor-pointer">
|
||||
<p-tag [value]="category"></p-tag>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-x-20 gap-y-2 pt-6" style="grid-template-columns: repeat(5, max-content);">
|
||||
<div>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<p-tag
|
||||
class="cursor-pointer text-white"
|
||||
[severity]="getStatusSeverity(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
{{ getStatusLabel(selectedReadStatus) }}
|
||||
</p-tag>
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
</div>
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
}
|
||||
|
||||
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 text-gray-700 dark:text-gray-300 max-w-5xl">
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
{{ book?.metadata?.publisher }}
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Published:</span> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Language:</span> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 10:</span> {{ book?.metadata!.isbn10 || '-' }}</p>
|
||||
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
{{ getFileExtension(book?.filePath) || '-' }}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Score:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
</p>
|
||||
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
|
||||
<p>
|
||||
<strong>ISBN:</strong>
|
||||
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
|
||||
{{ book.metadata!.isbn13 }}
|
||||
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
|
||||
/
|
||||
}
|
||||
{{ book.metadata!.isbn10 }}
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
|
||||
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
{{ getStatusLabel(selectedReadStatus) }}
|
||||
</span>
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center">
|
||||
<span class="font-bold mr-2">Progress:</span>
|
||||
<span class="inline-flex items-center">
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
||||
[ngClass]="getProgressColorClass(getProgressPercent(book))">
|
||||
{{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }}
|
||||
</span>
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-button
|
||||
pTooltip="Reset progress"
|
||||
tooltipPosition="bottom"
|
||||
icon="pi pi-refresh"
|
||||
size="small"
|
||||
severity="danger"
|
||||
text
|
||||
class="ml-1 custom-button-padding"
|
||||
(onClick)="resetProgress(book)">
|
||||
</p-button>
|
||||
}
|
||||
</span>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Match:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
{{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}%
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Progress:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
||||
[ngClass]="getProgressColorClass(getProgressPercent(book))">
|
||||
{{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }}
|
||||
</span>
|
||||
</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">File Size:</span> {{ getFileSizeInMB(book) }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 13:</span> {{ book?.metadata!.isbn13 || '-' }}</p>
|
||||
</div>
|
||||
<div class="pt-2 flex items-center gap-2">
|
||||
<span class="font-semibold flex-shrink-0">File Path:</span>
|
||||
<p-toggleButton
|
||||
[(ngModel)]="showFilePath"
|
||||
onIcon="pi pi-eye-slash"
|
||||
offIcon="pi pi-eye"
|
||||
onLabel=""
|
||||
offLabel=""
|
||||
size="small"
|
||||
class="flex-shrink-0 my-visibility-toggle"></p-toggleButton>
|
||||
@if (showFilePath) {
|
||||
<div
|
||||
class="flex items-center gap-4 flex-grow"
|
||||
style="min-width: 0;">
|
||||
<p
|
||||
class="font-mono text-sm text-gray-400 whitespace-nowrap flex-grow"
|
||||
style="min-width: 0;">
|
||||
{{ book?.filePath }}
|
||||
</p>
|
||||
</div>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div class="pl-6 pt-4 flex flex-row w-full gap-4">
|
||||
@if (book!.bookType === 'PDF') {
|
||||
@if (readMenuItems$ | async; as readItems) {
|
||||
<p-splitbutton
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
[model]="readItems"
|
||||
(onClick)="read(book.id, 'ngx')"
|
||||
severity="info"/>
|
||||
}
|
||||
}
|
||||
@if (book!.bookType !== 'PDF') {
|
||||
<p-button
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-semibold text-sm">File Path:</span>
|
||||
<i
|
||||
class="pi cursor-pointer text-sm"
|
||||
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
|
||||
(click)="showFilePath = !showFilePath"
|
||||
></i>
|
||||
@if (showFilePath) {
|
||||
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div class="flex flex-wrap gap-3 pt-6">
|
||||
@if (book!.bookType === 'PDF') {
|
||||
@if (readMenuItems$ | async; as readItems) {
|
||||
<p-splitbutton
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
(onClick)="read(book?.metadata!.bookId, undefined)"
|
||||
severity="info"/>
|
||||
[model]="readItems"
|
||||
(onClick)="read(book.id, 'ngx')"
|
||||
severity="primary"/>
|
||||
}
|
||||
}
|
||||
@if (book!.bookType !== 'PDF') {
|
||||
<p-button
|
||||
label="Shelf"
|
||||
icon="pi pi-folder"
|
||||
severity="info"
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
(onClick)="read(book?.metadata!.bookId, undefined)"
|
||||
severity="primary"/>
|
||||
}
|
||||
<p-button
|
||||
label="Shelf"
|
||||
icon="pi pi-folder"
|
||||
severity="secondary"
|
||||
outlined
|
||||
(onClick)="assignShelf(book.id)">
|
||||
</p-button>
|
||||
@if (userData.permissions.canDownload || userData.permissions.admin) {
|
||||
<p-button
|
||||
label="Download"
|
||||
icon="pi pi-download"
|
||||
severity="success"
|
||||
outlined
|
||||
(onClick)="assignShelf(book.id)">
|
||||
(onClick)="download(book.id)">
|
||||
</p-button>
|
||||
@if (userData.permissions.canDownload || userData.permissions.admin) {
|
||||
<p-button
|
||||
label="Download"
|
||||
icon="pi pi-download"
|
||||
severity="info"
|
||||
}
|
||||
@if (userData.permissions.canEmailBook || userData.permissions.admin) {
|
||||
@if (emailMenuItems$ | async; as emailItems) {
|
||||
<p-splitbutton
|
||||
label="Quick Send"
|
||||
icon="pi pi-send"
|
||||
[model]="emailItems"
|
||||
(onClick)="quickSend(book.id)"
|
||||
outlined
|
||||
(onClick)="download(book.id)">
|
||||
</p-button>
|
||||
severity="info">
|
||||
</p-splitbutton>
|
||||
}
|
||||
@if (userData.permissions.canEmailBook || userData.permissions.admin) {
|
||||
@if (emailMenuItems$ | async; as emailItems) {
|
||||
<p-splitbutton
|
||||
label="Quick Send"
|
||||
icon="pi pi-send"
|
||||
[model]="emailItems"
|
||||
(onClick)="quickSend(book.id)"
|
||||
outlined
|
||||
severity="info">
|
||||
</p-splitbutton>
|
||||
}
|
||||
}
|
||||
@if (userData.permissions.canEditMetadata || userData.permissions.admin) {
|
||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
||||
<p-splitbutton
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
[model]="refreshItems"
|
||||
severity="warn"
|
||||
(onClick)="quickRefresh(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-splitbutton>
|
||||
}
|
||||
@if (userData.permissions.canEditMetadata || userData.permissions.admin) {
|
||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
||||
<p-splitbutton
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
[model]="refreshItems"
|
||||
severity="info"
|
||||
(onClick)="quickRefresh(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-splitbutton>
|
||||
}
|
||||
}
|
||||
@if (userData.permissions.canDeleteBook || userData.permissions.admin) {
|
||||
@if (otherItems$ | async; as otherItems) {
|
||||
<p-button icon="pi pi-ellipsis-v" outlined severity="danger" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="otherItems" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
@if (userData.permissions.canDeleteBook || userData.permissions.admin) {
|
||||
@if (otherItems$ | async; as otherItems) {
|
||||
<p-button icon="pi pi-ellipsis-v" outlined severity="info" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="otherItems" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex-1 space-y-2 px-2 min-w-[40rem]">
|
||||
<div class="px-4 pb-2 pt-4 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: '250px'}" [(ngModel)]="book.metadata!.description">
|
||||
<p-editor #quillEditor [readonly]="true" [style]="{height: '225px'}" [(ngModel)]="book.metadata!.description">
|
||||
<ng-template #header>
|
||||
</ng-template>
|
||||
</p-editor>
|
||||
</div>
|
||||
</div>
|
||||
@if (book.metadata!.description && book.metadata!.description.length > 100) {
|
||||
<div class="text-left">
|
||||
<button pButton
|
||||
type="button"
|
||||
[label]="isExpanded ? 'Show less' : 'Show more'"
|
||||
[icon]="isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
iconPos="right"
|
||||
class="p-button-text p-button-sm"
|
||||
(click)="toggleExpand()">
|
||||
</button>
|
||||
</div>
|
||||
@if (book.metadata!.description && book.metadata!.description.length > 500) {
|
||||
<p-button
|
||||
[label]="isExpanded ? 'Show less' : 'Show more'"
|
||||
[icon]="isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
iconPos="right"
|
||||
size="small"
|
||||
text
|
||||
(click)="toggleExpand()">
|
||||
</p-button>
|
||||
}
|
||||
<p-divider></p-divider>
|
||||
</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>
|
||||
|
||||
+8
@@ -84,3 +84,11 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::ng-deep .custom-button-padding .p-button {
|
||||
padding-block: 0rem !important;
|
||||
}
|
||||
|
||||
::ng-deep .custom-tag-padding {
|
||||
padding: 0.1rem !important;
|
||||
}
|
||||
|
||||
|
||||
+87
-16
@@ -1,12 +1,12 @@
|
||||
import {Component, DestroyRef, inject, Input, OnChanges, OnInit, Optional, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import {Button, ButtonDirective} from 'primeng/button';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, DecimalPipe, NgClass} from '@angular/common';
|
||||
import {Observable} from 'rxjs';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
import {Rating, RatingRateEvent} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Tag} from 'primeng/tag';
|
||||
import {Book, BookMetadata, BookRecommendation, MetadataClearFlags, MetadataUpdateWrapper, ReadStatus} from '../../../model/book.model';
|
||||
import {Book, BookMetadata, BookRecommendation, ReadStatus} from '../../../model/book.model';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {UrlHelperService} from '../../../../utilities/service/url-helper.service';
|
||||
import {UserService} from '../../../../settings/user-management/user.service';
|
||||
@@ -20,7 +20,6 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {Editor} from 'primeng/editor';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {ToggleButton} from 'primeng/togglebutton';
|
||||
import {MetadataFetchOptionsComponent} from '../../metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
|
||||
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
|
||||
import {MetadataRefreshRequest} from '../../model/request/metadata-refresh-request.model';
|
||||
@@ -35,7 +34,7 @@ import {BookCardLiteComponent} from '../../../components/book-card-lite/book-car
|
||||
standalone: true,
|
||||
templateUrl: './metadata-viewer.component.html',
|
||||
styleUrl: './metadata-viewer.component.scss',
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe, ButtonDirective, Editor, ProgressBar, ToggleButton, Menu, InfiniteScrollDirective, BookCardLiteComponent]
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe, Editor, ProgressBar, Menu, InfiniteScrollDirective, BookCardLiteComponent]
|
||||
})
|
||||
export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
|
||||
@@ -341,19 +340,43 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
return 'bg-red-600 border-red-700';
|
||||
}
|
||||
|
||||
getStatusSeverityClass(status: string): string {
|
||||
const normalized = status?.toUpperCase();
|
||||
switch (normalized) {
|
||||
case 'UNREAD':
|
||||
return 'bg-gray-500';
|
||||
case 'PAUSED':
|
||||
return 'bg-zinc-600';
|
||||
case 'READING':
|
||||
return 'bg-blue-600';
|
||||
case 'RE_READING':
|
||||
return 'bg-indigo-600';
|
||||
case 'READ':
|
||||
return 'bg-green-600';
|
||||
case 'PARTIALLY_READ':
|
||||
return 'bg-yellow-600';
|
||||
case 'ABANDONED':
|
||||
return 'bg-red-600';
|
||||
case 'WONT_READ':
|
||||
return 'bg-pink-700';
|
||||
default:
|
||||
return 'bg-gray-600';
|
||||
}
|
||||
}
|
||||
|
||||
getProgressColorClass(progress: number | null | undefined): string {
|
||||
if (progress == null) return 'bg-gray-600';
|
||||
return 'bg-blue-500';
|
||||
}
|
||||
|
||||
onPersonalRatingChange(book: Book, { value: personalRating }: RatingRateEvent): void {
|
||||
onPersonalRatingChange(book: Book, {value: personalRating}: RatingRateEvent): void {
|
||||
if (!book?.metadata) return;
|
||||
|
||||
const updatedMetadata = { ...book.metadata, personalRating };
|
||||
const updatedMetadata = {...book.metadata, personalRating};
|
||||
|
||||
this.bookService.updateBookMetadata(book.id, {
|
||||
metadata: updatedMetadata,
|
||||
clearFlags: { personalRating: false }
|
||||
clearFlags: {personalRating: false}
|
||||
}, false).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({
|
||||
@@ -410,14 +433,31 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
getStatusSeverity(status: string): 'success' | 'secondary' | 'info' | 'warn' | 'danger' | undefined {
|
||||
const normalized = status?.toUpperCase();
|
||||
if (['UNREAD', 'PAUSED'].includes(normalized)) return 'secondary';
|
||||
if (['READING', 'RE_READING'].includes(normalized)) return 'info';
|
||||
if (['READ'].includes(normalized)) return 'success';
|
||||
if (['PARTIALLY_READ'].includes(normalized)) return 'warn';
|
||||
if (['WONT_READ', 'ABANDONED'].includes(normalized)) return 'danger';
|
||||
return undefined;
|
||||
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover'): string {
|
||||
const meta = book?.metadata;
|
||||
if (!meta) return '';
|
||||
|
||||
switch (source) {
|
||||
case 'amazon':
|
||||
return meta.amazonRating != null
|
||||
? `★ ${meta.amazonRating} | ${meta.amazonReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
case 'goodreads':
|
||||
return meta.goodreadsRating != null
|
||||
? `★ ${meta.goodreadsRating} | ${meta.goodreadsReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
case 'hardcover':
|
||||
return meta.hardcoverRating != null
|
||||
? `★ ${meta.hardcoverRating} | ${meta.hardcoverReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
getRatingPercent(rating: number | null | undefined): number {
|
||||
if (rating == null) return 0;
|
||||
return Math.round((rating / 5) * 100);
|
||||
}
|
||||
|
||||
readStatusMenuItems = this.readStatusOptions.map(option => ({
|
||||
@@ -426,7 +466,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}));
|
||||
|
||||
getStatusLabel(value: string): string {
|
||||
return this.readStatusOptions.find(o => o.value === value)?.label ?? 'Unknown';
|
||||
return this.readStatusOptions.find(o => o.value === value)?.label.toUpperCase() ?? 'N/A';
|
||||
}
|
||||
|
||||
updateReadStatus(status: ReadStatus): void {
|
||||
@@ -461,4 +501,35 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
resetProgress(book: Book): void {
|
||||
this.confirmationService.confirm({
|
||||
message: `Reset reading progress for "${book.metadata?.title}"?`,
|
||||
header: 'Confirm Reset',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
acceptLabel: 'Yes',
|
||||
rejectLabel: 'Cancel',
|
||||
acceptButtonStyleClass: 'p-button-danger',
|
||||
accept: () => {
|
||||
this.bookService.resetProgress(book.id).subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Progress Reset',
|
||||
detail: 'Reading progress has been reset.',
|
||||
life: 1500
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Failed',
|
||||
detail: 'Could not reset progress.',
|
||||
life: 1500
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,6 +397,12 @@ export class BookService {
|
||||
);
|
||||
}
|
||||
|
||||
resetProgress(bookId: number): Observable<Book> {
|
||||
return this.http.post<Book>(`${this.url}/${bookId}/reset-progress`, null).pipe(
|
||||
tap(updatedBook => this.handleBookUpdate(updatedBook))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*------------------ All the websocket handlers go below ------------------*/
|
||||
|
||||
@@ -436,7 +442,7 @@ export class BookService {
|
||||
updatedMap.has(book.id) ? updatedMap.get(book.id)! : book
|
||||
);
|
||||
|
||||
this.bookStateSubject.next({ ...currentState, books: mergedBooks });
|
||||
this.bookStateSubject.next({...currentState, books: mergedBooks});
|
||||
}
|
||||
|
||||
handleBookMetadataUpdate(bookId: number, updatedMetadata: BookMetadata) {
|
||||
|
||||
@@ -70,6 +70,12 @@ export interface NewPdfReaderSetting {
|
||||
pageViewMode: PdfPageViewMode;
|
||||
}
|
||||
|
||||
export interface TableColumnPreference {
|
||||
field: string;
|
||||
visible: boolean;
|
||||
order: number;
|
||||
}
|
||||
|
||||
export interface UserSettings {
|
||||
perBookSetting: PerBookSetting;
|
||||
pdfReaderSetting: PdfReaderSetting;
|
||||
@@ -81,6 +87,7 @@ export interface UserSettings {
|
||||
filterSortingMode: 'alphabetical' | 'count';
|
||||
metadataCenterViewMode: 'route' | 'dialog';
|
||||
entityViewPreferences: EntityViewPreferences;
|
||||
tableColumnPreference?: TableColumnPreference[];
|
||||
}
|
||||
|
||||
export interface User {
|
||||
|
||||
Reference in New Issue
Block a user