refactor(ui): new icon library and user migration (#1828)
This commit is contained in:
@@ -50,27 +50,27 @@
|
||||
<span>
|
||||
{{ t('iconLabel') }}
|
||||
</span>
|
||||
@if (!selectedIcon()) {
|
||||
<button class="icon-picker-trigger" (click)="openIconPicker()" type="button">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>{{ t('chooseIcon') }}</span>
|
||||
</button>
|
||||
} @else {
|
||||
@if (selectedIcon(); as icon) {
|
||||
<div class="icon-selected">
|
||||
<div class="icon-preview">
|
||||
<app-icon-display [icon]="selectedIcon()!" size="16px" />
|
||||
<app-icon-display [icon]="icon" size="16px" />
|
||||
</div>
|
||||
<span class="icon-value">
|
||||
@if (selectedIcon()!.type === 'PRIME_NG') {
|
||||
{{ selectedIcon()!.value }}
|
||||
} @else {
|
||||
@if (icon.type === 'CUSTOM_SVG') {
|
||||
{{ t('customSvg') }}
|
||||
} @else {
|
||||
{{ icon.value }}
|
||||
}
|
||||
</span>
|
||||
<button class="icon-clear" (click)="clearSelectedIcon()" type="button">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<button class="icon-picker-trigger" (click)="openIconPicker()" type="button">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>{{ t('chooseIcon') }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Library, MetadataSource, OrganizationMode } from '../book/model/library
|
||||
import { BookType } from '../book/model/book.model';
|
||||
import { ToggleSwitch } from 'primeng/toggleswitch';
|
||||
import { Tooltip } from 'primeng/tooltip';
|
||||
import { IconPickerService, IconSelection } from '../../shared/service/icon-picker.service';
|
||||
import { IconPickerService } from '../../shared/service/icon-picker.service';
|
||||
import { Button } from 'primeng/button';
|
||||
import { IconDisplayComponent } from '../../shared/components/icon-display/icon-display.component';
|
||||
import { DialogLauncherService } from '../../shared/services/dialog-launcher.service';
|
||||
@@ -20,6 +20,7 @@ import { Checkbox } from 'primeng/checkbox';
|
||||
import { Select } from 'primeng/select';
|
||||
import { TranslocoDirective, TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
||||
import { LibraryImportProgressService } from '../../shared/service/library-import-progress.service';
|
||||
import { IconSelection, toIconSelection } from '../../shared/icons/icon-selection';
|
||||
|
||||
interface FormatEntry { type: BookType; label: string }
|
||||
|
||||
@@ -139,12 +140,7 @@ export class LibraryCreatorComponent {
|
||||
this.folders.set(paths.map(p => p.path));
|
||||
|
||||
if (icon != null && iconType) {
|
||||
if (iconType === 'CUSTOM_SVG') {
|
||||
this.selectedIcon.set({ type: 'CUSTOM_SVG', value: icon });
|
||||
} else {
|
||||
const value = icon.slice(0, 6) === 'pi pi-' ? icon : `pi pi-${icon}`;
|
||||
this.selectedIcon.set({ type: 'PRIME_NG', value });
|
||||
}
|
||||
this.selectedIcon.set(toIconSelection(icon, iconType));
|
||||
}
|
||||
|
||||
if (formatPriority && formatPriority.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user