Migrate existing control flow directives to use new control-flow schematic
This commit is contained in:
committed by
Aditya Chandel
parent
246efdaa34
commit
0f852ef068
@@ -1,34 +1,46 @@
|
||||
<div class="flex flex-col h-full">
|
||||
<div>
|
||||
<ul class="layout-menu">
|
||||
<ng-container *ngIf="homeMenu$ | async as homeMenu">
|
||||
<ng-container *ngFor="let item of homeMenu; let i = index;">
|
||||
<li app-menuitem *ngIf="!item.separator" [item]="item" [index]="i" [root]="true"></li>
|
||||
<li *ngIf="item.separator" class="menu-separator"></li>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@if (homeMenu$ | async; as homeMenu) {
|
||||
@for (item of homeMenu; track item; let i = $index) {
|
||||
@if (!item.separator) {
|
||||
<li app-menuitem [item]="item" [index]="i" [root]="true"></li>
|
||||
}
|
||||
@if (item.separator) {
|
||||
<li class="menu-separator"></li>
|
||||
}
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
|
||||
<ul class="layout-menu">
|
||||
<ng-container *ngIf="libraryMenu$ | async as libraryMenu">
|
||||
<ng-container *ngFor="let item of libraryMenu; let i = index;">
|
||||
<li app-menuitem *ngIf="!item.separator" [item]="item" [index]="i" [root]="true"></li>
|
||||
<li *ngIf="item.separator" class="menu-separator"></li>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@if (libraryMenu$ | async; as libraryMenu) {
|
||||
@for (item of libraryMenu; track item; let i = $index) {
|
||||
@if (!item.separator) {
|
||||
<li app-menuitem [item]="item" [index]="i" [root]="true"></li>
|
||||
}
|
||||
@if (item.separator) {
|
||||
<li class="menu-separator"></li>
|
||||
}
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
|
||||
<ul class="layout-menu">
|
||||
<ng-container *ngIf="shelfMenu$ | async as shelfMenu">
|
||||
<ng-container *ngFor="let item of shelfMenu; let i = index;">
|
||||
<li app-menuitem *ngIf="!item.separator" [item]="item" [index]="i" [root]="true"></li>
|
||||
<li *ngIf="item.separator" class="menu-separator"></li>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@if (shelfMenu$ | async; as shelfMenu) {
|
||||
@for (item of shelfMenu; track item; let i = $index) {
|
||||
@if (!item.separator) {
|
||||
<li app-menuitem [item]="item" [index]="i" [root]="true"></li>
|
||||
}
|
||||
@if (item.separator) {
|
||||
<li class="menu-separator"></li>
|
||||
}
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="versionInfo">
|
||||
@if (versionInfo) {
|
||||
<div style="margin-top: auto;" class="p-4 text-center w-full text-sm">
|
||||
<div class="text-gray-200">
|
||||
<a
|
||||
@@ -36,18 +48,20 @@
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="hover:underline hover:text-gray-100 text-sm"
|
||||
>
|
||||
>
|
||||
{{ versionInfo.current }}
|
||||
</a>
|
||||
</div>
|
||||
<div *ngIf="versionInfo.latest && versionInfo.latest !== versionInfo.current">
|
||||
<a
|
||||
(click)="openChangelogDialog()"
|
||||
class="cursor-pointer text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
>
|
||||
(Update)
|
||||
</a>
|
||||
</div>
|
||||
@if (versionInfo.latest && versionInfo.latest !== versionInfo.current) {
|
||||
<div>
|
||||
<a
|
||||
(click)="openChangelogDialog()"
|
||||
class="cursor-pointer text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
>
|
||||
(Update)
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {AppMenuitemComponent} from './app.menuitem.component';
|
||||
import {AsyncPipe, NgForOf, NgIf} from '@angular/common';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import {MenuModule} from 'primeng/menu';
|
||||
import {LibraryService} from '../../../book/service/library.service';
|
||||
import {Observable, of} from 'rxjs';
|
||||
@@ -17,7 +17,7 @@ import {UserService} from '../../../settings/user-management/user.service';
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
standalone: true,
|
||||
imports: [AppMenuitemComponent, NgIf, NgForOf, MenuModule, AsyncPipe],
|
||||
imports: [AppMenuitemComponent, MenuModule, AsyncPipe],
|
||||
templateUrl: './app.menu.component.html',
|
||||
})
|
||||
export class AppMenuComponent implements OnInit {
|
||||
|
||||
@@ -1,62 +1,76 @@
|
||||
<ng-container>
|
||||
<div *ngIf="root && item.visible !== false" class="layout-menuitem-root-text">{{ item.label }}</div>
|
||||
@if (root && item.visible !== false) {
|
||||
<div class="layout-menuitem-root-text">{{ item.label }}</div>
|
||||
}
|
||||
|
||||
<a *ngIf="(!item.routerLink || item.items) && item.visible !== false" [attr.href]="item.url"
|
||||
(click)="itemClick($event)"
|
||||
[ngClass]="item.class" [attr.target]="item.target" tabindex="0" pRipple>
|
||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||
<span class="layout-menuitem-text">
|
||||
{{ item.label }}
|
||||
</span>
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" *ngIf="item.items"></i>
|
||||
</a>
|
||||
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<a *ngIf="(item.routerLink && !item.items) && item.visible !== false" (click)="itemClick($event)"
|
||||
[ngClass]="item.class"
|
||||
[routerLink]="item.routerLink" routerLinkActive="active-route"
|
||||
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
|
||||
[fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling"
|
||||
[preserveFragment]="item.preserveFragment"
|
||||
[skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state"
|
||||
[queryParams]="item.queryParams"
|
||||
[attr.target]="item.target" tabindex="0" pRipple>
|
||||
@if ((!item.routerLink || item.items) && item.visible !== false) {
|
||||
<a [attr.href]="item.url"
|
||||
(click)="itemClick($event)"
|
||||
[ngClass]="item.class" [attr.target]="item.target" tabindex="0" pRipple>
|
||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||
<span class="layout-menuitem-text w-full">
|
||||
<span class="layout-menuitem-text">
|
||||
{{ item.label }}
|
||||
</span>
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" *ngIf="item.items"></i>
|
||||
@if (item.items) {
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler"></i>
|
||||
}
|
||||
</a>
|
||||
<span *ngIf="(item.routerLink && !item.items) && item.visible !== false">
|
||||
<ng-container *ngIf="item.type === 'Library' || item.type === 'Shelf'">
|
||||
<p-button
|
||||
*ngIf="(item.type !== 'Library' || (admin || canManipulateLibrary)) && item.label !== 'Unshelved'"
|
||||
(click)="entitymenu.toggle($event)"
|
||||
(mouseover)="hovered = true"
|
||||
(mouseleave)="hovered = false"
|
||||
[text]="true"
|
||||
[outlined]="false"
|
||||
[rounded]="true"
|
||||
[label]="hovered ? '' : (item.bookCount$ | async)?.toString() || ''"
|
||||
[icon]="hovered ? 'pi pi-ellipsis-v' : ''"
|
||||
[style.width]="'30px'"
|
||||
[style.height]="'30px'"
|
||||
[style.display]="'flex'">
|
||||
</p-button>
|
||||
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
|
||||
</ng-container>
|
||||
}
|
||||
|
||||
<ng-container *ngIf="item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.label === 'Unshelved'">
|
||||
<p class="text-[var(--primary-color)] pr-1">
|
||||
{{ (item.bookCount$ | async)?.toString() || '0' }}
|
||||
</p>
|
||||
</ng-container>
|
||||
</span>
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
@if ((item.routerLink && !item.items) && item.visible !== false) {
|
||||
<a (click)="itemClick($event)"
|
||||
[ngClass]="item.class"
|
||||
[routerLink]="item.routerLink" routerLinkActive="active-route"
|
||||
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
|
||||
[fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling"
|
||||
[preserveFragment]="item.preserveFragment"
|
||||
[skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state"
|
||||
[queryParams]="item.queryParams"
|
||||
[attr.target]="item.target" tabindex="0" pRipple>
|
||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||
<span class="layout-menuitem-text w-full">
|
||||
{{ item.label }}
|
||||
</span>
|
||||
@if (item.items) {
|
||||
<i class="pi pi-fw pi-angle-down layout-submenu-toggler"></i>
|
||||
}
|
||||
</a>
|
||||
}
|
||||
@if ((item.routerLink && !item.items) && item.visible !== false) {
|
||||
<span>
|
||||
@if (item.type === 'Library' || item.type === 'Shelf') {
|
||||
@if ((item.type !== 'Library' || (admin || canManipulateLibrary)) && item.label !== 'Unshelved') {
|
||||
<p-button
|
||||
(click)="entitymenu.toggle($event)"
|
||||
(mouseover)="hovered = true"
|
||||
(mouseleave)="hovered = false"
|
||||
[text]="true"
|
||||
[outlined]="false"
|
||||
[rounded]="true"
|
||||
[label]="hovered ? '' : (item.bookCount$ | async)?.toString() || ''"
|
||||
[icon]="hovered ? 'pi pi-ellipsis-v' : ''"
|
||||
[style.width]="'30px'"
|
||||
[style.height]="'30px'"
|
||||
[style.display]="'flex'">
|
||||
</p-button>
|
||||
}
|
||||
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
@if (item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.label === 'Unshelved') {
|
||||
<p class="text-[var(--primary-color)] pr-1">
|
||||
{{ (item.bookCount$ | async)?.toString() || '0' }}
|
||||
</p>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<ul *ngIf="item.items && item.visible !== false" [@children]="submenuAnimation">
|
||||
<ng-template ngFor let-child let-i="index" [ngForOf]="item.items">
|
||||
<li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child.badgeClass"></li>
|
||||
</ng-template>
|
||||
</ul>
|
||||
@if (item.items && item.visible !== false) {
|
||||
<ul [@children]="submenuAnimation">
|
||||
@for (child of item.items; track child; let i = $index) {
|
||||
<li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child.badgeClass"></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</ng-container>
|
||||
|
||||
@@ -4,7 +4,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {filter} from 'rxjs/operators';
|
||||
import {MenuService} from './service/app.menu.service';
|
||||
import {AsyncPipe, NgClass, NgForOf, NgIf} from '@angular/common';
|
||||
import { AsyncPipe, NgClass } from '@angular/common';
|
||||
import {Ripple} from 'primeng/ripple';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Menu} from 'primeng/menu';
|
||||
@@ -19,13 +19,11 @@ import {UserService} from '../../../settings/user-management/user.service';
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
NgClass,
|
||||
NgForOf,
|
||||
Ripple,
|
||||
NgIf,
|
||||
AsyncPipe,
|
||||
Button,
|
||||
Menu
|
||||
],
|
||||
],
|
||||
animations: [
|
||||
trigger('children', [
|
||||
state('collapsed', style({
|
||||
|
||||
+25
-17
@@ -1,18 +1,26 @@
|
||||
<div *ngIf="loading" class="p-4 text-center text-gray-400">
|
||||
Loading changelog...
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length === 0" class="p-4 text-center text-gray-400">
|
||||
No updates available.
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length > 0" class="space-y-6 p-4 max-h-[70vh] overflow-auto">
|
||||
<div *ngFor="let release of changelog" class="border-b pb-4">
|
||||
<p class="font-bold text-2xl pb-2">
|
||||
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
|
||||
{{ release.name }}
|
||||
</a>
|
||||
</p>
|
||||
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
|
||||
@if (loading) {
|
||||
<div class="p-4 text-center text-gray-400">
|
||||
Loading changelog...
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading && changelog.length === 0) {
|
||||
<div class="p-4 text-center text-gray-400">
|
||||
No updates available.
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading && changelog.length > 0) {
|
||||
<div class="space-y-6 p-4 max-h-[70vh] overflow-auto">
|
||||
@for (release of changelog; track release) {
|
||||
<div class="border-b pb-4">
|
||||
<p class="font-bold text-2xl pb-2">
|
||||
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
|
||||
{{ release.name }}
|
||||
</a>
|
||||
</p>
|
||||
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { ReleaseNote, VersionService } from '../../../../core/service/version.service';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import showdown from 'showdown';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version-changelog-dialog',
|
||||
standalone: true,
|
||||
imports: [NgIf, NgForOf],
|
||||
imports: [],
|
||||
templateUrl: './version-changelog-dialog.component.html',
|
||||
styleUrl: './version-changelog-dialog.component.scss'
|
||||
})
|
||||
|
||||
@@ -14,29 +14,37 @@
|
||||
[outlined]="true"
|
||||
(click)="toggleMenu()"
|
||||
[ngClass]="{ 'rotate-right': !isMenuVisible, 'rotate-left': isMenuVisible }"
|
||||
>
|
||||
>
|
||||
</p-button>
|
||||
|
||||
<div class="topbar-right-items">
|
||||
<app-book-searcher></app-book-searcher>
|
||||
<ul class="topbar-items pl-6">
|
||||
<div class="flex gap-6">
|
||||
<li *ngIf="userService.userState$ | async as userData">
|
||||
<a class="topbar-item" *ngIf="userData.permissions.canManipulateLibrary || userData.permissions.admin">
|
||||
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
|
||||
pTooltip="Create New Library" tooltipPosition="top"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li *ngIf="userService.userState$ | async as userData">
|
||||
<a class="topbar-item" *ngIf="userData.permissions.canManipulateLibrary || userData.permissions.admin">
|
||||
<i class="pi pi-upload text-surface-700 dark:text-surface-100" (click)="openFileUploadDialog()"
|
||||
pTooltip="Upload Book" tooltipPosition="top"></i>
|
||||
</a>
|
||||
</li>
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<li>
|
||||
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
|
||||
<a class="topbar-item">
|
||||
<i class="pi pi-plus-circle text-surface-700 dark:text-surface-100" (click)="openLibraryCreatorDialog()"
|
||||
pTooltip="Create New Library" tooltipPosition="top"></i>
|
||||
</a>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<li>
|
||||
@if (userData.permissions.canManipulateLibrary || userData.permissions.admin) {
|
||||
<a class="topbar-item">
|
||||
<i class="pi pi-upload text-surface-700 dark:text-surface-100" (click)="openFileUploadDialog()"
|
||||
pTooltip="Upload Book" tooltipPosition="top"></i>
|
||||
</a>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
<li>
|
||||
<a class="topbar-item">
|
||||
<i class="pi pi-cog text-surface-700 dark:text-surface-100" (click)="navigateToSettings()"
|
||||
pTooltip="Settings" tooltipPosition="top"></i>
|
||||
pTooltip="Settings" tooltipPosition="top"></i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
@@ -44,15 +52,17 @@
|
||||
<p-divider layout="vertical"/>
|
||||
<li class="relative" (mouseenter)="onHover(true)" (mouseleave)="onHover(false)">
|
||||
<button type="button" class="topbar-item"
|
||||
enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden"
|
||||
leaveActiveClass="animate-fadeout"
|
||||
leaveToClass="hidden"
|
||||
pStyleClass="@next"
|
||||
[hideOnOutsideClick]="true">
|
||||
enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden"
|
||||
leaveActiveClass="animate-fadeout"
|
||||
leaveToClass="hidden"
|
||||
pStyleClass="@next"
|
||||
[hideOnOutsideClick]="true">
|
||||
<i class="pi pi-wave-pulse" style="font-size: 1.5rem" [class.pulsating]="eventHighlight" [class.highlight]="eventHighlight"></i>
|
||||
</button>
|
||||
<app-live-notification-box class="config-panel notification-box" *ngIf="isHovered"></app-live-notification-box>
|
||||
@if (isHovered) {
|
||||
<app-live-notification-box class="config-panel notification-box"></app-live-notification-box>
|
||||
}
|
||||
</li>
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
@@ -68,12 +78,12 @@
|
||||
</li>
|
||||
<li class="relative">
|
||||
<button type="button"
|
||||
class="topbar-item config-item"
|
||||
enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden"
|
||||
leaveActiveClass="animate-fadeout"
|
||||
leaveToClass="hidden"
|
||||
pStyleClass="@next" [hideOnOutsideClick]="true">
|
||||
class="topbar-item config-item"
|
||||
enterActiveClass="animate-scalein"
|
||||
enterFromClass="hidden"
|
||||
leaveActiveClass="animate-fadeout"
|
||||
leaveToClass="hidden"
|
||||
pStyleClass="@next" [hideOnOutsideClick]="true">
|
||||
<i class="pi pi-palette"></i>
|
||||
</button>
|
||||
<app-theme-configurator></app-theme-configurator>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {TooltipModule} from 'primeng/tooltip';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {InputTextModule} from 'primeng/inputtext';
|
||||
import {BookSearcherComponent} from '../../../book/components/book-searcher/book-searcher.component';
|
||||
import {AsyncPipe, NgClass, NgIf} from '@angular/common';
|
||||
import { AsyncPipe, NgClass } from '@angular/common';
|
||||
import {EventService} from '../../../shared/websocket/event.service';
|
||||
import {Button} from 'primeng/button';
|
||||
import {StyleClass} from 'primeng/styleclass';
|
||||
@@ -37,9 +37,8 @@ import {GithubSupportDialog} from '../../../github-support-dialog/github-support
|
||||
NgClass,
|
||||
Divider,
|
||||
LiveNotificationBoxComponent,
|
||||
NgIf,
|
||||
AsyncPipe
|
||||
],
|
||||
],
|
||||
})
|
||||
export class AppTopBarComponent implements OnDestroy {
|
||||
items!: MenuItem[];
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import {CommonModule, isPlatformBrowser} from '@angular/common';
|
||||
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
||||
import {Component, computed, inject, OnInit, PLATFORM_ID} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {$t, updatePreset, updateSurfacePalette} from '@primeng/themes';
|
||||
|
||||
Reference in New Issue
Block a user