feat(icons): Made icons for libraries and shelves optional with no default icons. (#2599)

* feat(icons): Made icons for libraries and shelves optional with no default icon displayed.

* Added tests for making sure the API handles nullable icons for Shelves and Libraries.

* Fixed some issues identified during PR review.

* Rebased on develop.
This commit is contained in:
Giroux Arthur
2026-02-07 08:25:34 -07:00
committed by GitHub
parent 07cbf89e4c
commit 14236299f2
28 changed files with 817 additions and 90 deletions
@@ -45,7 +45,7 @@
<div class="form-field">
<label>
Icon <span class="required">*</span>
Icon (Optional)
</label>
@if (!selectedIcon) {
<button class="icon-picker-trigger" (click)="openIconPicker()" type="button">
@@ -70,11 +70,13 @@ export class LibraryCreatorComponent implements OnInit {
this.chosenLibraryName = name;
this.editModeLibraryName = name;
if (iconType === 'CUSTOM_SVG') {
this.selectedIcon = {type: 'CUSTOM_SVG', value: icon};
} else {
const value = icon.slice(0, 6) === 'pi pi-' ? icon : `pi pi-${icon}`;
this.selectedIcon = {type: 'PRIME_NG', value: value};
if (icon != null && iconType) {
if (iconType === 'CUSTOM_SVG') {
this.selectedIcon = {type: 'CUSTOM_SVG', value: icon};
} else {
const value = icon.slice(0, 6) === 'pi pi-' ? icon : `pi pi-${icon}`;
this.selectedIcon = {type: 'PRIME_NG', value: value};
}
}
this.watch = watch;
@@ -186,7 +188,7 @@ export class LibraryCreatorComponent implements OnInit {
}
isLibraryDetailsValid(): boolean {
return !!this.chosenLibraryName.trim() && !!this.selectedIcon;
return !!this.chosenLibraryName.trim();
}
isDirectorySelectionValid(): boolean {
@@ -207,8 +209,8 @@ export class LibraryCreatorComponent implements OnInit {
}
}
const iconValue = this.selectedIcon?.value || 'heart';
const iconType = this.selectedIcon?.type || 'PRIME_NG';
const iconValue = this.selectedIcon?.value ?? null;
const iconType = this.selectedIcon?.type ?? null;
const library: Library = {
name: this.chosenLibraryName,