Improve the SVG fetching and caching logic (#2011)
Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
+34
-34
@@ -23,23 +23,23 @@
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</label>
|
||||
<div class="radio-group">
|
||||
<div class="radio-option">
|
||||
<p-radioButton name="viewMode"
|
||||
[value]="'route'"
|
||||
[(ngModel)]="viewMode"
|
||||
inputId="viewModeRoute"
|
||||
(onClick)="onViewModeChange('route')"></p-radioButton>
|
||||
<label for="viewModeRoute">Open in Page</label>
|
||||
</div>
|
||||
<div class="radio-option">
|
||||
<p-radioButton name="viewMode"
|
||||
[value]="'dialog'"
|
||||
[(ngModel)]="viewMode"
|
||||
inputId="viewModeDialog"
|
||||
(onClick)="onViewModeChange('dialog')"></p-radioButton>
|
||||
<label for="viewModeDialog">Open in Popup</label>
|
||||
</div>
|
||||
<div class="button-group">
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="viewMode === 'route'"
|
||||
(click)="onViewModeChange('route')">
|
||||
<i class="pi pi-window-maximize"></i>
|
||||
<span class="option-text">Open in Page</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="viewMode === 'dialog'"
|
||||
(click)="onViewModeChange('dialog')">
|
||||
<i class="pi pi-external-link"></i>
|
||||
<span class="option-text">Open in Dialog</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
@@ -59,23 +59,23 @@
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</label>
|
||||
<div class="radio-group">
|
||||
<div class="radio-option">
|
||||
<p-radioButton name="seriesViewMode"
|
||||
[value]="true"
|
||||
[(ngModel)]="seriesViewMode"
|
||||
inputId="seriesViewModeTrue"
|
||||
(onClick)="onSeriesViewModeChange(true)"></p-radioButton>
|
||||
<label for="seriesViewModeTrue">Enabled</label>
|
||||
</div>
|
||||
<div class="radio-option">
|
||||
<p-radioButton name="seriesViewMode"
|
||||
[value]="false"
|
||||
[(ngModel)]="seriesViewMode"
|
||||
inputId="seriesViewModeFalse"
|
||||
(onClick)="onSeriesViewModeChange(false)"></p-radioButton>
|
||||
<label for="seriesViewModeFalse">Disabled</label>
|
||||
</div>
|
||||
<div class="button-group">
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="seriesViewMode === true"
|
||||
(click)="onSeriesViewModeChange(true)">
|
||||
<i class="pi pi-check-circle"></i>
|
||||
<span class="option-text">Enabled</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="seriesViewMode === false"
|
||||
(click)="onSeriesViewModeChange(false)">
|
||||
<i class="pi pi-times-circle"></i>
|
||||
<span class="option-text">Disabled</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
|
||||
+46
-25
@@ -64,6 +64,11 @@
|
||||
gap: 2rem;
|
||||
padding: 0.25rem 0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
@@ -96,16 +101,6 @@
|
||||
flex-shrink: 0;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
@@ -129,24 +124,50 @@
|
||||
}
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.radio-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--p-text-color);
|
||||
.option-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.375rem;
|
||||
border: 1.5px solid color-mix(in srgb, var(--text-color) 20%, transparent);
|
||||
background: color-mix(in srgb, var(--text-color) 5%, transparent);
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
min-width: 4.5rem;
|
||||
|
||||
i {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.option-text {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border-color: var(--primary-color);
|
||||
background: color-mix(in srgb, var(--primary-color) 10%, transparent);
|
||||
color: var(--primary-color);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 15%, transparent);
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -1,6 +1,5 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {UserService} from '../../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
@@ -11,7 +10,6 @@ import {Subject} from 'rxjs';
|
||||
selector: 'app-meta-center-view-mode-component',
|
||||
imports: [
|
||||
Tooltip,
|
||||
RadioButton,
|
||||
FormsModule
|
||||
],
|
||||
templateUrl: './meta-center-view-mode-component.html',
|
||||
|
||||
+24
-24
@@ -28,11 +28,11 @@
|
||||
<label class="setting-label">Default Preferences</label>
|
||||
<div class="select-group">
|
||||
<p-select size="small" [options]="sortOptions" optionLabel="label" optionValue="field"
|
||||
[(ngModel)]="selectedSort" placeholder="Sort" class="select-item"></p-select>
|
||||
[(ngModel)]="selectedSort" placeholder="Sort By" class="select-item" appendTo="body"></p-select>
|
||||
<p-select size="small" [options]="sortDirectionOptions" [(ngModel)]="selectedSortDir"
|
||||
placeholder="Direction" class="select-item"></p-select>
|
||||
placeholder="Direction" class="select-item" appendTo="body"></p-select>
|
||||
<p-select size="small" [options]="viewModeOptions" [(ngModel)]="selectedView"
|
||||
placeholder="View" class="select-item"></p-select>
|
||||
placeholder="View Mode" class="select-item" appendTo="body"></p-select>
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
@@ -57,35 +57,35 @@
|
||||
<div class="settings-card">
|
||||
<div class="setting-item no-border">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Override Management</label>
|
||||
<p-button label="Add New Override" outlined size="small" (onClick)="addOverride()"
|
||||
severity="info" icon="pi pi-plus" [disabled]="availableLibraries.length === 0"></p-button>
|
||||
</div>
|
||||
<label class="setting-label">Override Management</label>
|
||||
<p class="setting-description">
|
||||
Add custom preferences for specific libraries or shelves.
|
||||
Add custom preferences for specific libraries or shelves. These will override your default settings.
|
||||
</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<p-button label="Add Override" outlined size="small" (onClick)="addOverride()"
|
||||
severity="success" icon="pi pi-plus" [disabled]="availableLibraries.length === 0"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (overrides.length > 0) {
|
||||
<div class="overrides-table">
|
||||
<p-table [value]="overrides">
|
||||
<p-table [value]="overrides" [tableStyle]="{'width': '100%'}">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th class="min-w-[150px] max-w-[220px]">Type</th>
|
||||
<th class="min-w-[220px] max-w-[280px]">Name</th>
|
||||
<th class="min-w-[190px] max-w-[250px]">Sort By</th>
|
||||
<th class="min-w-[125px]">Sort Dir</th>
|
||||
<th class="min-w-[125px]">View</th>
|
||||
<th class="w-[75px] text-center"></th>
|
||||
<th style="min-width: 150px; max-width: 220px;">Type</th>
|
||||
<th style="min-width: 220px; max-width: 280px;">Name</th>
|
||||
<th style="min-width: 190px; max-width: 250px;">Sort By</th>
|
||||
<th style="min-width: 125px;">Direction</th>
|
||||
<th style="min-width: 125px;">View Mode</th>
|
||||
<th style="width: 75px; text-align: center;">Actions</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-override let-rowIndex="rowIndex">
|
||||
<tr>
|
||||
<td>
|
||||
<p-select size="small" [options]="entityTypeOptions" [(ngModel)]="override.entityType"
|
||||
class="w-full" appendTo="body"></p-select>
|
||||
[style]="{'width': '100%'}" appendTo="body"></p-select>
|
||||
</td>
|
||||
<td>
|
||||
@if (override.entityType) {
|
||||
@@ -93,24 +93,24 @@
|
||||
[options]="getAvailableEntities(rowIndex, override.entityType)"
|
||||
[(ngModel)]="override.library"
|
||||
optionLabel="label" optionValue="value"
|
||||
class="w-full" appendTo="body"></p-select>
|
||||
[style]="{'width': '100%'}" appendTo="body"></p-select>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<p-select size="small" [options]="sortOptions" optionLabel="label" optionValue="field"
|
||||
[(ngModel)]="override.sort" class="w-full" appendTo="body"></p-select>
|
||||
[(ngModel)]="override.sort" [style]="{'width': '100%'}" appendTo="body"></p-select>
|
||||
</td>
|
||||
<td>
|
||||
<p-select size="small" [options]="sortDirectionOptions" [(ngModel)]="override.sortDir"
|
||||
class="w-full" appendTo="body"></p-select>
|
||||
[style]="{'width': '100%'}" appendTo="body"></p-select>
|
||||
</td>
|
||||
<td>
|
||||
<p-select size="small" [options]="viewModeOptions" [(ngModel)]="override.view"
|
||||
class="w-full" appendTo="body"></p-select>
|
||||
[style]="{'width': '100%'}" appendTo="body"></p-select>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<td style="text-align: center;">
|
||||
<p-button icon="pi pi-trash" severity="danger" size="small" [outlined]="true"
|
||||
(onClick)="removeOverride(rowIndex)"></p-button>
|
||||
(onClick)="removeOverride(rowIndex)" [pTooltip]="'Remove override'" tooltipPosition="left"></p-button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
@@ -121,7 +121,7 @@
|
||||
</div>
|
||||
|
||||
<div class="save-section">
|
||||
<p-button label="Save Settings" icon="pi pi-save" severity="success" outlined (onClick)="saveSettings()"></p-button>
|
||||
<p-button label="Save Settings" icon="pi pi-save" severity="success" (onClick)="saveSettings()"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+29
-9
@@ -1,6 +1,7 @@
|
||||
.main-container {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.enclosing-container {
|
||||
@@ -88,7 +89,7 @@
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
@@ -139,17 +140,17 @@
|
||||
|
||||
.select-group {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
min-width: 150px;
|
||||
min-width: 140px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
min-width: 100%;
|
||||
@@ -181,17 +182,17 @@
|
||||
|
||||
.select-group {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select-item {
|
||||
min-width: 200px;
|
||||
min-width: 140px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
min-width: 100%;
|
||||
@@ -201,16 +202,35 @@
|
||||
|
||||
.overrides-table {
|
||||
width: 100%;
|
||||
margin-top: 1rem;
|
||||
|
||||
::ng-deep {
|
||||
.p-datatable {
|
||||
border: 1px solid var(--p-content-border-color);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
|
||||
.p-datatable-thead > tr > th {
|
||||
font-weight: 600;
|
||||
padding: 0.75rem;
|
||||
background: color-mix(in srgb, var(--text-color) 3%, transparent);
|
||||
border-bottom: 1px solid var(--p-content-border-color);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.p-datatable-tbody > tr > td {
|
||||
padding: 0.5rem;
|
||||
.p-datatable-tbody > tr {
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--text-color) 3%, transparent);
|
||||
}
|
||||
|
||||
> td {
|
||||
padding: 0.75rem;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--p-content-border-color) 50%, transparent);
|
||||
}
|
||||
|
||||
&:last-child > td {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ import {ShelfService} from '../../../book/service/shelf.service';
|
||||
import {combineLatest, Subject} from 'rxjs';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {filter, take, takeUntil} from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
@@ -20,7 +21,8 @@ import {filter, take, takeUntil} from 'rxjs/operators';
|
||||
FormsModule,
|
||||
Button,
|
||||
TableModule,
|
||||
ToastModule
|
||||
ToastModule,
|
||||
Tooltip
|
||||
],
|
||||
templateUrl: './view-preferences.component.html',
|
||||
styleUrl: './view-preferences.component.scss'
|
||||
|
||||
Reference in New Issue
Block a user