Introduce multi-format book support, including audiobooks (#2486)

* fix: support reading alternative book formats using bookType query param

* feat: add streaming reader support for alternative EPUB formats

* refactor: extract tabs section into MetadataTabsComponent

* feat: implement per-file reading progress tracking

* feat: add configurable format priority with cascading fallback

* refactor: redesign library creator with single-page layout

* refactor: unify reading progress into ReadingProgressService

* refactor: improve delete options with clearer file format and book deletion

* refactor: improve book format matching with normalization and fuzzy fallback

* feat: add folder-based audiobook support with ZIP downloads and preparing state

* fix: display unique format types in metadata viewer

* refactor: auto-attach files to single book in folder during rescan

* feat: implement folder-centric book file grouping with fuzzy matching

* refactor: consolidate book grouping with organization mode support

* fix: use folder hash for folder-based audiobooks in auto-attach

* fix: delete only BookFileEntity on file removal, not entire book

* fix: set folderBased flag and correct file size for auto-attached audiobook folders

* fix: use count query to avoid lazy initialization in file delete handler

* fix: preserve book metadata when file is moved by detecting hash match

* fix: skip books with no files in restoration to avoid NPE

* fix: round all progress percentages to one decimal place before sending to UI

* style: improve library creator dialog spacing and layout

* fix: migrate FOLDER_AS_BOOK to BOOK_PER_FOLDER for backwards compatibility

* fix: FileMoveService now handles multi-file BookEntity properly

* style: redesign metadata-picker and file-mover UI components

* style: redesign file-naming-pattern UI and improve theme contrast

* style: relax spacing in library-creator component

* style: tighten directory-picker layout for consistency

* fix: PathPatternResolver now respects folderBased flag for audiobooks

* style: move checkmark column to left side and add pending status in file-mover

* refactor: consolidate BookFileType into BookType and add audiobook styling

* feat: show 'Continue Reading' button for in-progress books

* fix: preserve dots in folder names during grouping and prevent duplicate attachments

* style: reduce gap between download-all button and primary file section

* style: shorten 'Continue Reading' button to 'Read' on mobile

* feat: add DISK_TYPE config to disable file moves on network storage

* style: standardize settings pages with shared styles and consistent spacing

* style: revamp settings pages with modern card-based layouts

* style: revamp OPDS, auth, and task management settings layouts

* fix: update FileMoveService tests to include AppProperties parameter

* fix: derive BookFileType from extension when uploading additional book files

* feat: show format type and size in download button with dropdown for alternatives

* feat: add audiobook streaming player with HTTP Range support

* feat: add M4B chapter extraction and chapter navigation

* feat: add audiobook bookmarks and sleep timer

* refactor: split AudiobookReaderService into focused services

* feat: add Media Session API for background audio playback

* feat: display file extensions in format tags with distinct colors and add audiobook upload support

* feat: require bookFileId for viewer settings API

* fix: show split button for audiobooks with readable alternatives

* feat: improve reading sessions table with book type badges and better formatting

* feat: add audiobook play button in files tab

* feat: use file extension for format display and meaningful tab values

* feat: add extension field to BookFile DTO

* feat: use extension field for book card format pill

* fix: use mixed orientation for format priority drag-drop to support multi-line layout

* feat: add attach book files feature to consolidate single-file books

* fix: increase drag handle size for format priority chips

* fix: add missing BookFileRepository mock to BookServiceDeleteTests

* feat: add delete buttons to files tab and move shelf to other items menu

* feat: add physical books support for cataloging books without digital files

* refactor: redesign icon-picker component with improved styling

* refactor: redesign metadata-picker component with improved layout and alignment

* refactor: move Add Physical Book to top of library menu

* refactor: use p-autoComplete for authors/categories in add-physical-book dialog

* feat: add square cover search and display support for audiobooks

* fix: navigate to first page when opening unread ebooks

* fix: exclude API requests from service worker interception

* feat: support fileless books with automatic file attachment

* fix: bypass service worker for audiobook streaming requests

* refactor: remove alphabetical filter sorting, default to count, limit filters to 100

---------

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-01-27 10:12:50 -07:00
committed by GitHub
co-authored by acx10
parent c23e38b5a5
commit 3f334202b6
340 changed files with 23225 additions and 20727 deletions
@@ -1,4 +1,4 @@
<div class="main-container enclosing-container">
<div class="file-naming-container">
<div class="settings-header">
<h2 class="settings-title">
<i class="pi pi-file"></i>
@@ -6,46 +6,38 @@
<app-external-doc-link docType="fileNamePatterns"></app-external-doc-link>
</h2>
<p class="settings-description">
Configure automatic file organization using metadata placeholders. Patterns are applied when uploading files, moving files within your library, and after metadata updates.
Configure automatic file organization using metadata placeholders. Patterns are applied when uploading, moving files, or after metadata updates.
</p>
</div>
<div class="important-warning">
<h4><i class="pi pi-exclamation-circle"></i> IMPORTANT: Metadata Quality Notice</h4>
<p>
File naming patterns rely <strong>entirely</strong> on the metadata stored in Booklore. If your metadata is missing, uneven, or of poor quality, the resulting file renaming and organization will likely be incorrect or "buggy".
</p>
<p>
This feature is <strong>ONLY recommended</strong> for high-quality, curated libraries. If you have duplicates, missing metadata, or inconsistent naming conventions, please review your library first.
</p>
<div class="warning-notice">
<i class="pi pi-exclamation-triangle"></i>
<div>
<strong>Metadata Quality Notice:</strong> File naming relies entirely on metadata stored in Booklore.
This feature is recommended only for high-quality, curated libraries with complete metadata.
</div>
</div>
<div class="settings-content">
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-cog"></i>
Default File Naming Pattern
</h3>
<p class="section-description">
This pattern serves as the fallback when no library-specific override is configured.
</p>
</div>
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-bolt"></i>
Default Pattern
</h3>
<p class="section-description">Fallback pattern when no library-specific override is configured.</p>
</div>
<div class="settings-card">
<div class="form-field">
<div class="library-header">
<i [class]="'pi pi-bolt'"></i>
<span class="library-name">Default Pattern</span>
</div>
<div class="pattern-input-group">
<div class="section-body">
<div class="default-pattern-card">
<div class="pattern-input-container">
<div class="pattern-input-row">
<input
pInputText
id="defaultPattern"
[(ngModel)]="defaultPattern"
placeholder="e.g., {title} - {authors}"
(input)="onDefaultPatternChange(defaultPattern)"
class="full-width"/>
class="pattern-input"/>
<p-button
label="Save"
icon="pi pi-save"
@@ -56,233 +48,153 @@
</p-button>
</div>
@if (defaultErrorMessage) {
<div class="error-message">{{ defaultErrorMessage }}</div>
<span class="error-text">{{ defaultErrorMessage }}</span>
}
</div>
<div class="preview-section">
<div class="preview-item">
<span class="preview-label">Preview:</span>
<span class="preview-value">{{ generateDefaultPreview() }}</span>
<div class="preview-row">
<span class="preview-label">
<i class="pi pi-eye"></i>
Preview:
</span>
<code class="preview-value">{{ generateDefaultPreview() }}</code>
</div>
</div>
</div>
</div>
</div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-folder"></i>
Library-Specific Overrides
</h3>
<p class="section-description">
Define custom naming patterns for specific libraries. Leave empty to use the default pattern.
</p>
</div>
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-folder"></i>
Library Overrides
</h3>
<p class="section-description">
Define custom patterns for specific libraries. Leave empty to use the default pattern.
</p>
</div>
<div class="settings-card">
<div class="library-patterns">
<div class="section-body">
@if (libraries.length === 0) {
<div class="empty-state">
<i class="pi pi-folder-open"></i>
<p class="empty-title">No libraries found</p>
<p class="empty-subtitle">Create a library to configure custom naming patterns</p>
</div>
} @else {
<div class="libraries-list">
@for (library of libraries; track library.id) {
<div class="library-pattern-item">
<div class="library-item" [class.has-pattern]="library.fileNamingPattern">
<div class="library-header">
<i [class]="'pi pi-' + library.icon"></i>
<span class="library-name">{{ library.name }}</span>
</div>
<div class="library-input-group">
<input
pInputText
[(ngModel)]="library.fileNamingPattern"
placeholder="Leave empty to use default pattern"
(input)="onLibraryPatternChange(library)"
class="full-width"/>
<div class="library-info">
<div class="library-icon">
<i [class]="'pi pi-' + library.icon"></i>
</div>
<span class="library-name">{{ library.name }}</span>
@if (library.fileNamingPattern) {
<span class="custom-badge">Custom</span>
} @else {
<span class="default-badge">Using Default</span>
}
</div>
<p-button
label="Clear"
(onClick)="clearLibraryPattern(library)"
icon="pi pi-times"
severity="secondary"
size="small"
[outlined]="true"
[disabled]="!library.fileNamingPattern">
[rounded]="true"
(onClick)="clearLibraryPattern(library)"
[disabled]="!library.fileNamingPattern"
pTooltip="Clear pattern">
</p-button>
</div>
<div class="preview-section">
<span class="preview-label">Preview:</span>
<span class="preview-value">{{ generateLibraryPreview(library) }}</span>
<div class="library-body">
<div class="pattern-input-container">
<input
pInputText
[(ngModel)]="library.fileNamingPattern"
placeholder="Leave empty to use default pattern"
(input)="onLibraryPatternChange(library)"
class="pattern-input"/>
<div class="preview-row">
<span class="preview-label">
<i class="pi pi-eye"></i>
Preview:
</span>
<code class="preview-value">{{ generateLibraryPreview(library) }}</code>
</div>
</div>
</div>
</div>
}
</div>
<div class="form-actions">
<div class="actions-row">
<p-button
label="Save All Library Patterns"
label="Save All"
(onClick)="saveLibraryPatterns()"
severity="success"
icon="pi pi-save"
[outlined]="true">
</p-button>
</div>
</div>
}
</div>
</div>
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-info-circle"></i>
Placeholders Reference
</h3>
<p class="section-description">
Use placeholders to dynamically insert metadata into file names and folder paths.
</p>
</div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-info-circle"></i>
Available Placeholders
</h3>
<p class="section-description">
Use placeholders to dynamically insert book metadata into file names and folder paths. These will be replaced with actual values when uploading or moving files.
</p>
</div>
<div class="settings-card">
<div class="placeholders-info">
<div class="placeholders-grid">
<div class="placeholders-list">
<h4 class="subsection-title">Available Placeholders</h4>
<ul>
<li><code class="placeholder-code">{{ '{title}' }}</code> – Book title</li>
<li><code class="placeholder-code">{{ '{subtitle}' }}</code> – Book subtitle</li>
<li><code class="placeholder-code">{{ '{authors}' }}</code> – Author(s)</li>
<li><code class="placeholder-code">{{ '{year}' }}</code> – Full year (e.g. 2025)</li>
<li><code class="placeholder-code">{{ '{series}' }}</code> – Series name</li>
<li><code class="placeholder-code">{{ '{seriesIndex}' }}</code> – Series index (e.g. 01)</li>
<li><code class="placeholder-code">{{ '{language}' }}</code> – Language code (e.g. en)</li>
<li><code class="placeholder-code">{{ '{publisher}' }}</code> – Publisher name</li>
<li><code class="placeholder-code">{{ '{isbn}' }}</code> – ISBN number</li>
<li><code class="placeholder-code">{{ '{currentFilename}' }}</code> Original file name (with extension)</li>
</ul>
</div>
<div class="optional-blocks-info">
<h4 class="subsection-title">Optional blocks</h4>
<p>
Surround parts of your pattern with angle brackets
<code class="placeholder-code">{{ '{<...>}' }}</code>
<br>
to make them optional. If any placeholder inside the block has no value, the whole block is excluded.
</p>
<div class="example-section">
<p class="example-label">Example:</p>
<p><code class="placeholder-code">{{ '{<{seriesIndex} - >{title}' }}</code></p>
<ul class="example-list">
<li><code>01 - Dune</code> (if <code class="placeholder-code">{{ '{seriesIndex}' }}</code> exists)</li>
<li><code>Dune</code> (if <code class="placeholder-code">{{ '{seriesIndex}' }}</code> is missing)</li>
</ul>
</div>
</div>
<div class="section-body">
<div class="placeholders-grid">
<div class="placeholder-group">
<h4 class="group-title">
<i class="pi pi-hashtag"></i>
Available Placeholders
</h4>
<div class="placeholder-list">
<div class="placeholder-item"><code>{{ '{title}' }}</code><span>Book title</span></div>
<div class="placeholder-item"><code>{{ '{subtitle}' }}</code><span>Book subtitle</span></div>
<div class="placeholder-item"><code>{{ '{authors}' }}</code><span>Author(s)</span></div>
<div class="placeholder-item"><code>{{ '{year}' }}</code><span>Publication year</span></div>
<div class="placeholder-item"><code>{{ '{series}' }}</code><span>Series name</span></div>
<div class="placeholder-item"><code>{{ '{seriesIndex}' }}</code><span>Series index</span></div>
<div class="placeholder-item"><code>{{ '{language}' }}</code><span>Language code</span></div>
<div class="placeholder-item"><code>{{ '{publisher}' }}</code><span>Publisher</span></div>
<div class="placeholder-item"><code>{{ '{isbn}' }}</code><span>ISBN number</span></div>
<div class="placeholder-item"><code>{{ '{currentFilename}' }}</code><span>Original filename</span></div>
</div>
</div>
</div>
</div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-eye"></i>
Example Patterns & Output
</h3>
<p class="section-description">
See how different patterns work with sample book metadata and learn best practices for organizing your library.
</p>
</div>
<div class="settings-card">
<div class="examples-section">
<div class="example-category">
<h4 class="subsection-title">Examples with Full Metadata</h4>
<div class="metadata-sample">
<span>title: <code>The Name of the Wind</code></span>
<span>subtitle: <code>Special Edition</code></span>
<span>authors: <code>Patrick Rothfuss</code></span>
<span>series: <code>The Kingkiller Chronicle</code></span>
<span>seriesIndex: <code>01</code></span>
<span>year: <code>2007</code></span>
<span>currentFilename: <code>name_of_the_wind_original.epub</code></span>
<div class="placeholder-group">
<h4 class="group-title">
<i class="pi pi-code"></i>
Optional Blocks
</h4>
<p class="group-description">
Wrap parts in angle brackets <code>{{ '{<...>}' }}</code> to make them conditional.
If any placeholder in the block has no value, the entire block is omitted.
</p>
<div class="example-block">
<div class="example-pattern">
<span class="pattern-prefix">Pattern:</span>
<code>{{ '{<{seriesIndex} - >{title}' }}</code>
</div>
<div class="example-list">
<div class="example-item">
<p class="example-pattern"><strong>Basic pattern:</strong> <code>{{ '{authors} - {title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss - The Name of the Wind.epub</code></p>
<div class="example-results">
<div class="result-item">
<span class="result-prefix">With index:</span>
<code>01 - Dune</code>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Pattern with punctuation:</strong> <code>{{ '{title}: {series}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>The Name of the Wind: The Kingkiller Chronicle.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Series in folder path:</strong> <code>{{ '{authors}/{series}/{seriesIndex} - {title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss/The Kingkiller Chronicle/01 - The Name of the Wind.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Folder only:</strong> <code>{{ '{title}/' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>/The Name of the Wind/name_of_the_wind_original.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Absolute path:</strong> <code>{{ '/{authors}/{title}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>/Patrick Rothfuss/The Name of the Wind.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Reuse original filename in path:</strong> <code>{{ '{authors}/{series}/{currentFilename}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Patrick Rothfuss/The Kingkiller Chronicle/name_of_the_wind_original.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Title + Subtitle:</strong> <code>{{ '{title}: {subtitle}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>The Name of the Wind: The Kingkiller Chronicle: Day One.epub</code></p>
</div>
</div>
</div>
<p-divider></p-divider>
<div class="example-category">
<h4 class="subsection-title">Examples with Missing Optional Fields</h4>
<div class="metadata-sample">
<span>title: <code>Project Hail Mary</code></span>
<span>subtitle: <code>(not provided)</code></span>
<span>authors: <code>Andy Weir</code></span>
<span>year: <code>2021</code></span>
<span>series: <code>(not provided)</code></span>
<span>seriesIndex: <code>(not provided)</code></span>
<span>currentFilename: <code>project_hail_mary_final.epub</code></span>
</div>
<div class="example-list">
<div class="example-item">
<p class="example-pattern"><strong>Pattern with optional blocks:</strong> <code>{{ '{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Andy Weir/Project Hail Mary (2021).epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Fallback with seriesIndex and dash:</strong> <code>{{ '<{seriesIndex}. >{title}< - {authors}>' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Project Hail Mary - Andy Weir.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Brackets & punctuation fallback:</strong> <code>{{ '<[{series}] >{title} - {authors}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Project Hail Mary - Andy Weir.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Series + punctuation fallback:</strong> <code>{{ '<{series}: >{title} by {authors}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Project Hail Mary by Andy Weir.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Use original filename with year suffix:</strong> <code>{{ '{authors}/{year}__{currentFilename}' }}</code></p>
<p class="example-output"><strong>Output:</strong> <code>Andy Weir/2021__project_hail_mary_final.epub</code></p>
</div>
<div class="example-item">
<p class="example-pattern"><strong>Title + Subtitle fallback:</strong> <code>{{ '{title}
<: {subtitle}>' }}
</code></p>
<p class="example-output"><strong>Output:</strong> <code>Project Hail Mary.epub</code></p>
<div class="result-item">
<span class="result-prefix">Without:</span>
<code>Dune</code>
</div>
</div>
</div>
@@ -290,4 +202,126 @@
</div>
</div>
</div>
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-eye"></i>
Pattern Examples
</h3>
<p class="section-description">
Sample patterns with example metadata to help you understand how patterns work.
</p>
</div>
<div class="section-body">
<div class="examples-container">
<div class="example-category">
<div class="category-header">
<h4 class="category-title">
<i class="pi pi-check-circle"></i>
With Full Metadata
</h4>
<div class="sample-metadata">
<div class="metadata-items">
<span><strong>title:</strong> <code>The Name of the Wind</code></span>
<span><strong>subtitle:</strong> <code>Special Edition</code></span>
<span><strong>authors:</strong> <code>Patrick Rothfuss</code></span>
<span><strong>series:</strong> <code>The Kingkiller Chronicle</code></span>
<span><strong>seriesIndex:</strong> <code>01</code></span>
<span><strong>year:</strong> <code>2007</code></span>
</div>
</div>
</div>
<div class="example-grid">
<div class="example-row">
<span class="pattern-label">Basic pattern</span>
<span class="pattern-col"><code>{{ '{authors} - {title}' }}</code></span>
<span class="result-col"><code>Patrick Rothfuss - The Name of the Wind.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">With punctuation</span>
<span class="pattern-col"><code>{{ '{title}: {series}' }}</code></span>
<span class="result-col"><code>The Name of the Wind: The Kingkiller Chronicle.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Series in folder</span>
<span class="pattern-col"><code>{{ '{authors}/{series}/{seriesIndex} - {title}' }}</code></span>
<span class="result-col"><code>Patrick Rothfuss/The Kingkiller Chronicle/01 - The Name of the Wind.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Folder only</span>
<span class="pattern-col"><code>{{ '{title}/' }}</code></span>
<span class="result-col"><code>The Name of the Wind/name_of_the_wind_original.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Absolute path</span>
<span class="pattern-col"><code>{{ '/{authors}/{title}' }}</code></span>
<span class="result-col"><code>/Patrick Rothfuss/The Name of the Wind.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Title + Subtitle</span>
<span class="pattern-col"><code>{{ '{title}: {subtitle}' }}</code></span>
<span class="result-col"><code>The Name of the Wind: Special Edition.epub</code></span>
</div>
</div>
</div>
<div class="section-divider"><hr></div>
<div class="example-category">
<div class="category-header">
<h4 class="category-title">
<i class="pi pi-question-circle"></i>
With Missing Optional Fields
</h4>
<div class="sample-metadata">
<div class="metadata-items">
<span><strong>title:</strong> <code>Project Hail Mary</code></span>
<span><strong>subtitle:</strong> <em class="not-set">not set</em></span>
<span><strong>authors:</strong> <code>Andy Weir</code></span>
<span><strong>year:</strong> <code>2021</code></span>
<span><strong>series:</strong> <em class="not-set">not set</em></span>
<span><strong>seriesIndex:</strong> <em class="not-set">not set</em></span>
</div>
</div>
</div>
<div class="example-grid">
<div class="example-row">
<span class="pattern-label">Optional blocks</span>
<span class="pattern-col"><code>{{ '{authors}/<{series}/><{seriesIndex}. >{title}< ({year})>' }}</code></span>
<span class="result-col"><code>Andy Weir/Project Hail Mary (2021).epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">SeriesIndex fallback</span>
<span class="pattern-col"><code>{{ '<{seriesIndex}. >{title}< - {authors}>' }}</code></span>
<span class="result-col"><code>Project Hail Mary - Andy Weir.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Brackets fallback</span>
<span class="pattern-col"><code>{{ '<[{series}] >{title} - {authors}' }}</code></span>
<span class="result-col"><code>Project Hail Mary - Andy Weir.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Series punctuation</span>
<span class="pattern-col"><code>{{ '<{series}: >{title} by {authors}' }}</code></span>
<span class="result-col"><code>Project Hail Mary by Andy Weir.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Year prefix</span>
<span class="pattern-col"><code>{{ '{authors}/{year}__{currentFilename}' }}</code></span>
<span class="result-col"><code>Andy Weir/2021__project_hail_mary_final.epub</code></span>
</div>
<div class="example-row">
<span class="pattern-label">Subtitle fallback</span>
<span class="pattern-col"><code>{{ '{title}<: {subtitle}>' }}</code></span>
<span class="result-col"><code>Project Hail Mary.epub</code></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -1,170 +1,124 @@
.main-container {
width: 100%;
padding: 1rem;
height: calc(100dvh - 10.5rem);
overflow-y: auto;
border-width: 1px;
border-radius: 0.5rem;
@use '../../../shared/styles/settings-shared' as settings;
@media (min-width: 768px) {
height: calc(100dvh - 11.65rem);
}
.file-naming-container {
@include settings.settings-page-container;
}
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header {
margin-top: 1rem;
margin-bottom: 2rem;
}
@include settings.settings-page-header;
@include settings.settings-section-divider;
.settings-title {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.25rem;
font-weight: 700;
color: var(--p-text-color);
margin: 0 0 0.75rem 0;
.pi {
color: var(--p-primary-color);
font-size: 1.25rem;
}
@include settings.settings-page-title;
margin-bottom: 0.75rem;
}
.settings-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
@include settings.settings-page-description;
}
.warning-notice {
margin-top: -2rem;
margin-bottom: 1rem;
}
.important-warning {
border: 1px solid var(--p-red-900);
border-left: 4px solid var(--p-red-500);
background: rgba(127, 29, 29, 0.2);
padding: 1rem;
border-radius: 6px;
margin-bottom: 2rem;
h4 {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--p-red-300);
font-weight: 700;
margin: 0 0 0.5rem 0;
font-size: 0.95rem;
}
p {
color: var(--p-red-100);
font-size: 0.85rem;
line-height: 1.5;
margin: 0 0 0.5rem 0;
&:last-child {
margin-bottom: 0;
}
}
strong {
color: var(--p-red-200);
text-decoration: underline;
}
}
.settings-content {
display: flex;
flex-direction: column;
gap: 3rem;
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 1rem;
}
}
.section-header {
margin-bottom: 1rem;
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.125rem;
font-weight: 600;
color: var(--p-text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--p-primary-color);
}
}
.section-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
margin: 0;
@include settings.settings-warning-notice;
}
.settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
@include settings.settings-card;
}
.section-header {
@include settings.settings-section-header;
}
.section-title {
@include settings.settings-section-title;
}
.section-description {
@include settings.settings-section-description;
}
.section-body {
@include settings.settings-section-body;
}
// Empty state
.empty-state {
display: flex;
flex-direction: column;
gap: 1.5rem;
align-items: center;
justify-content: center;
padding: 3rem 2rem;
text-align: center;
color: var(--p-text-muted-color);
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 6px;
@media (max-width: 767px) {
padding: 1rem;
gap: 1rem;
.pi {
font-size: 2.5rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.empty-title {
font-size: 1rem;
font-weight: 600;
margin: 0 0 0.5rem 0;
color: var(--p-text-color);
}
.empty-subtitle {
font-size: settings.$settings-section-description-size;
margin: 0;
}
}
.form-field {
// Default pattern card
.default-pattern-card {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border: 1px solid var(--p-content-border-color);
border-left: 3px solid var(--p-primary-color);
border-radius: 6px;
padding: 1rem;
}
.pattern-input-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
label {
font-weight: 600;
color: var(--p-text-color);
font-size: 0.9rem;
}
}
.pattern-input-group {
.pattern-input-row {
display: flex;
gap: 1rem;
gap: 0.75rem;
align-items: flex-start;
@media (max-width: 768px) {
flex-direction: column;
gap: 0.75rem;
gap: 0.5rem;
p-button {
align-self: flex-end;
}
}
}
.error-message {
color: var(--p-red-500);
font-size: 0.9rem;
margin-top: 0.25rem;
.pattern-input {
flex: 1;
width: 100%;
}
.preview-section {
display: flex;
gap: 0.5rem;
align-items: center;
.error-text {
@include settings.settings-error-text;
}
@media (max-width: 767px) {
.preview-row {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.25rem;
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;
gap: 0.25rem;
@@ -172,277 +126,368 @@
}
.preview-label {
display: flex;
align-items: center;
gap: 0.375rem;
color: var(--p-text-muted-color);
font-size: 0.9rem;
font-size: settings.$settings-section-description-size;
white-space: nowrap;
.pi {
font-size: 0.75rem;
}
}
.preview-value {
color: var(--p-green-500);
font-size: 0.8rem;
font-family: monospace;
color: var(--p-green-400);
font-size: settings.$settings-section-description-size;
background: transparent;
padding: 0;
word-break: break-all;
}
.library-patterns {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.library-pattern-item {
// Libraries list
.libraries-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
border: 1px solid var(--p-surface-800);
border-left: 3px solid var(--p-primary-color);
border-radius: 6px;
background: var(--p-surface-900);
padding: 1rem;
}
@media (max-width: 767px) {
padding: 0.75rem;
.library-item {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border: 1px solid var(--p-content-border-color);
border-left: 3px solid var(--p-content-border-color);
border-radius: 6px;
transition: border-color 0.2s ease, background 0.2s ease;
&:hover {
background: color-mix(in srgb, var(--ground-background) 40%, var(--p-surface-800) 60%);
}
&.has-pattern {
border-left-color: var(--p-primary-color);
}
}
.library-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 0.5rem;
justify-content: space-between;
gap: 1rem;
padding: 0.75rem 1rem;
border-bottom: 1px dashed var(--p-content-border-color);
@media (max-width: 600px) {
flex-wrap: wrap;
}
}
.library-info {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
min-width: 0;
}
.library-icon {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
color: var(--p-primary-color);
border-radius: 6px;
flex-shrink: 0;
.pi {
color: var(--p-primary-color);
font-size: 0.875rem;
}
}
.library-name {
font-weight: 500;
color: var(--p-text-color);
min-width: 100px;
}
.library-input-group {
display: flex;
gap: 1rem;
align-items: flex-start;
@media (max-width: 768px) {
flex-direction: column;
gap: 0.75rem;
}
}
.form-actions {
display: flex;
justify-content: flex-end;
@media (max-width: 767px) {
justify-content: stretch;
p-button {
width: 100%;
}
}
}
.subsection-title {
font-size: 1rem;
font-weight: 600;
font-size: 0.9375rem;
color: var(--p-text-color);
margin-bottom: 1rem;
}
.placeholders-info {
display: flex;
flex-direction: column;
gap: 1.5rem;
@media (max-width: 767px) {
gap: 1rem;
}
.custom-badge {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.5rem;
background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
color: var(--p-primary-color);
border-radius: 12px;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
}
.placeholders-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
code {
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
}
.default-badge {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.5rem;
background: color-mix(in srgb, #6b7280 15%, transparent);
color: #6b7280;
border-radius: 12px;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
}
.library-body {
padding: 0.75rem 1rem;
}
.actions-row {
@include settings.settings-actions-row;
margin-top: 0.5rem;
}
// Placeholders Reference Section
.placeholders-grid {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
gap: 1rem;
@media (min-width: 768px) {
grid-template-columns: 1fr auto 1fr;
}
@media (max-width: 767px) {
gap: 1.5rem;
grid-template-columns: 1fr 1fr;
}
}
.placeholders-list {
ul {
list-style: disc;
padding-left: 1.5rem;
margin: 0;
.placeholder-group {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 6px;
padding: 1rem;
border-left: 3px solid var(--p-primary-color);
@media (max-width: 767px) {
padding-left: 1rem;
}
li {
color: var(--p-text-color);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.placeholder-code {
color: var(--p-orange-400);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
font-family: monospace;
}
.optional-blocks-info {
p {
color: var(--p-text-color);
font-size: 0.9rem;
line-height: 1.5;
margin-bottom: 1rem;
}
}
.example-section {
margin-top: 1rem;
}
.example-label {
.group-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-label-size;
font-weight: 600;
color: var(--p-text-color);
margin-bottom: 0.5rem;
}
margin: 0 0 0.75rem 0;
.example-list {
list-style: disc;
padding-left: 1.5rem;
@media (max-width: 767px) {
padding-left: 0;
list-style: none;
}
li {
color: var(--p-text-color);
font-size: 0.9rem;
margin-bottom: 0.25rem;
.pi {
color: var(--p-primary-color);
font-size: 0.875rem;
}
}
.examples-section {
.group-description {
font-size: settings.$settings-section-description-size;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0 0 0.75rem 0;
code {
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
}
}
.placeholder-list {
display: flex;
flex-direction: column;
gap: 2rem;
gap: 0.375rem;
}
@media (max-width: 767px) {
gap: 1.5rem;
.placeholder-item {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: settings.$settings-section-description-size;
code {
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
min-width: 130px;
}
span {
color: var(--p-text-muted-color);
}
}
.example-block {
background: color-mix(in srgb, var(--p-surface-800) 30%, transparent);
border-radius: 4px;
padding: 0.75rem;
}
.example-pattern {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
.pattern-prefix {
font-size: settings.$settings-description-size;
color: var(--p-text-muted-color);
}
code {
color: var(--p-orange-400);
font-size: settings.$settings-section-description-size;
}
}
.example-results {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.result-item {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-section-description-size;
.result-prefix {
font-size: settings.$settings-description-size;
color: var(--p-text-muted-color);
min-width: 70px;
}
code {
color: var(--p-green-400);
font-size: settings.$settings-description-size;
}
}
// Pattern Examples Section
.examples-container {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.example-category {
display: flex;
flex-direction: column;
gap: 1rem;
gap: 0.75rem;
}
.metadata-sample {
.category-header {
margin-bottom: 0.25rem;
}
.category-title {
display: flex;
flex-direction: column;
gap: 0.25rem;
background: var(--p-surface-800);
padding: 1rem;
border-radius: 6px;
margin-bottom: 1rem;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-label-size;
font-weight: 600;
color: var(--p-text-color);
margin: 0 0 0.5rem 0;
@media (max-width: 767px) {
padding: 0.75rem;
.pi {
font-size: 0.875rem;
}
span {
font-size: 0.9rem;
color: var(--p-text-muted-color);
.pi-check-circle {
color: var(--p-green-400);
}
code {
color: var(--p-text-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
}
.pi-question-circle {
color: var(--p-orange-400);
}
}
.example-list {
.sample-metadata {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
padding: 0.75rem 1rem;
border-radius: 4px;
border-left: 3px solid var(--p-content-border-color);
}
.metadata-items {
display: flex;
flex-direction: column;
gap: 1rem;
@media (max-width: 767px) {
gap: 0.75rem;
}
}
.example-item {
background: var(--p-surface-800);
padding: 1rem;
border-radius: 6px;
border-left: 3px solid var(--p-primary-color);
@media (max-width: 767px) {
padding: 0.75rem;
}
}
.example-pattern {
font-size: 0.9rem;
margin-bottom: 0.5rem;
flex-wrap: wrap;
gap: 0.5rem 1rem;
font-size: settings.$settings-section-description-size;
color: var(--p-text-muted-color);
strong {
color: var(--p-text-color);
font-weight: 500;
}
code {
color: var(--p-text-muted-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
color: var(--p-text-color);
font-size: settings.$settings-description-size;
}
.not-set {
opacity: 0.6;
font-style: italic;
}
}
.example-output {
font-size: 0.9rem;
margin: 0;
.example-grid {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
strong {
.example-row {
display: grid;
grid-template-columns: 130px 1fr 1fr;
gap: 0.75rem;
padding: 0.625rem 0.75rem;
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 4px;
font-size: settings.$settings-section-description-size;
align-items: center;
@media (max-width: 1024px) {
grid-template-columns: 1fr;
gap: 0.375rem;
padding: 0.625rem 0.75rem;
}
}
.pattern-label {
color: var(--p-text-muted-color);
font-size: settings.$settings-section-description-size;
white-space: nowrap;
@media (max-width: 1024px) {
font-weight: 500;
color: var(--p-text-color);
}
}
.pattern-col {
code {
color: var(--p-text-muted-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
word-break: break-all;
}
@media (max-width: 1024px) {
padding-left: 0.5rem;
}
}
.full-width {
width: 100%;
.result-col {
code {
color: var(--p-green-400);
font-size: settings.$settings-description-size;
word-break: break-all;
}
@media (max-width: 1024px) {
padding-left: 0.5rem;
border-left: 2px solid var(--p-green-400);
}
}
@@ -9,14 +9,13 @@ import {catchError, filter, take} from 'rxjs/operators';
import {Library} from '../../book/model/library.model';
import {LibraryService} from '../../book/service/library.service';
import {InputText} from 'primeng/inputtext';
import {Divider} from 'primeng/divider';
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
@Component({
selector: 'app-file-naming-pattern',
templateUrl: './file-naming-pattern.component.html',
standalone: true,
imports: [FormsModule, Button, InputText, Divider, ExternalDocLinkComponent],
imports: [FormsModule, Button, InputText, ExternalDocLinkComponent],
styleUrls: ['./file-naming-pattern.component.scss'],
})
export class FileNamingPatternComponent implements OnInit {
@@ -119,7 +118,7 @@ export class FileNamingPatternComponent implements OnInit {
}
this.appSettingsService
.saveSettings([
{ key: AppSettingKey.UPLOAD_FILE_PATTERN, newValue: this.defaultPattern },
{key: AppSettingKey.UPLOAD_FILE_PATTERN, newValue: this.defaultPattern},
])
.subscribe({
next: () => this.showMessage('success', 'Settings Saved', 'The default pattern was successfully saved!'),
@@ -144,6 +143,6 @@ export class FileNamingPatternComponent implements OnInit {
}
private showMessage(severity: 'success' | 'error', summary: string, detail: string): void {
this.messageService.add({ severity, summary, detail });
this.messageService.add({severity, summary, detail});
}
}