refactor(ui): new icon library and user migration (#1828)
This commit is contained in:
@@ -14,7 +14,7 @@ import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {MultiSelect} from 'primeng/multiselect';
|
||||
import {AutoComplete} from 'primeng/autocomplete';
|
||||
import {EMPTY_CHECK_OPERATORS, MULTI_VALUE_OPERATORS, RELATIVE_DATE_OPERATORS, parseValue, removeNulls, serializeDateRules} from '../service/magic-shelf-utils';
|
||||
import {IconPickerService, IconSelection} from '../../../shared/service/icon-picker.service';
|
||||
import {IconPickerService} from '../../../shared/service/icon-picker.service';
|
||||
import {CheckboxChangeEvent, Checkbox} from "primeng/checkbox";
|
||||
import {UserService} from "../../settings/user-management/user.service";
|
||||
import {IconDisplayComponent} from '../../../shared/components/icon-display/icon-display.component';
|
||||
@@ -23,6 +23,7 @@ import {BookService} from '../../book/service/book.service';
|
||||
import {ShelfService} from '../../book/service/shelf.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {Textarea} from 'primeng/textarea';
|
||||
import {IconSelection, toIconSelection} from '../../../shared/icons/icon-selection';
|
||||
|
||||
export type RuleOperator =
|
||||
| 'equals'
|
||||
@@ -543,9 +544,7 @@ export class MagicShelfComponent implements OnInit {
|
||||
});
|
||||
|
||||
if (iconValue) {
|
||||
this.selectedIcon = iconValue.startsWith('pi ')
|
||||
? {type: 'PRIME_NG', value: iconValue}
|
||||
: {type: 'CUSTOM_SVG', value: iconValue};
|
||||
this.selectedIcon = toIconSelection(iconValue, shelf?.iconType);
|
||||
} else {
|
||||
this.selectedIcon = null;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ function buildMagicShelf(overrides: Partial<MagicShelf> = {}): MagicShelf {
|
||||
return {
|
||||
id: 1,
|
||||
name: 'Favorites',
|
||||
icon: 'pi pi-star',
|
||||
iconType: 'PRIME_NG',
|
||||
icon: 'star',
|
||||
iconType: 'LUCIDE',
|
||||
filterJson: JSON.stringify(buildGroupRule()),
|
||||
isPublic: false,
|
||||
...overrides,
|
||||
@@ -152,8 +152,8 @@ describe('MagicShelfService', () => {
|
||||
|
||||
service.saveShelf({
|
||||
name: 'Magic',
|
||||
icon: 'pi pi-bolt',
|
||||
iconType: 'PRIME_NG',
|
||||
icon: 'zap',
|
||||
iconType: 'LUCIDE',
|
||||
group,
|
||||
isPublic: true,
|
||||
}).subscribe();
|
||||
@@ -162,8 +162,8 @@ describe('MagicShelfService', () => {
|
||||
expect(request.request.method).toBe('POST');
|
||||
expect(request.request.body).toEqual(expect.objectContaining({
|
||||
name: 'Magic',
|
||||
icon: 'pi pi-bolt',
|
||||
iconType: 'PRIME_NG',
|
||||
icon: 'zap',
|
||||
iconType: 'LUCIDE',
|
||||
filterJson: JSON.stringify(group),
|
||||
isPublic: true,
|
||||
}));
|
||||
|
||||
@@ -9,12 +9,13 @@ import {BookService} from '../../book/service/book.service';
|
||||
import {BookRuleEvaluatorService} from './book-rule-evaluator.service';
|
||||
import {AuthService} from '../../../shared/service/auth.service';
|
||||
import {GroupRule} from '../component/magic-shelf-component';
|
||||
import {IconType} from '../../../shared/icons/icon-selection';
|
||||
|
||||
export interface MagicShelf {
|
||||
id?: number | null;
|
||||
name: string;
|
||||
icon?: string | null;
|
||||
iconType?: 'PRIME_NG' | 'CUSTOM_SVG' | null;
|
||||
iconType?: IconType | null;
|
||||
filterJson: string;
|
||||
isPublic?: boolean;
|
||||
}
|
||||
@@ -72,7 +73,7 @@ export class MagicShelfService {
|
||||
id?: number;
|
||||
name: string | null;
|
||||
icon: string | null;
|
||||
iconType?: 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
iconType?: IconType | null;
|
||||
group: unknown;
|
||||
isPublic?: boolean | null;
|
||||
}): Observable<MagicShelf> {
|
||||
|
||||
Reference in New Issue
Block a user