refactor(ui): new icon library and user migration (#1828)
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@
|
||||
[attr.aria-label]="t('menu.toggleNavigation')"
|
||||
(click)="layoutService.onMenuToggle()"
|
||||
>
|
||||
<i class="pi pi-bars" aria-hidden="true"></i>
|
||||
<svg lucideMenu aria-hidden="true"></svg>
|
||||
</button>
|
||||
<div class="mobile-topbar-brand">
|
||||
<svg class="mobile-topbar-brand-icon" viewBox="0 0 100 126" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
@@ -33,7 +33,7 @@
|
||||
[attr.aria-label]="'common.close' | transloco"
|
||||
(click)="closeSearch()"
|
||||
>
|
||||
<i class="pi pi-times" aria-hidden="true"></i>
|
||||
<svg lucideX aria-hidden="true"></svg>
|
||||
</button>
|
||||
} @else {
|
||||
<button
|
||||
@@ -42,7 +42,7 @@
|
||||
[attr.aria-label]="t('menu.search')"
|
||||
(click)="openSearch()"
|
||||
>
|
||||
<i class="pi pi-search" aria-hidden="true"></i>
|
||||
<svg lucideSearch aria-hidden="true"></svg>
|
||||
</button>
|
||||
}
|
||||
</header>
|
||||
|
||||
+3
-2
@@ -75,8 +75,9 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 1.0938rem;
|
||||
svg {
|
||||
width: 1.0938rem;
|
||||
height: 1.0938rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-7
@@ -59,23 +59,24 @@ describe('AppMobileTopbarComponent', () => {
|
||||
expect(commandPaletteService.open).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('shows the search icon when the palette is closed', () => {
|
||||
it('opens the command palette from the topbar button when the palette is closed', () => {
|
||||
commandPaletteService.isOpen.set(false);
|
||||
fixture.detectChanges();
|
||||
|
||||
const icon = fixture.nativeElement.querySelector('.mobile-topbar button:last-of-type i');
|
||||
expect(icon?.classList.contains('pi-search')).toBe(true);
|
||||
const button = fixture.nativeElement.querySelector('.mobile-topbar button:last-of-type') as HTMLButtonElement;
|
||||
button.click();
|
||||
|
||||
expect(layoutService.closeMobileSidebar).toHaveBeenCalledOnce();
|
||||
expect(commandPaletteService.open).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('swaps to a close button that hides the palette when it is open', () => {
|
||||
it('hides the command palette from the topbar button when the palette is open', () => {
|
||||
commandPaletteService.isOpen.set(true);
|
||||
fixture.detectChanges();
|
||||
|
||||
const button = fixture.nativeElement.querySelector('.mobile-topbar button:last-of-type') as HTMLButtonElement;
|
||||
const icon = button.querySelector('i');
|
||||
expect(icon?.classList.contains('pi-times')).toBe(true);
|
||||
|
||||
button.click();
|
||||
|
||||
expect(commandPaletteService.hide).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { TranslocoDirective, TranslocoPipe } from '@jsverse/transloco';
|
||||
import { LucideMenu, LucideSearch, LucideX } from '@lucide/angular';
|
||||
import { CommandPaletteService } from '../../../features/command-palette/command-palette.service';
|
||||
import { LayoutService } from '../layout.service';
|
||||
|
||||
@@ -7,7 +8,7 @@ import { LayoutService } from '../layout.service';
|
||||
selector: 'app-mobile-topbar',
|
||||
templateUrl: './app.mobile-topbar.component.html',
|
||||
styleUrl: './app.mobile-topbar.component.scss',
|
||||
imports: [TranslocoDirective, TranslocoPipe],
|
||||
imports: [TranslocoDirective, TranslocoPipe, LucideMenu, LucideSearch, LucideX],
|
||||
})
|
||||
export class AppMobileTopbarComponent {
|
||||
readonly layoutService = inject(LayoutService);
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
(click)="openContextMenu($event, entitymenu)"
|
||||
>
|
||||
<span class="entity-menu-button-content">
|
||||
<i class="pi pi-ellipsis-v entity-menu-icon" aria-hidden="true"></i>
|
||||
<svg lucideEllipsisVertical class="entity-menu-icon" aria-hidden="true"></svg>
|
||||
<span class="entity-menu-count">{{ formatCount(currentItem.bookCount) }}</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -3,10 +3,11 @@ import { RouterLink } from '@angular/router';
|
||||
import { Menu } from 'primeng/menu';
|
||||
import { Tooltip } from 'primeng/tooltip';
|
||||
import { TranslocoPipe } from '@jsverse/transloco';
|
||||
import { LucideEllipsisVertical } from '@lucide/angular';
|
||||
import { IconSelection, toIconSelection } from '../../icons/icon-selection';
|
||||
|
||||
import { UserService } from '../../../features/settings/user-management/user.service';
|
||||
import { IconDisplayComponent } from '../../components/icon-display/icon-display.component';
|
||||
import { IconSelection } from '../../service/icon-picker.service';
|
||||
import { LayoutService } from '../layout.service';
|
||||
import { SidebarLeaf } from '../navigation/nav-item.model';
|
||||
|
||||
@@ -22,6 +23,7 @@ import { SidebarLeaf } from '../navigation/nav-item.model';
|
||||
IconDisplayComponent,
|
||||
Tooltip,
|
||||
TranslocoPipe,
|
||||
LucideEllipsisVertical,
|
||||
],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
@@ -70,10 +72,7 @@ export class AppSidebarItemRowComponent {
|
||||
getIconSelection(): IconSelection | null {
|
||||
const item = this.item();
|
||||
if (!item.icon) return null;
|
||||
return {
|
||||
type: item.iconType || 'PRIME_NG',
|
||||
value: item.icon,
|
||||
};
|
||||
return toIconSelection(item.icon, item.iconType);
|
||||
}
|
||||
|
||||
hasContextMenu(): boolean {
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<span>{{ currentItem.label }}</span>
|
||||
</span>
|
||||
<span class="expand-icon-button" aria-hidden="true">
|
||||
<i
|
||||
[ngClass]="{ 'pi': true, 'pi-angle-up': expanded, 'pi-angle-down': !expanded }"
|
||||
class="expand-icon"
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
@if (expanded) {
|
||||
<svg lucideChevronUp class="expand-icon" aria-hidden="true"></svg>
|
||||
} @else {
|
||||
<svg lucideChevronDown class="expand-icon" aria-hidden="true"></svg>
|
||||
}
|
||||
</span>
|
||||
</button>
|
||||
<div class="sidebar-section-divider" aria-hidden="true"></div>
|
||||
|
||||
@@ -115,7 +115,8 @@
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: var(--app-text-lg);
|
||||
width: var(--app-text-lg);
|
||||
height: var(--app-text-lg);
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component, HostBinding, computed, inject, input } from '@angular/core';
|
||||
import { NgClass } from '@angular/common';
|
||||
|
||||
import { LayoutService } from '../layout.service';
|
||||
import { AppSidebarItemRowComponent } from './app.sidebar-item-row.component';
|
||||
import { SidebarLeaf, SidebarSection } from '../navigation/nav-item.model';
|
||||
import { LucideChevronDown, LucideChevronUp } from '@lucide/angular';
|
||||
|
||||
@Component({
|
||||
// Attribute selector so the section renders into its host <li> inside a <ul>.
|
||||
@@ -11,7 +11,7 @@ import { SidebarLeaf, SidebarSection } from '../navigation/nav-item.model';
|
||||
selector: '[appSidebarSection]',
|
||||
templateUrl: './app.sidebar-section.component.html',
|
||||
styleUrls: ['./app.sidebar-section.component.scss'],
|
||||
imports: [NgClass, AppSidebarItemRowComponent],
|
||||
imports: [LucideChevronDown, LucideChevronUp, AppSidebarItemRowComponent],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AppSidebarSectionComponent {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
[attr.aria-expanded]="addMenuOpen() ? 'true' : 'false'"
|
||||
(click)="toggleAddMenu($event, addMenu)"
|
||||
>
|
||||
<i class="pi pi-plus" aria-hidden="true"></i>
|
||||
<svg lucidePlus aria-hidden="true"></svg>
|
||||
</button>
|
||||
|
||||
<p-menu
|
||||
@@ -82,7 +82,7 @@
|
||||
tooltipPosition="bottom"
|
||||
(click)="openUploadDialog()"
|
||||
>
|
||||
<i class="pi pi-upload" aria-hidden="true"></i>
|
||||
<svg lucideUpload aria-hidden="true"></svg>
|
||||
</button>
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
(click)="toggleHeaderNotificationsPopover(notificationsMobileOrigin)"
|
||||
>
|
||||
<span class="sidebar-notification-button-content">
|
||||
<i class="pi pi-bell" aria-hidden="true"></i>
|
||||
<svg lucideBell aria-hidden="true"></svg>
|
||||
@if (shouldShowNotificationBadge()) {
|
||||
<span class="sidebar-notification-badge">{{ completedTaskCount() }}</span>
|
||||
}
|
||||
@@ -117,7 +117,7 @@
|
||||
[tooltipDisabled]="!layoutService.isDesktop()"
|
||||
tooltipPosition="bottom"
|
||||
>
|
||||
<i class="pi pi-cog" aria-hidden="true"></i>
|
||||
<svg lucideSettings aria-hidden="true"></svg>
|
||||
</a>
|
||||
|
||||
@if (currentUser(); as user) {
|
||||
@@ -141,7 +141,7 @@
|
||||
[attr.aria-label]="'layout.closeNavigation' | transloco"
|
||||
(click)="closeMobileSidebar()"
|
||||
>
|
||||
<i class="pi pi-times" aria-hidden="true"></i>
|
||||
<svg lucideX aria-hidden="true"></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
tooltipPosition="right"
|
||||
(click)="openSearch()"
|
||||
>
|
||||
<i class="pi pi-search" aria-hidden="true"></i>
|
||||
<svg lucideSearch aria-hidden="true"></svg>
|
||||
<span class="sidebar-action-label">{{ t('search') }}</span>
|
||||
<kbd class="sidebar-search-shortcut" aria-hidden="true">{{ searchShortcutLabel }}</kbd>
|
||||
</button>
|
||||
@@ -181,7 +181,7 @@
|
||||
[attr.aria-expanded]="addMenuOpen() ? 'true' : 'false'"
|
||||
(click)="toggleAddMenu($event, addMenu)"
|
||||
>
|
||||
<i class="pi pi-plus" aria-hidden="true"></i>
|
||||
<svg lucidePlus aria-hidden="true"></svg>
|
||||
<span class="sidebar-footer-action-label">{{ t('add') }}</span>
|
||||
</button>
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
tooltipPosition="top"
|
||||
(click)="openUploadDialog()"
|
||||
>
|
||||
<i class="pi pi-upload" aria-hidden="true"></i>
|
||||
<svg lucideUpload aria-hidden="true"></svg>
|
||||
<span class="sidebar-footer-action-label">{{ t('uploadBook') }}</span>
|
||||
</button>
|
||||
}
|
||||
@@ -214,7 +214,7 @@
|
||||
(click)="toggleFooterNotificationsPopover(notificationsFooterOrigin)"
|
||||
>
|
||||
<span class="sidebar-notification-button-content">
|
||||
<i class="pi pi-bell" aria-hidden="true"></i>
|
||||
<svg lucideBell aria-hidden="true"></svg>
|
||||
@if (shouldShowNotificationBadge()) {
|
||||
<span class="sidebar-notification-badge">{{ completedTaskCount() }}</span>
|
||||
}
|
||||
@@ -232,7 +232,7 @@
|
||||
[tooltipDisabled]="!layoutService.isDesktop()"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<i class="pi pi-cog" aria-hidden="true"></i>
|
||||
<svg lucideSettings aria-hidden="true"></svg>
|
||||
<span class="sidebar-footer-action-label">{{ t('settings') }}</span>
|
||||
</a>
|
||||
|
||||
@@ -271,12 +271,11 @@
|
||||
tooltipPosition="right"
|
||||
(click)="layoutService.toggleSidebarCollapsed()"
|
||||
>
|
||||
<i
|
||||
class="pi"
|
||||
[class.pi-angle-double-left]="!layoutService.sidebarCollapsed()"
|
||||
[class.pi-angle-double-right]="layoutService.sidebarCollapsed()"
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
@if (layoutService.sidebarCollapsed()) {
|
||||
<svg lucidePanelLeftOpen aria-hidden="true"></svg>
|
||||
} @else {
|
||||
<svg lucidePanelLeftClose aria-hidden="true"></svg>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
@@ -291,12 +290,11 @@
|
||||
tooltipPosition="right"
|
||||
(click)="layoutService.toggleSidebarCollapsed()"
|
||||
>
|
||||
<i
|
||||
class="pi"
|
||||
[class.pi-angle-double-left]="!layoutService.sidebarCollapsed()"
|
||||
[class.pi-angle-double-right]="layoutService.sidebarCollapsed()"
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
@if (layoutService.sidebarCollapsed()) {
|
||||
<svg lucidePanelLeftOpen aria-hidden="true"></svg>
|
||||
} @else {
|
||||
<svg lucidePanelLeftClose aria-hidden="true"></svg>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
@@ -367,7 +365,7 @@
|
||||
[attr.aria-label]="t('documentation')"
|
||||
(click)="openDocumentation()"
|
||||
>
|
||||
<i class="pi pi-question-circle" aria-hidden="true"></i>
|
||||
<svg lucideCircleQuestionMark aria-hidden="true"></svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -379,7 +377,7 @@
|
||||
type="button"
|
||||
(click)="openChangelogDialog()"
|
||||
>
|
||||
<i class="pi pi-arrow-up-right" aria-hidden="true"></i>
|
||||
<svg lucideArrowUpRight aria-hidden="true"></svg>
|
||||
<span>{{ t('updateAvailable') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -389,7 +387,7 @@
|
||||
<div class="user-account-popover-body">
|
||||
@if (!user.permissions.demoUser) {
|
||||
<button type="button" class="menu-item user-account-popover-action" (click)="openAccountSettings()">
|
||||
<i class="pi pi-user-edit" aria-hidden="true"></i>
|
||||
<svg lucideUserPen aria-hidden="true"></svg>
|
||||
<span>{{ 'settingsProfile.title' | transloco }}</span>
|
||||
</button>
|
||||
}
|
||||
@@ -400,7 +398,7 @@
|
||||
class="menu-item user-account-popover-action"
|
||||
(click)="openReadingStats()"
|
||||
>
|
||||
<i class="pi pi-chart-bar" aria-hidden="true"></i>
|
||||
<svg lucideChartColumn aria-hidden="true"></svg>
|
||||
<span>{{ t('readingStats') }}</span>
|
||||
</button>
|
||||
}
|
||||
@@ -413,14 +411,15 @@
|
||||
[attr.aria-expanded]="appearanceMenuOpen()"
|
||||
(click)="toggleAppearanceMenu()"
|
||||
>
|
||||
<i class="pi pi-palette" aria-hidden="true"></i>
|
||||
<svg lucidePalette aria-hidden="true"></svg>
|
||||
<span>{{ 'layout.theme.appearance' | transloco }}</span>
|
||||
<span class="ml-auto mr-1.5 min-w-0 max-w-[4.75rem] overflow-hidden text-ellipsis whitespace-nowrap text-xs text-text-secondary">{{ selectedAppearanceLabel() }}</span>
|
||||
<i
|
||||
class="pi pi-chevron-down size-2.5 shrink-0 text-[0.6875rem] text-text-secondary! transition-transform duration-150"
|
||||
<svg
|
||||
lucideChevronDown
|
||||
class="size-2.5 shrink-0 text-text-secondary! transition-transform duration-150"
|
||||
[class.rotate-180]="appearanceMenuOpen()"
|
||||
aria-hidden="true">
|
||||
</i>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div
|
||||
@@ -436,14 +435,14 @@
|
||||
@for (option of appearanceOptions; track option.value) {
|
||||
<button
|
||||
type="button"
|
||||
class="menu-item user-account-popover-action aria-pressed:bg-active-surface aria-pressed:text-primary! aria-pressed:[&_.pi]:text-primary!"
|
||||
class="menu-item user-account-popover-action aria-pressed:bg-active-surface aria-pressed:text-primary! aria-pressed:[&_svg]:text-primary!"
|
||||
[attr.aria-pressed]="selectedAppearancePreference() === option.value"
|
||||
(click)="updateAppearancePreference(option.value)"
|
||||
>
|
||||
<i [class]="option.icon" aria-hidden="true"></i>
|
||||
<svg [lucideIcon]="option.icon" aria-hidden="true"></svg>
|
||||
<span>{{ option.labelKey | transloco }}</span>
|
||||
@if (selectedAppearancePreference() === option.value) {
|
||||
<i class="pi pi-check ml-auto text-primary!" aria-hidden="true"></i>
|
||||
<svg lucideCheck class="ml-auto text-primary!" aria-hidden="true"></svg>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
@@ -455,7 +454,7 @@
|
||||
|
||||
<footer class="user-account-popover-footer">
|
||||
<button type="button" class="menu-item user-account-popover-logout" (click)="logout()">
|
||||
<i class="pi pi-sign-out" aria-hidden="true"></i>
|
||||
<svg lucideLogOut aria-hidden="true"></svg>
|
||||
<span>{{ t('logout') }}</span>
|
||||
</button>
|
||||
</footer>
|
||||
|
||||
@@ -143,8 +143,9 @@
|
||||
outline: none;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: var(--app-text-base);
|
||||
svg {
|
||||
width: var(--app-text-base);
|
||||
height: var(--app-text-base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,10 +241,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
i {
|
||||
svg {
|
||||
width: var(--sidebar-row-icon-size);
|
||||
height: var(--sidebar-row-icon-size);
|
||||
font-size: var(--app-text-base);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -279,7 +279,7 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
i {
|
||||
svg {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
@@ -501,8 +501,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-footer-action i {
|
||||
font-size: var(--app-text-lg);
|
||||
.sidebar-footer-action svg {
|
||||
width: var(--app-text-lg);
|
||||
height: var(--app-text-lg);
|
||||
}
|
||||
|
||||
.sidebar-collapse-button {
|
||||
|
||||
@@ -7,6 +7,25 @@ import { CdkConnectedOverlay, CdkOverlayOrigin, ConnectedPosition } from '@angul
|
||||
import { BookDialogHelperService } from '../../../features/book/components/book-browser/book-dialog-helper.service';
|
||||
import { UnifiedNotificationBoxComponent } from '../../components/unified-notification-popover/unified-notification-popover-component';
|
||||
import { AppButtonDirective } from '../../components/button/app-button.directive';
|
||||
import {
|
||||
LucideArrowUpRight,
|
||||
LucideBell,
|
||||
LucideChartColumn,
|
||||
LucideCheck,
|
||||
LucideChevronDown,
|
||||
LucideCircleQuestionMark,
|
||||
LucideDynamicIcon,
|
||||
LucideLogOut,
|
||||
LucidePalette,
|
||||
LucidePanelLeftClose,
|
||||
LucidePanelLeftOpen,
|
||||
LucidePlus,
|
||||
LucideSearch,
|
||||
LucideSettings,
|
||||
LucideUpload,
|
||||
LucideUserPen,
|
||||
LucideX,
|
||||
} from '@lucide/angular';
|
||||
import { LibraryService } from '../../../features/book/service/library.service';
|
||||
import { LibraryHealthService } from '../../../features/book/service/library-health.service';
|
||||
import { ShelfService } from '../../../features/book/service/shelf.service';
|
||||
@@ -109,6 +128,23 @@ function isNewerVersion(latest: string | undefined, current: string | undefined)
|
||||
imports: [
|
||||
AppSidebarSectionComponent,
|
||||
AppButtonDirective,
|
||||
LucideArrowUpRight,
|
||||
LucideBell,
|
||||
LucideChartColumn,
|
||||
LucideCheck,
|
||||
LucideChevronDown,
|
||||
LucideCircleQuestionMark,
|
||||
LucideDynamicIcon,
|
||||
LucideLogOut,
|
||||
LucidePalette,
|
||||
LucidePanelLeftClose,
|
||||
LucidePanelLeftOpen,
|
||||
LucidePlus,
|
||||
LucideSearch,
|
||||
LucideSettings,
|
||||
LucideUpload,
|
||||
LucideUserPen,
|
||||
LucideX,
|
||||
Menu,
|
||||
UnifiedNotificationBoxComponent,
|
||||
RouterLink,
|
||||
@@ -333,11 +369,18 @@ export class AppSidebarComponent {
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary: PrimeNG p-menu cannot render non-Prime icons here.
|
||||
private static readonly ADD_MENU_ICONS: Record<string, string> = {
|
||||
createLibrary: 'pi pi-folder',
|
||||
createShelf: 'pi pi-bookmark',
|
||||
createMagicShelf: 'pi pi-sparkles',
|
||||
};
|
||||
|
||||
private toMenuItems(items: readonly (NavItem | null | undefined)[]): MenuItem[] {
|
||||
return items.flatMap((item): MenuItem[] =>
|
||||
item ? [{
|
||||
label: item.label,
|
||||
icon: item.icon ? `pi ${item.icon}` : undefined,
|
||||
icon: AppSidebarComponent.ADD_MENU_ICONS[item.id],
|
||||
routerLink: item.routerLink,
|
||||
command: item.action,
|
||||
}] : []
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('buildLibrarySection', () => {
|
||||
});
|
||||
|
||||
it('renders each library with route, count, health, and icon metadata', () => {
|
||||
const libs = [library({ id: 5, name: 'Fiction', icon: 'pi-book', iconType: 'PRIME_NG' })];
|
||||
const libs = [library({ id: 5, name: 'Fiction', icon: 'book', iconType: 'LUCIDE' })];
|
||||
const counts = new Map([[5, 42]]);
|
||||
|
||||
const [section] = buildLibrarySection(libs, counts, { field: 'name', order: 'asc' }, translate, libraryDeps);
|
||||
@@ -139,8 +139,8 @@ describe('buildLibrarySection', () => {
|
||||
id: 'library:5',
|
||||
label: 'Fiction',
|
||||
type: 'library',
|
||||
icon: 'pi-book',
|
||||
iconType: 'PRIME_NG',
|
||||
icon: 'book',
|
||||
iconType: 'LUCIDE',
|
||||
routerLink: ['/library/5/books'],
|
||||
bookCount: 42,
|
||||
unhealthy: false,
|
||||
@@ -216,7 +216,7 @@ describe('buildMagicShelfSection', () => {
|
||||
|
||||
it('renders sorted magic shelves with route, icon, and count', () => {
|
||||
const shelves = [
|
||||
magicShelf({ id: 2, name: 'Beta', icon: 'pi-sparkles', iconType: 'PRIME_NG' }),
|
||||
magicShelf({ id: 2, name: 'Beta', icon: 'sparkles', iconType: 'LUCIDE' }),
|
||||
magicShelf({ id: 1, name: 'Alpha' }),
|
||||
];
|
||||
const counts = new Map([[1, 4], [2, 7]]);
|
||||
@@ -227,7 +227,7 @@ describe('buildMagicShelfSection', () => {
|
||||
id: 'magicShelf:1', label: 'Alpha', routerLink: ['/magic-shelf/1/books'], bookCount: 4,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: 'magicShelf:2', label: 'Beta', icon: 'pi-sparkles', iconType: 'PRIME_NG',
|
||||
id: 'magicShelf:2', label: 'Beta', icon: 'sparkles', iconType: 'LUCIDE',
|
||||
routerLink: ['/magic-shelf/2/books'], bookCount: 7,
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -136,8 +136,7 @@ export function buildShelfSection(
|
||||
id: 'shelfUnshelved',
|
||||
label: translate('layout.menu.unshelved'),
|
||||
type: 'shelf',
|
||||
icon: 'pi pi-inbox',
|
||||
iconType: 'PRIME_NG',
|
||||
icon: 'inbox',
|
||||
routerLink: ['/unshelved-books'],
|
||||
bookCount: unshelvedCount,
|
||||
}];
|
||||
|
||||
@@ -64,34 +64,34 @@ const HOME_PAGE_DEFINITIONS: readonly PageDefinition[] = [
|
||||
{
|
||||
id: 'dashboard',
|
||||
labelKey: 'layout.menu.dashboard',
|
||||
icon: 'pi-home',
|
||||
icon: 'house',
|
||||
routerLink: ['/dashboard'],
|
||||
},
|
||||
{
|
||||
id: 'allBooks',
|
||||
labelKey: 'layout.menu.allBooks',
|
||||
icon: 'pi-book',
|
||||
icon: 'library-big',
|
||||
routerLink: ['/all-books'],
|
||||
type: 'allBooks',
|
||||
},
|
||||
{
|
||||
id: 'series',
|
||||
labelKey: 'layout.menu.series',
|
||||
icon: 'pi-objects-column',
|
||||
icon: 'book-copy',
|
||||
routerLink: ['/series'],
|
||||
type: 'series',
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
labelKey: 'layout.menu.authors',
|
||||
icon: 'pi-users',
|
||||
icon: 'users',
|
||||
routerLink: ['/authors'],
|
||||
type: 'authors',
|
||||
},
|
||||
{
|
||||
id: 'notebook',
|
||||
labelKey: 'layout.menu.notebook',
|
||||
icon: 'pi-pencil',
|
||||
icon: 'notebook-pen',
|
||||
routerLink: ['/notebook'],
|
||||
},
|
||||
] as const;
|
||||
@@ -100,34 +100,34 @@ const SECONDARY_PAGE_DEFINITIONS: readonly PageDefinition[] = [
|
||||
{
|
||||
id: 'settings',
|
||||
labelKey: 'layout.menu.settings',
|
||||
icon: 'pi-cog',
|
||||
icon: 'settings',
|
||||
routerLink: ['/settings'],
|
||||
},
|
||||
{
|
||||
id: 'libraryStats',
|
||||
labelKey: 'layout.menu.libraryStats',
|
||||
icon: 'pi-chart-line',
|
||||
icon: 'chart-line',
|
||||
routerLink: ['/library-stats'],
|
||||
isVisible: canAccessLibraryStats,
|
||||
},
|
||||
{
|
||||
id: 'readingStats',
|
||||
labelKey: 'layout.menu.readingStats',
|
||||
icon: 'pi-chart-bar',
|
||||
icon: 'chart-column',
|
||||
routerLink: ['/reading-stats'],
|
||||
isVisible: canAccessUserStats,
|
||||
},
|
||||
{
|
||||
id: 'metadataManager',
|
||||
labelKey: 'layout.menu.metadataManager',
|
||||
icon: 'pi-sparkles',
|
||||
icon: 'tags',
|
||||
routerLink: ['/metadata-manager'],
|
||||
isVisible: canEditMetadata,
|
||||
},
|
||||
{
|
||||
id: 'bookdrop',
|
||||
labelKey: 'layout.menu.bookdrop',
|
||||
icon: 'pi-inbox',
|
||||
icon: 'inbox',
|
||||
routerLink: ['/bookdrop'],
|
||||
isVisible: canAccessBookdrop,
|
||||
},
|
||||
@@ -137,20 +137,20 @@ const CREATE_ACTION_DEFINITIONS: readonly ActionDefinition[] = [
|
||||
{
|
||||
id: 'createLibrary',
|
||||
labelKey: 'layout.menu.createLibrary',
|
||||
icon: 'pi-folder',
|
||||
icon: 'folder',
|
||||
run: (handlers) => handlers.createLibrary,
|
||||
isVisible: canManageLibraries,
|
||||
},
|
||||
{
|
||||
id: 'createShelf',
|
||||
labelKey: 'book.shelfCreator.title',
|
||||
icon: 'pi-bookmark',
|
||||
icon: 'bookmark',
|
||||
run: (handlers) => handlers.createShelf,
|
||||
},
|
||||
{
|
||||
id: 'createMagicShelf',
|
||||
labelKey: 'layout.menu.createMagicShelf',
|
||||
icon: 'pi-sparkles',
|
||||
icon: 'sparkles',
|
||||
run: (handlers) => handlers.createMagicShelf,
|
||||
},
|
||||
] as const;
|
||||
@@ -160,7 +160,7 @@ const ACTION_DEFINITIONS: readonly ActionDefinition[] = [
|
||||
{
|
||||
id: 'uploadBook',
|
||||
labelKey: 'layout.menu.uploadBook',
|
||||
icon: 'pi-upload',
|
||||
icon: 'upload',
|
||||
run: (handlers) => handlers.uploadBook,
|
||||
isVisible: canUploadBooks,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { MenuItem } from 'primeng/api';
|
||||
|
||||
export type NavIconType = 'PRIME_NG' | 'CUSTOM_SVG';
|
||||
import { IconType } from '../../icons/icon-selection';
|
||||
|
||||
export type NavItemType =
|
||||
| 'library' | 'shelf' | 'magicShelf'
|
||||
@@ -10,7 +9,7 @@ export interface NavItem {
|
||||
id: string;
|
||||
label: string;
|
||||
icon?: string;
|
||||
iconType?: NavIconType;
|
||||
iconType?: IconType;
|
||||
routerLink?: string[];
|
||||
type?: NavItemType;
|
||||
action?: () => void;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { LucideMonitor, LucideMoon, LucideSun, type LucideIconData } from '@lucide/angular';
|
||||
import type {AppearancePreference} from '../../model/app-state.model';
|
||||
|
||||
export interface AppearanceOption {
|
||||
value: AppearancePreference;
|
||||
labelKey: string;
|
||||
icon: string;
|
||||
icon: LucideIconData;
|
||||
}
|
||||
|
||||
export const APPEARANCE_OPTIONS: readonly AppearanceOption[] = [
|
||||
{value: 'light', labelKey: 'layout.theme.light', icon: 'pi pi-sun'},
|
||||
{value: 'dark', labelKey: 'layout.theme.dark', icon: 'pi pi-moon'},
|
||||
{value: 'system', labelKey: 'layout.theme.system', icon: 'pi pi-desktop'},
|
||||
{value: 'light', labelKey: 'layout.theme.light', icon: LucideSun.icon},
|
||||
{value: 'dark', labelKey: 'layout.theme.dark', icon: LucideMoon.icon},
|
||||
{value: 'system', labelKey: 'layout.theme.system', icon: LucideMonitor.icon},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user