Checkpoint
This commit is contained in:
Generated
+7
@@ -23,6 +23,7 @@
|
|||||||
"ng-lazyload-image": "^9.1.3",
|
"ng-lazyload-image": "^9.1.3",
|
||||||
"ngx-extended-pdf-viewer": "^22.0.0",
|
"ngx-extended-pdf-viewer": "^22.0.0",
|
||||||
"ngx-infinite-scroll": "^19.0.0",
|
"ngx-infinite-scroll": "^19.0.0",
|
||||||
|
"primeflex": "^3.3.1",
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
"primeng": "19.0.2",
|
"primeng": "19.0.2",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
@@ -11862,6 +11863,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/primeflex": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/primeflex/-/primeflex-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-zaOq3YvcOYytbAmKv3zYc+0VNS9Wg5d37dfxZnveKBFPr7vEIwfV5ydrpiouTft8MVW6qNjfkaQphHSnvgQbpQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/primeicons": {
|
"node_modules/primeicons": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz",
|
||||||
|
|||||||
@@ -19,13 +19,14 @@
|
|||||||
"@angular/platform-browser-dynamic": "^19.0.0",
|
"@angular/platform-browser-dynamic": "^19.0.0",
|
||||||
"@angular/router": "^19.0.0",
|
"@angular/router": "^19.0.0",
|
||||||
"@iharbeck/ngx-virtual-scroller": "^19.0.1",
|
"@iharbeck/ngx-virtual-scroller": "^19.0.1",
|
||||||
|
"@primeng/themes": "19.0.2",
|
||||||
"@stomp/rx-stomp": "^2.0.0",
|
"@stomp/rx-stomp": "^2.0.0",
|
||||||
"@stomp/stompjs": "^7.0.0",
|
"@stomp/stompjs": "^7.0.0",
|
||||||
"ng-lazyload-image": "^9.1.3",
|
"ng-lazyload-image": "^9.1.3",
|
||||||
"ngx-extended-pdf-viewer": "^22.0.0",
|
"ngx-extended-pdf-viewer": "^22.0.0",
|
||||||
"ngx-infinite-scroll": "^19.0.0",
|
"ngx-infinite-scroll": "^19.0.0",
|
||||||
|
"primeflex": "^3.3.1",
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
"@primeng/themes": "19.0.2",
|
|
||||||
"primeng": "19.0.2",
|
"primeng": "19.0.2",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="book-card-container" *ngIf="(bookState$ | async)?.books as books">
|
<div class="book-card-container" *ngIf="(bookState$ | async)?.books as books">
|
||||||
<virtual-scroller *ngIf="books.length > 0" class="virtual-scroller" #scroll [items]="books">
|
<virtual-scroller *ngIf="books.length > 0" class="virtual-scroller" #scroll [items]="books">
|
||||||
<div class="grid" #container>
|
<div class="grid grid-cols-12 gap-4" #container>
|
||||||
<div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems">
|
<div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems">
|
||||||
<app-book-card
|
<app-book-card
|
||||||
[book]="book"
|
[book]="book"
|
||||||
|
|||||||
@@ -64,7 +64,6 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
||||||
gap: 1.3rem;
|
gap: 1.3rem;
|
||||||
padding: 1rem;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import {Ripple} from 'primeng/ripple';
|
|||||||
[queryParams]="item.queryParams"
|
[queryParams]="item.queryParams"
|
||||||
[attr.target]="item.target" tabindex="0" pRipple>
|
[attr.target]="item.target" tabindex="0" pRipple>
|
||||||
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
|
||||||
<span class="layout-menuitem-text flex justify-content-between w-full">
|
<span class="layout-menuitem-text w-full">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
<span *ngIf="item.bookCount$ | async as bookCount">
|
<span *ngIf="item.bookCount$ | async as bookCount">
|
||||||
{{ bookCount }}
|
{{ bookCount }}
|
||||||
|
|||||||
@@ -1,42 +1,47 @@
|
|||||||
<div class="layout-topbar">
|
<div class="layout-topbar">
|
||||||
|
|
||||||
<a class="layout-topbar-logo" routerLink="">
|
<a class="layout-topbar-logo" routerLink="">
|
||||||
<img src="assets/layout/images/{{layoutService.config().colorScheme === 'light' ? 'logo-dark' : 'logo-white'}}.svg" alt="logo">
|
<img src="assets/layout/images/{{layoutService.config().colorScheme === 'light' ? 'logo-dark' : 'logo-white'}}.svg"
|
||||||
|
alt="logo">
|
||||||
<span>BookLore</span>
|
<span>BookLore</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<button #menubutton class="p-link layout-menu-button layout-topbar-button" (click)="layoutService.onMenuToggle()">
|
<p-button #menubutton icon="pi pi-arrow-left" [rounded]="true" [outlined]="true" (click)="layoutService.onMenuToggle()"></p-button>
|
||||||
<i class="pi pi-bars"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div>
|
<div class="xxx">
|
||||||
<app-search></app-search>
|
<app-search></app-search>
|
||||||
</div>
|
<ul class="topbar-items">
|
||||||
|
<li>
|
||||||
<button #topbarmenubutton class="p-link layout-topbar-menu-button layout-topbar-button" (click)="layoutService.showProfileSidebar()">
|
<i class="topbar-item pi pi-wave-pulse p-link layout-topbar-menu-button layout-topbar-button"
|
||||||
<i class="pi pi-ellipsis-v"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div #topbarmenu class="layout-topbar-menu">
|
|
||||||
<button class="p-link layout-topbar-button"
|
|
||||||
(click)="toggleEventDisplay()"
|
(click)="toggleEventDisplay()"
|
||||||
(mouseenter)="onMouseEnter()"
|
(mouseenter)="onMouseEnter()"
|
||||||
(mouseleave)="onMouseLeave()"
|
(mouseleave)="onMouseLeave()"
|
||||||
[class.pulsating]="eventHighlight"
|
[class.pulsating]="eventHighlight"
|
||||||
[class.highlight]="eventHighlight">
|
[class.highlight]="eventHighlight"></i>
|
||||||
<i class="pi pi-wave-pulse"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div *ngIf="showEvents" class="live-event-container" (mouseleave)="onMouseLeave()">
|
<div *ngIf="showEvents" class="live-event-container" (mouseleave)="onMouseLeave()">
|
||||||
<p *ngIf="latestEvent.timestamp">{{ latestEvent.timestamp }}</p>
|
<p *ngIf="latestEvent.timestamp">{{ latestEvent.timestamp }}</p>
|
||||||
<p>{{ latestEvent.message }}</p>
|
<p>{{ latestEvent.message }}</p>
|
||||||
</div>
|
</div>
|
||||||
<button class="p-link layout-menu-button layout-topbar-button" (click)="openLibraryCreatorDialog()" pTooltip="Create New Library" tooltipPosition="top">
|
</li>
|
||||||
<i class="pi pi-plus-circle"></i>
|
<li>
|
||||||
|
<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>
|
||||||
|
<li>
|
||||||
|
<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 class="relative">
|
||||||
|
<button type="button" 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>
|
</button>
|
||||||
<p-button [rounded]="true" [outlined]="true" severity="help" (click)="openFileUploadDialog()">
|
|
||||||
<i class="pi pi-upload"></i>
|
|
||||||
</p-button>
|
|
||||||
<p-button [rounded]="true" [outlined]="true" severity="help"> </p-button>
|
|
||||||
<app-configurator></app-configurator>
|
<app-configurator></app-configurator>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,3 +37,4 @@
|
|||||||
.pulsating {
|
.pulsating {
|
||||||
animation: pulsate 1.5s infinite ease-in-out;
|
animation: pulsate 1.5s infinite ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ import {FormsModule} from '@angular/forms';
|
|||||||
import {InputTextModule} from 'primeng/inputtext';
|
import {InputTextModule} from 'primeng/inputtext';
|
||||||
import {SearchComponent} from '../search/search.component';
|
import {SearchComponent} from '../search/search.component';
|
||||||
import {FileUploadComponent} from '../file-upload/file-upload.component';
|
import {FileUploadComponent} from '../file-upload/file-upload.component';
|
||||||
import {NgClass, NgIf} from '@angular/common';
|
import {NgIf} from '@angular/common';
|
||||||
import {EventService} from '../../service/event.service';
|
import {EventService} from '../../service/event.service';
|
||||||
import {LogNotification} from '../../model/log-notification.model';
|
import {LogNotification} from '../../model/log-notification.model';
|
||||||
import {Button} from 'primeng/button';
|
import {Button} from 'primeng/button';
|
||||||
import {AppConfiguratorComponent} from '../../../configurator/configurator.component';
|
import {AppConfiguratorComponent} from '../../../configurator/configurator.component';
|
||||||
|
import {StyleClass} from 'primeng/styleclass';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-topbar',
|
selector: 'app-topbar',
|
||||||
@@ -27,7 +28,8 @@ import {AppConfiguratorComponent} from '../../../configurator/configurator.compo
|
|||||||
SearchComponent,
|
SearchComponent,
|
||||||
NgIf,
|
NgIf,
|
||||||
Button,
|
Button,
|
||||||
AppConfiguratorComponent
|
AppConfiguratorComponent,
|
||||||
|
StyleClass
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppTopBarComponent implements OnDestroy {
|
export class AppTopBarComponent implements OnDestroy {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<p-stepper>
|
<p-stepper>
|
||||||
<p-stepper header="Library Name">
|
<p-stepper header="Library Name">
|
||||||
<ng-template pTemplate="content" let-nextCallback="nextCallback" let-index="index">
|
<ng-template pTemplate="content" let-nextCallback="nextCallback" let-index="index">
|
||||||
<div class="flex flex-column h-21rem">
|
<div class="flex flex-col h-[21rem]">
|
||||||
<div class="border-2 border-dashed surface-border border-round surface-ground flex-auto flex justify-content-center align-items-center font-medium">
|
<div class="border-2 border-dashed border-surface rounded-border bg-surface-50 dark:bg-surface-950 flex-auto flex justify-center items-center font-medium">
|
||||||
|
|
||||||
<div class="library-name-icon-parent">
|
<div class="library-name-icon-parent">
|
||||||
<div class="library-name-div">
|
<div class="library-name-div">
|
||||||
@@ -23,24 +23,24 @@
|
|||||||
<app-icon-picker (iconSelected)="onIconSelected($event)"></app-icon-picker>
|
<app-icon-picker (iconSelected)="onIconSelected($event)"></app-icon-picker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex pt-4 justify-content-end">
|
<div class="flex pt-6 justify-end">
|
||||||
<p-button label="Next" icon="pi pi-arrow-right" iconPos="right" (onClick)="nextCallback.emit()"/>
|
<p-button label="Next" icon="pi pi-arrow-right" iconPos="right" (onClick)="nextCallback.emit()"/>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-stepper>
|
</p-stepper>
|
||||||
<p-stepper header="Media Location">
|
<p-stepper header="Media Location">
|
||||||
<ng-template pTemplate="content" let-prevCallback="prevCallback" let-index="index">
|
<ng-template pTemplate="content" let-prevCallback="prevCallback" let-index="index">
|
||||||
<div class="flex flex-column xxx">
|
<div class="flex flex-col xxx">
|
||||||
<div
|
<div
|
||||||
class="border-2 border-dashed surface-border border-round surface-ground flex-auto flex align-items-start"
|
class="border-2 border-dashed border-surface rounded-border bg-surface-50 dark:bg-surface-950 flex-auto flex items-start"
|
||||||
style="padding-top: 3rem;">
|
style="padding-top: 3rem;">
|
||||||
<div class="flex flex-column justify-content-center align-items-center w-100">
|
<div class="flex flex-col justify-center items-center w-100">
|
||||||
<p-button
|
<p-button
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
label="Browse for media folders"
|
label="Browse for media folders"
|
||||||
(onClick)="show()">
|
(onClick)="show()">
|
||||||
</p-button>
|
</p-button>
|
||||||
<p-table [value]="folders" styleClass="p-datatable-striped" class="p-table-custom mt-3">
|
<p-table [value]="folders" styleClass="p-datatable-striped" class="p-table-custom mt-4">
|
||||||
<ng-template pTemplate="body" let-folder let-i="rowIndex">
|
<ng-template pTemplate="body" let-folder let-i="rowIndex">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tr-custom">{{ folder }}</td>
|
<td class="tr-custom">{{ folder }}</td>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex pt-4 justify-content-between">
|
<div class="flex pt-6 justify-between">
|
||||||
<p-button label="Back" icon="pi pi-arrow-left" (onClick)="prevCallback.emit()"/>
|
<p-button label="Back" icon="pi pi-arrow-left" (onClick)="prevCallback.emit()"/>
|
||||||
<p-button severity="success" label="Save" icon="pi pi-save" (onClick)="addLibrary()"></p-button>
|
<p-button severity="success" label="Save" icon="pi pi-save" (onClick)="addLibrary()"></p-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="search-container" #searchContainer>
|
<div class="search-container">
|
||||||
<span class="p-input-icon-left">
|
<div class="search-input-wrapper">
|
||||||
<i class="pi pi-search"></i>
|
<i class="pi pi-search search-icon"></i>
|
||||||
<input
|
<input
|
||||||
style="width: 400px;"
|
style="width: 400px;"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
(input)="onSearchInputChange()"
|
(input)="onSearchInputChange()"
|
||||||
placeholder="Search books..."
|
placeholder="Search books..."
|
||||||
class="search-input"
|
class="search-input"
|
||||||
#searchInput/>
|
/>
|
||||||
<button *ngIf="searchQuery" pButton icon="pi pi-times" (click)="clearSearch()" class="clear-btn" type="button" aria-label="Clear Search"></button>
|
<p-button *ngIf="searchQuery" icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button>
|
||||||
</span>
|
</div>
|
||||||
|
|
||||||
<div class="search-dropdown layout-menu" [class.show]="(books.length > 0)">
|
<div class="search-dropdown layout-menu" [class.show]="(books.length > 0)">
|
||||||
<ng-container *ngIf="books.length > 0; else noResults">
|
<ng-container *ngIf="books.length > 0; else noResults">
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- No results message -->
|
|
||||||
<ng-template #noResults>
|
<ng-template #noResults>
|
||||||
<div class="search-dropdown-item">
|
<div class="search-dropdown-item">
|
||||||
<span>No results found</span>
|
<span>No results found</span>
|
||||||
|
|||||||
@@ -3,12 +3,43 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-input-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 10px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
color: var(--text-color-secondary);
|
||||||
|
font-size: 1.0rem;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
width: 100%;
|
||||||
|
padding-left: 30px;
|
||||||
|
height: 2.5rem;
|
||||||
|
line-height: 2.5rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear-btn {
|
||||||
|
color: var(--text-color-secondary);
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
.search-dropdown {
|
.search-dropdown {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: var(--surface-overlay);
|
background-color: var(--code-background);
|
||||||
border: 1px solid var(--surface-border);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--card-border);
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
@@ -51,30 +82,3 @@
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-dropdown.show {
|
|
||||||
opacity: 1;
|
|
||||||
height: auto;
|
|
||||||
transition: opacity 0.3s ease, height 0.4s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clear-btn {
|
|
||||||
color: var(--text-color-secondary);
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-dropdown-item.no-results {
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--text-color-secondary);
|
|
||||||
padding: 10px;
|
|
||||||
text-align: center;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {Book} from '../../model/book.model';
|
|||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {InputTextModule} from 'primeng/inputtext';
|
import {InputTextModule} from 'primeng/inputtext';
|
||||||
import {NgForOf, NgIf} from '@angular/common';
|
import {NgForOf, NgIf} from '@angular/common';
|
||||||
import {ButtonDirective} from 'primeng/button';
|
import {Button} from 'primeng/button';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {BookService} from '../../service/book.service';
|
import {BookService} from '../../service/book.service';
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import {BookService} from '../../service/book.service';
|
|||||||
InputTextModule,
|
InputTextModule,
|
||||||
NgForOf,
|
NgForOf,
|
||||||
NgIf,
|
NgIf,
|
||||||
ButtonDirective
|
Button
|
||||||
],
|
],
|
||||||
styleUrls: ['./search.component.scss']
|
styleUrls: ['./search.component.scss']
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<div *ngIf="!selectedIcon">
|
<div *ngIf="!selectedIcon">
|
||||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="selectedIcon" class="mt-2 flex align-items-center">
|
<div *ngIf="selectedIcon" class="mt-2 flex items-center">
|
||||||
<i [class]="selectedIcon" class="mr-2"></i>
|
<i [class]="selectedIcon" class="mr-2"></i>
|
||||||
<p-button label="Remove" icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
|
<p-button label="Remove" icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,8 +2,4 @@ export interface AppState {
|
|||||||
preset?: string;
|
preset?: string;
|
||||||
primary?: string;
|
primary?: string;
|
||||||
surface?: string;
|
surface?: string;
|
||||||
darkTheme?: boolean;
|
|
||||||
menuActive?: boolean;
|
|
||||||
designerKey?: string;
|
|
||||||
RTL?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,77 +1,35 @@
|
|||||||
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
|
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
|
||||||
import { computed, effect, inject, Injectable, PLATFORM_ID, signal } from '@angular/core';
|
import {effect, inject, Injectable, PLATFORM_ID, signal} from '@angular/core';
|
||||||
import {AppState} from '../model/state/app-state.model';
|
import {AppState} from '../model/state/app-state.model';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class AppConfigService {
|
export class AppConfigService {
|
||||||
private readonly STORAGE_KEY = 'appConfigState';
|
private readonly STORAGE_KEY = 'appConfigState';
|
||||||
|
|
||||||
appState = signal<AppState>({});
|
appState = signal<AppState>({});
|
||||||
|
|
||||||
document = inject(DOCUMENT);
|
document = inject(DOCUMENT);
|
||||||
|
|
||||||
platformId = inject(PLATFORM_ID);
|
platformId = inject(PLATFORM_ID);
|
||||||
|
|
||||||
theme = computed(() => (this.appState()?.darkTheme ? 'dark' : 'light'));
|
|
||||||
|
|
||||||
transitionComplete = signal<boolean>(false);
|
|
||||||
|
|
||||||
private initialized = false;
|
private initialized = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.appState.set({ ...this.loadAppState() });
|
const initialState = this.loadAppState();
|
||||||
|
this.appState.set({...initialState});
|
||||||
|
this.document.documentElement.classList.add('p-dark');
|
||||||
effect(
|
effect(
|
||||||
() => {
|
() => {
|
||||||
const state = this.appState();
|
const state = this.appState();
|
||||||
|
|
||||||
if (!this.initialized || !state) {
|
if (!this.initialized || !state) {
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.saveAppState(state);
|
this.saveAppState(state);
|
||||||
this.handleDarkModeTransition(state);
|
|
||||||
},
|
},
|
||||||
{allowSignalWrites: true}
|
{allowSignalWrites: true}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleDarkModeTransition(state: AppState): void {
|
private loadAppState(): AppState {
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
|
||||||
if ((document as any).startViewTransition) {
|
|
||||||
this.startViewTransition(state);
|
|
||||||
} else {
|
|
||||||
this.toggleDarkMode(state);
|
|
||||||
this.onTransitionEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private startViewTransition(state: AppState): void {
|
|
||||||
const transition = (document as any).startViewTransition(() => {
|
|
||||||
this.toggleDarkMode(state);
|
|
||||||
});
|
|
||||||
|
|
||||||
transition.ready.then(() => this.onTransitionEnd());
|
|
||||||
}
|
|
||||||
|
|
||||||
private toggleDarkMode(state: AppState): void {
|
|
||||||
if (state.darkTheme) {
|
|
||||||
this.document.documentElement.classList.add('p-dark');
|
|
||||||
} else {
|
|
||||||
this.document.documentElement.classList.remove('p-dark');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onTransitionEnd() {
|
|
||||||
this.transitionComplete.set(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.transitionComplete.set(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadAppState(): any {
|
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
const storedState = localStorage.getItem(this.STORAGE_KEY);
|
const storedState = localStorage.getItem(this.STORAGE_KEY);
|
||||||
if (storedState) {
|
if (storedState) {
|
||||||
@@ -80,16 +38,12 @@ export class AppConfigService {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
preset: 'Aura',
|
preset: 'Aura',
|
||||||
primary: 'noir',
|
primary: 'green',
|
||||||
surface: null,
|
surface: 'viva',
|
||||||
darkTheme: true,
|
|
||||||
menuActive: false,
|
|
||||||
designerKey: 'primeng-designer-theme',
|
|
||||||
RTL: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private saveAppState(state: any): void {
|
private saveAppState(state: AppState): void {
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));
|
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,46 @@
|
|||||||
<p>configurator works!</p>
|
<div class="config-panel-content">
|
||||||
|
|
||||||
|
<div class="config-panel-colors">
|
||||||
|
<span class="config-panel-label">Primary</span>
|
||||||
|
<div>
|
||||||
|
@for (primaryColor of primaryColors(); track primaryColor.name) {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[title]="primaryColor.name"
|
||||||
|
(click)="updateColors($event, 'primary', primaryColor)"
|
||||||
|
[ngClass]="{ 'active-color': primaryColor.name === selectedPrimaryColor() }"
|
||||||
|
[style]="{ 'background-color': primaryColor.name === 'noir' ? 'var(--text-color)' : primaryColor.palette?.['500'] || 'transparent' }"
|
||||||
|
></button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="config-panel-colors">
|
||||||
|
<span class="config-panel-label">Surface</span>
|
||||||
|
<div>
|
||||||
|
@for (surface of surfaces; track surface.name) {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
[title]="surface.name"
|
||||||
|
(click)="updateColors($event, 'surface', surface)"
|
||||||
|
[ngClass]="{ 'active-color': selectedSurfaceColor() ? selectedSurfaceColor() === surface.name : surface.name === 'zinc' }"
|
||||||
|
[style]="{'background-color': surface.name === 'noir' ? 'var(--text-color)' : surface.palette['500'] }">
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="config-panel-settings">
|
||||||
|
<span class="config-panel-label">Presets</span>
|
||||||
|
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small"/>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="config-panel-settings">
|
||||||
|
<span class="config-panel-label">Ripple</span>
|
||||||
|
<p-toggleswitch [(ngModel)]="ripple"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -15,10 +15,9 @@ import {ToggleSwitchModule} from 'primeng/toggleswitch';
|
|||||||
import {AppConfigService} from '../book/service/app-config.service';
|
import {AppConfigService} from '../book/service/app-config.service';
|
||||||
|
|
||||||
interface ColorPalette {
|
interface ColorPalette {
|
||||||
[key: string]: string; // Allows dynamic string keys like '500', '400', etc.
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define interface for Palette
|
|
||||||
interface Palette {
|
interface Palette {
|
||||||
name: string;
|
name: string;
|
||||||
palette: ColorPalette;
|
palette: ColorPalette;
|
||||||
@@ -34,58 +33,7 @@ const presets = {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-configurator',
|
selector: 'app-configurator',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
template: `
|
templateUrl: './configurator.component.html',
|
||||||
<div class="config-panel-content">
|
|
||||||
<div class="config-panel-colors">
|
|
||||||
<span class="config-panel-label">Primary</span>
|
|
||||||
<div>
|
|
||||||
@for (primaryColor of primaryColors(); track primaryColor.name) {
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
[title]="primaryColor.name"
|
|
||||||
(click)="updateColors($event, 'primary', primaryColor)"
|
|
||||||
[ngClass]="{ 'active-color': primaryColor.name === selectedPrimaryColor() }"
|
|
||||||
[style]="{ 'background-color': primaryColor.name === 'noir' ? 'var(--text-color)' : primaryColor.palette?.['500'] || 'transparent' }"
|
|
||||||
></button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="config-panel-colors">
|
|
||||||
<span class="config-panel-label">Surface</span>
|
|
||||||
<div>
|
|
||||||
@for (surface of surfaces; track surface.name) {
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
[title]="surface.name"
|
|
||||||
(click)="updateColors($event, 'surface', surface)"
|
|
||||||
[ngClass]="{ 'active-color': selectedSurfaceColor() ? selectedSurfaceColor() === surface.name : configService.appState().darkTheme ? surface.name === 'zinc' : surface.name === 'slate' }"
|
|
||||||
[style]="{'background-color': surface.name === 'noir' ? 'var(--text-color)' : surface.palette['500'] }">
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="config-panel-settings">
|
|
||||||
<span class="config-panel-label">Presets</span>
|
|
||||||
<p-selectbutton [options]="presets" [ngModel]="selectedPreset()" (ngModelChange)="onPresetChange($event)" [allowEmpty]="false" size="small"/>
|
|
||||||
</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="flex-1">
|
|
||||||
<div class="config-panel-settings">
|
|
||||||
<span class="config-panel-label">Ripple</span>
|
|
||||||
<p-toggleswitch [(ngModel)]="ripple"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-1">
|
|
||||||
<div class="config-panel-settings items-end">
|
|
||||||
<span class="config-panel-label">RTL</span>
|
|
||||||
<p-toggleswitch [ngModel]="isRTL" (ngModelChange)="onRTLChange($event)"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
host: {
|
host: {
|
||||||
class: 'config-panel hidden'
|
class: 'config-panel hidden'
|
||||||
},
|
},
|
||||||
@@ -100,10 +48,6 @@ export class AppConfiguratorComponent {
|
|||||||
this.config.ripple.set(value);
|
this.config.ripple.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRTL() {
|
|
||||||
return this.configService.appState().RTL;
|
|
||||||
}
|
|
||||||
|
|
||||||
config: PrimeNG = inject(PrimeNG);
|
config: PrimeNG = inject(PrimeNG);
|
||||||
|
|
||||||
configService: AppConfigService = inject(AppConfigService);
|
configService: AppConfigService = inject(AppConfigService);
|
||||||
@@ -112,30 +56,10 @@ export class AppConfiguratorComponent {
|
|||||||
|
|
||||||
presets = Object.keys(presets);
|
presets = Object.keys(presets);
|
||||||
|
|
||||||
onRTLChange(value: boolean) {
|
|
||||||
this.configService.appState.update((state) => ({...state, RTL: value}));
|
|
||||||
if (!(document as any).startViewTransition) {
|
|
||||||
this.toggleRTL(value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
(document as any).startViewTransition(() => this.toggleRTL(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleRTL(value: boolean) {
|
|
||||||
const htmlElement = document.documentElement;
|
|
||||||
|
|
||||||
if (value) {
|
|
||||||
htmlElement.setAttribute('dir', 'rtl');
|
|
||||||
} else {
|
|
||||||
htmlElement.removeAttribute('dir');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (isPlatformBrowser(this.platformId)) {
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
this.onPresetChange(this.configService.appState().preset);
|
this.onPresetChange(this.configService.appState().preset);
|
||||||
this.toggleRTL(this.configService.appState().RTL!);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
@import './layout/layout.scss';
|
@import './layout/layout.scss';
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,11 +14,18 @@
|
|||||||
box-shadow: 0px 3px 5px rgba(0, 0, 0, .02), 0px 0px 2px rgba(0, 0, 0, .05), 0px 1px 4px rgba(0, 0, 0, .08);
|
box-shadow: 0px 3px 5px rgba(0, 0, 0, .02), 0px 0px 2px rgba(0, 0, 0, .05), 0px 1px 4px rgba(0, 0, 0, .08);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.layout-menu {
|
.layout-menu {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
||||||
|
.layout-menuitem-text {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.layout-root-menuitem {
|
.layout-root-menuitem {
|
||||||
> .layout-menuitem-root-text {
|
> .layout-menuitem-root-text {
|
||||||
font-size: .857rem;
|
font-size: .857rem;
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
@mixin focus-visible() {
|
||||||
|
&:focus-visible {
|
||||||
|
outline: 1px solid var(--primary-color);
|
||||||
|
outline-offset: var(--p-focus-ring-offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@mixin focused() {
|
@mixin focused() {
|
||||||
outline: 0 none;
|
outline: 0 none;
|
||||||
outline-offset: 0;
|
outline-offset: 0;
|
||||||
@@ -11,3 +18,5 @@
|
|||||||
transition: box-shadow .2s;
|
transition: box-shadow .2s;
|
||||||
box-shadow: inset var(--focus-ring);
|
box-shadow: inset var(--focus-ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -152,3 +152,172 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topbar-items {
|
||||||
|
display: flex;
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
gap: 0.5rem;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
li {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar-item {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
width: 2.5rem;
|
||||||
|
height: 2.5rem;
|
||||||
|
transition: outline-color .2s, border-color .2s;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
outline-color: transparent;
|
||||||
|
background-color: var(--card-background);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
//@include focus-visible();
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
i, span {
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-item {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: var(--primary-contrast-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-panel {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 2px);
|
||||||
|
inset-inline-end: 0;
|
||||||
|
width: 18rem;
|
||||||
|
padding: .75rem;
|
||||||
|
background-color: var(--overlay-background);
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
transform-origin: top;
|
||||||
|
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||||
|
|
||||||
|
.config-panel-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-panel-label {
|
||||||
|
font-size: .875rem;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-panel-colors {
|
||||||
|
> div {
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-top: .5rem;
|
||||||
|
display: flex;
|
||||||
|
gap: .5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
button {
|
||||||
|
border: none;
|
||||||
|
width: 1.25rem;
|
||||||
|
height: 1.25rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
outline-color: transparent;
|
||||||
|
outline-width: 2px;
|
||||||
|
outline-style: solid;
|
||||||
|
outline-offset: 1px;
|
||||||
|
|
||||||
|
&.active-color {
|
||||||
|
outline-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-panel-settings {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-item {
|
||||||
|
width: auto;
|
||||||
|
padding: 0.5rem;
|
||||||
|
|
||||||
|
.version-text {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-icon {
|
||||||
|
margin-left: .25rem;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.versions-panel {
|
||||||
|
padding: .25rem;
|
||||||
|
background-color: var(--overlay-background);
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: calc(100% + 2px);
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||||
|
transform-origin: top;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 2px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: inline-flex;
|
||||||
|
padding: 0.5rem .75rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--text-color);
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--hover-background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.xxx {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
@import "../node_modules/primeicons/primeicons.css";
|
@import "../node_modules/primeicons/primeicons.css";
|
||||||
@import "assets/layout/styles/global.scss";
|
@import "assets/layout/styles/global.scss";
|
||||||
|
|
||||||
|
@import "../node_modules/primeflex/primeflex.scss";
|
||||||
|
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
|
||||||
|
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user