Move custom fonts management to Reader tab (#2161)
Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -1,24 +1,4 @@
|
||||
<div class="main-container enclosing-container">
|
||||
<div class="settings-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h2 class="settings-title">
|
||||
<i class="pi pi-palette"></i>
|
||||
Custom Fonts
|
||||
</h2>
|
||||
<p class="settings-description">
|
||||
Upload and manage your own fonts for a personalized reading experience in the EPUB reader.
|
||||
You have {{ customFonts.length }} of {{ maxFonts }} custom fonts.
|
||||
</p>
|
||||
</div>
|
||||
<p-button
|
||||
label="Add New Font"
|
||||
icon="pi pi-plus"
|
||||
(click)="openUploadDialog()"
|
||||
[disabled]="customFonts.length >= maxFonts"
|
||||
></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="settings-content">
|
||||
|
||||
@@ -42,81 +22,85 @@
|
||||
} @else {
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-book"></i>
|
||||
Your Font Library
|
||||
<span class="font-count">({{ customFonts.length }})</span>
|
||||
</h3>
|
||||
<p class="section-description">
|
||||
Manage your uploaded custom fonts. Each font can be selected in the EPUB reader settings.
|
||||
</p>
|
||||
<div>
|
||||
<h3 class="section-title">
|
||||
Your Font Library
|
||||
<span class="font-count">({{ customFonts.length }})</span>
|
||||
</h3>
|
||||
</div>
|
||||
<p-button
|
||||
label="Add New Font"
|
||||
icon="pi pi-plus"
|
||||
(click)="openUploadDialog()"
|
||||
[disabled]="customFonts.length >= maxFonts"
|
||||
></p-button>
|
||||
</div>
|
||||
|
||||
<div class="fonts-grid">
|
||||
@for (font of customFonts; track font.id) {
|
||||
<div class="settings-card font-card">
|
||||
<div class="font-card-header">
|
||||
<div class="font-title-group">
|
||||
<h4 class="font-name">{{ font.fontName }}</h4>
|
||||
<span class="format-tag">{{ font.format }}</span>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
[text]="true"
|
||||
[rounded]="true"
|
||||
size="small"
|
||||
(click)="deleteFont(font)"
|
||||
pTooltip="Delete font"
|
||||
tooltipPosition="left"
|
||||
></p-button>
|
||||
<div class="settings-card font-card">
|
||||
<div class="font-card-header">
|
||||
<div class="font-title-group">
|
||||
<h4 class="font-name">{{ font.fontName }}</h4>
|
||||
<span class="format-tag">{{ font.format }}</span>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
[text]="true"
|
||||
[rounded]="true"
|
||||
size="small"
|
||||
(click)="deleteFont(font)"
|
||||
pTooltip="Delete font"
|
||||
tooltipPosition="left"
|
||||
></p-button>
|
||||
</div>
|
||||
|
||||
<div class="font-preview-area">
|
||||
<label class="preview-label">
|
||||
<i class="pi pi-eye"></i>
|
||||
Preview
|
||||
</label>
|
||||
@if (!fontsLoadedInBrowser) {
|
||||
<div class="font-preview-skeleton">
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="60%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="95%" height="0.875rem"></p-skeleton>
|
||||
<div class="font-preview-area">
|
||||
<label class="preview-label">
|
||||
<i class="pi pi-eye"></i>
|
||||
Preview
|
||||
</label>
|
||||
@if (!fontsLoadedInBrowser) {
|
||||
<div class="font-preview-skeleton">
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="60%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="95%" height="0.875rem"></p-skeleton>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="font-preview" [style.font-family]="font.fontName">
|
||||
<p class="preview-paragraph">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
</p>
|
||||
<p class="preview-paragraph-small">
|
||||
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
<div class="preview-characters">
|
||||
<span>ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="font-preview" [style.font-family]="font.fontName">
|
||||
<p class="preview-paragraph">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
</p>
|
||||
<p class="preview-paragraph-small">
|
||||
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
</p>
|
||||
<div class="preview-characters">
|
||||
<span>ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="font-metadata">
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-file"></i>File</span>
|
||||
<span class="meta-value">{{ font.originalFileName }}</span>
|
||||
</div>
|
||||
|
||||
<div class="font-metadata">
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-file"></i>File</span>
|
||||
<span class="meta-value">{{ font.originalFileName }}</span>
|
||||
</div>
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-database"></i>Size</span>
|
||||
<span class="meta-value">{{ formatFileSize(font.fileSize) }}</span>
|
||||
</div>
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-calendar"></i>Uploaded</span>
|
||||
<span class="meta-value">{{ font.uploadedAt | date: 'mediumDate' }}</span>
|
||||
</div>
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-database"></i>Size</span>
|
||||
<span class="meta-value">{{ formatFileSize(font.fileSize) }}</span>
|
||||
</div>
|
||||
<div class="metadata-row">
|
||||
<span class="meta-label"><i class="pi pi-calendar"></i>Uploaded</span>
|
||||
<span class="meta-value">{{ font.uploadedAt | date: 'mediumDate' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -65,13 +65,10 @@
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.preferences-section {
|
||||
@media (min-width: 768px) {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -33,11 +33,11 @@ export class EpubReaderPreferencesComponent implements OnInit, OnDestroy {
|
||||
|
||||
fonts = [
|
||||
{name: 'Book Default', displayName: 'Default', key: null},
|
||||
{name: 'Serif', displayName: 'Aa', key: 'serif'},
|
||||
{name: 'Sans Serif', displayName: 'Aa', key: 'sans-serif'},
|
||||
{name: 'Roboto', displayName: 'Aa', key: 'roboto'},
|
||||
{name: 'Cursive', displayName: 'Aa', key: 'cursive'},
|
||||
{name: 'Monospace', displayName: 'Aa', key: 'monospace'}
|
||||
{name: 'Serif', displayName: 'Serif', key: 'serif'},
|
||||
{name: 'Sans Serif', displayName: 'Sans Serif', key: 'sans-serif'},
|
||||
{name: 'Roboto', displayName: 'Roboto', key: 'roboto'},
|
||||
{name: 'Cursive', displayName: 'Cursive', key: 'cursive'},
|
||||
{name: 'Monospace', displayName: 'Monospace', key: 'monospace'}
|
||||
];
|
||||
|
||||
readonly flowOptions = [
|
||||
|
||||
+15
@@ -152,5 +152,20 @@
|
||||
</app-cbx-reader-preferences-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preferences-section">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">
|
||||
<i class="pi pi-palette"></i>
|
||||
Custom Fonts Management
|
||||
</h3>
|
||||
<p class="section-description">
|
||||
Upload and manage up to 10 custom fonts for a personalized reading experience in the EPUB reader. Each font can then be selected in the EPUB reader settings.
|
||||
</p>
|
||||
</div>
|
||||
<div class="settings-card">
|
||||
<app-custom-fonts></app-custom-fonts>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -9,13 +9,14 @@ import {ReaderPreferencesService} from './reader-preferences-service';
|
||||
import {EpubReaderPreferencesComponent} from './epub-reader-preferences/epub-reader-preferences-component';
|
||||
import {PdfReaderPreferencesComponent} from './pdf-reader-preferences/pdf-reader-preferences-component';
|
||||
import {CbxReaderPreferencesComponent} from './cbx-reader-preferences/cbx-reader-preferences-component';
|
||||
import {CustomFontsComponent} from '../custom-fonts/custom-fonts.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reader-preferences',
|
||||
templateUrl: './reader-preferences.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./reader-preferences.component.scss'],
|
||||
imports: [FormsModule, TooltipModule, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent]
|
||||
imports: [FormsModule, TooltipModule, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent, CustomFontsComponent]
|
||||
})
|
||||
export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
readonly scopeOptions = [
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<p-tab [value]="SettingsTab.ReaderSettings">
|
||||
<i class="pi pi-book"></i> Reader
|
||||
</p-tab>
|
||||
<p-tab [value]="SettingsTab.CustomFonts">
|
||||
<i class="pi pi-palette"></i> Custom Fonts
|
||||
</p-tab>
|
||||
<p-tab [value]="SettingsTab.ViewPreferences">
|
||||
<i class="pi pi-desktop"></i> View
|
||||
</p-tab>
|
||||
@@ -59,9 +56,6 @@
|
||||
<p-tabpanel [value]="SettingsTab.ReaderSettings">
|
||||
<app-reader-preferences></app-reader-preferences>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel [value]="SettingsTab.CustomFonts">
|
||||
<app-custom-fonts></app-custom-fonts>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel [value]="SettingsTab.ViewPreferences">
|
||||
<app-view-preferences-parent></app-view-preferences-parent>
|
||||
</p-tabpanel>
|
||||
|
||||
@@ -15,13 +15,11 @@ import {OpdsSettings} from './opds-settings/opds-settings';
|
||||
import {MetadataSettingsComponent} from './metadata-settings/metadata-settings-component';
|
||||
import {DeviceSettingsComponent} from './device-settings/device-settings-component';
|
||||
import {LibraryMetadataSettingsComponent} from './library-metadata-settings/library-metadata-settings.component';
|
||||
import { PageTitleService } from "../../shared/service/page-title.service";
|
||||
import {PageTitleService} from "../../shared/service/page-title.service";
|
||||
import {EmailV2Component} from './email-v2/email-v2.component';
|
||||
import {CustomFontsComponent} from './custom-fonts/custom-fonts.component';
|
||||
|
||||
export enum SettingsTab {
|
||||
ReaderSettings = 'reader',
|
||||
CustomFonts = 'custom-fonts',
|
||||
ViewPreferences = 'view',
|
||||
DeviceSettings = 'device',
|
||||
UserManagement = 'user',
|
||||
@@ -49,7 +47,6 @@ export enum SettingsTab {
|
||||
AuthenticationSettingsComponent,
|
||||
ViewPreferencesParentComponent,
|
||||
ReaderPreferences,
|
||||
CustomFontsComponent,
|
||||
MetadataSettingsComponent,
|
||||
DeviceSettingsComponent,
|
||||
FileNamingPatternComponent,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CustomFont } from '../model/custom-font.model';
|
||||
import {CustomFont} from '../model/custom-font.model';
|
||||
|
||||
/**
|
||||
* Font dropdown item for epub-reader component (PrimeNG Select format)
|
||||
@@ -39,12 +39,6 @@ export function addCustomFontsToDropdown<T extends FontDropdownItem | FontPrefer
|
||||
targetArray.splice(separatorIndex, 1);
|
||||
}
|
||||
|
||||
(targetArray as FontDropdownItem[]).push({
|
||||
label: '--- Custom Fonts ---',
|
||||
value: 'separator',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
fonts.forEach(font => {
|
||||
(targetArray as FontDropdownItem[]).push({
|
||||
label: font.fontName,
|
||||
@@ -57,12 +51,6 @@ export function addCustomFontsToDropdown<T extends FontDropdownItem | FontPrefer
|
||||
targetArray.splice(separatorIndex, 1);
|
||||
}
|
||||
|
||||
(targetArray as FontPreferenceItem[]).push({
|
||||
name: '--- Custom Fonts ---',
|
||||
displayName: '---',
|
||||
key: 'separator'
|
||||
});
|
||||
|
||||
fonts.forEach(font => {
|
||||
(targetArray as FontPreferenceItem[]).push({
|
||||
name: font.fontName,
|
||||
|
||||
Reference in New Issue
Block a user