Checkpoint
This commit is contained in:
Generated
+7
@@ -23,6 +23,7 @@
|
||||
"ng-lazyload-image": "^9.1.3",
|
||||
"ngx-extended-pdf-viewer": "^22.0.0",
|
||||
"ngx-infinite-scroll": "^19.0.0",
|
||||
"primeflex": "^3.3.1",
|
||||
"primeicons": "^7.0.0",
|
||||
"primeng": "19.0.2",
|
||||
"rxjs": "~7.8.0",
|
||||
@@ -11862,6 +11863,12 @@
|
||||
"dev": true,
|
||||
"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": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-7.0.0.tgz",
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
"@angular/platform-browser-dynamic": "^19.0.0",
|
||||
"@angular/router": "^19.0.0",
|
||||
"@iharbeck/ngx-virtual-scroller": "^19.0.1",
|
||||
"@primeng/themes": "19.0.2",
|
||||
"@stomp/rx-stomp": "^2.0.0",
|
||||
"@stomp/stompjs": "^7.0.0",
|
||||
"ng-lazyload-image": "^9.1.3",
|
||||
"ngx-extended-pdf-viewer": "^22.0.0",
|
||||
"ngx-infinite-scroll": "^19.0.0",
|
||||
"primeflex": "^3.3.1",
|
||||
"primeicons": "^7.0.0",
|
||||
"@primeng/themes": "19.0.2",
|
||||
"primeng": "19.0.2",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="book-card-container" *ngIf="(bookState$ | async)?.books as 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">
|
||||
<app-book-card
|
||||
[book]="book"
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
||||
gap: 1.3rem;
|
||||
padding: 1rem;
|
||||
overflow: hidden;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import {Ripple} from 'primeng/ripple';
|
||||
[queryParams]="item.queryParams"
|
||||
[attr.target]="item.target" tabindex="0" pRipple>
|
||||
<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 }}
|
||||
<span *ngIf="item.bookCount$ | async as bookCount">
|
||||
{{ bookCount }}
|
||||
|
||||
@@ -1,42 +1,47 @@
|
||||
<div class="layout-topbar">
|
||||
|
||||
<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>
|
||||
</a>
|
||||
|
||||
<button #menubutton class="p-link layout-menu-button layout-topbar-button" (click)="layoutService.onMenuToggle()">
|
||||
<i class="pi pi-bars"></i>
|
||||
</button>
|
||||
<p-button #menubutton icon="pi pi-arrow-left" [rounded]="true" [outlined]="true" (click)="layoutService.onMenuToggle()"></p-button>
|
||||
|
||||
<div>
|
||||
<div class="xxx">
|
||||
<app-search></app-search>
|
||||
<ul class="topbar-items">
|
||||
<li>
|
||||
<i class="topbar-item pi pi-wave-pulse p-link layout-topbar-menu-button layout-topbar-button"
|
||||
(click)="toggleEventDisplay()"
|
||||
(mouseenter)="onMouseEnter()"
|
||||
(mouseleave)="onMouseLeave()"
|
||||
[class.pulsating]="eventHighlight"
|
||||
[class.highlight]="eventHighlight"></i>
|
||||
<div *ngIf="showEvents" class="live-event-container" (mouseleave)="onMouseLeave()">
|
||||
<p *ngIf="latestEvent.timestamp">{{ latestEvent.timestamp }}</p>
|
||||
<p>{{ latestEvent.message }}</p>
|
||||
</div>
|
||||
</li>
|
||||
<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>
|
||||
<app-configurator></app-configurator>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button #topbarmenubutton class="p-link layout-topbar-menu-button layout-topbar-button" (click)="layoutService.showProfileSidebar()">
|
||||
<i class="pi pi-ellipsis-v"></i>
|
||||
</button>
|
||||
|
||||
<div #topbarmenu class="layout-topbar-menu">
|
||||
<button class="p-link layout-topbar-button"
|
||||
(click)="toggleEventDisplay()"
|
||||
(mouseenter)="onMouseEnter()"
|
||||
(mouseleave)="onMouseLeave()"
|
||||
[class.pulsating]="eventHighlight"
|
||||
[class.highlight]="eventHighlight">
|
||||
<i class="pi pi-wave-pulse"></i>
|
||||
</button>
|
||||
|
||||
<div *ngIf="showEvents" class="live-event-container" (mouseleave)="onMouseLeave()">
|
||||
<p *ngIf="latestEvent.timestamp">{{ latestEvent.timestamp }}</p>
|
||||
<p>{{ latestEvent.message }}</p>
|
||||
</div>
|
||||
<button class="p-link layout-menu-button layout-topbar-button" (click)="openLibraryCreatorDialog()" pTooltip="Create New Library" tooltipPosition="top">
|
||||
<i class="pi pi-plus-circle"></i>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,3 +37,4 @@
|
||||
.pulsating {
|
||||
animation: pulsate 1.5s infinite ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ import {FormsModule} from '@angular/forms';
|
||||
import {InputTextModule} from 'primeng/inputtext';
|
||||
import {SearchComponent} from '../search/search.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 {LogNotification} from '../../model/log-notification.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AppConfiguratorComponent} from '../../../configurator/configurator.component';
|
||||
import {StyleClass} from 'primeng/styleclass';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topbar',
|
||||
@@ -27,7 +28,8 @@ import {AppConfiguratorComponent} from '../../../configurator/configurator.compo
|
||||
SearchComponent,
|
||||
NgIf,
|
||||
Button,
|
||||
AppConfiguratorComponent
|
||||
AppConfiguratorComponent,
|
||||
StyleClass
|
||||
],
|
||||
})
|
||||
export class AppTopBarComponent implements OnDestroy {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<p-stepper>
|
||||
<p-stepper header="Library Name">
|
||||
<ng-template pTemplate="content" let-nextCallback="nextCallback" let-index="index">
|
||||
<div class="flex flex-column 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="flex flex-col h-[21rem]">
|
||||
<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-div">
|
||||
@@ -23,24 +23,24 @@
|
||||
<app-icon-picker (iconSelected)="onIconSelected($event)"></app-icon-picker>
|
||||
</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()"/>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-stepper>
|
||||
<p-stepper header="Media Location">
|
||||
<ng-template pTemplate="content" let-prevCallback="prevCallback" let-index="index">
|
||||
<div class="flex flex-column xxx">
|
||||
<div class="flex flex-col xxx">
|
||||
<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;">
|
||||
<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
|
||||
severity="secondary"
|
||||
label="Browse for media folders"
|
||||
(onClick)="show()">
|
||||
</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">
|
||||
<tr>
|
||||
<td class="tr-custom">{{ folder }}</td>
|
||||
@@ -59,7 +59,7 @@
|
||||
</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 severity="success" label="Save" icon="pi pi-save" (onClick)="addLibrary()"></p-button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="search-container" #searchContainer>
|
||||
<span class="p-input-icon-left">
|
||||
<i class="pi pi-search"></i>
|
||||
<div class="search-container">
|
||||
<div class="search-input-wrapper">
|
||||
<i class="pi pi-search search-icon"></i>
|
||||
<input
|
||||
style="width: 400px;"
|
||||
type="text"
|
||||
@@ -9,9 +9,9 @@
|
||||
(input)="onSearchInputChange()"
|
||||
placeholder="Search books..."
|
||||
class="search-input"
|
||||
#searchInput/>
|
||||
<button *ngIf="searchQuery" pButton icon="pi pi-times" (click)="clearSearch()" class="clear-btn" type="button" aria-label="Clear Search"></button>
|
||||
</span>
|
||||
/>
|
||||
<p-button *ngIf="searchQuery" icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button>
|
||||
</div>
|
||||
|
||||
<div class="search-dropdown layout-menu" [class.show]="(books.length > 0)">
|
||||
<ng-container *ngIf="books.length > 0; else noResults">
|
||||
@@ -21,7 +21,6 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<!-- No results message -->
|
||||
<ng-template #noResults>
|
||||
<div class="search-dropdown-item">
|
||||
<span>No results found</span>
|
||||
|
||||
@@ -3,12 +3,43 @@
|
||||
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 {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
background-color: var(--surface-overlay);
|
||||
border: 1px solid var(--surface-border);
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--code-background);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--card-border);
|
||||
z-index: 1000;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
@@ -51,30 +82,3 @@
|
||||
color: var(--text-color);
|
||||
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 {InputTextModule} from 'primeng/inputtext';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
import {ButtonDirective} from 'primeng/button';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Router} from '@angular/router';
|
||||
import {BookService} from '../../service/book.service';
|
||||
|
||||
@@ -17,7 +17,7 @@ import {BookService} from '../../service/book.service';
|
||||
InputTextModule,
|
||||
NgForOf,
|
||||
NgIf,
|
||||
ButtonDirective
|
||||
Button
|
||||
],
|
||||
styleUrls: ['./search.component.scss']
|
||||
})
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div *ngIf="!selectedIcon">
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||
</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>
|
||||
<p-button label="Remove" icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,4 @@ export interface AppState {
|
||||
preset?: string;
|
||||
primary?: string;
|
||||
surface?: string;
|
||||
darkTheme?: boolean;
|
||||
menuActive?: boolean;
|
||||
designerKey?: string;
|
||||
RTL?: boolean;
|
||||
}
|
||||
|
||||
@@ -1,97 +1,51 @@
|
||||
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
||||
import { computed, effect, inject, Injectable, PLATFORM_ID, signal } from '@angular/core';
|
||||
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
|
||||
import {effect, inject, Injectable, PLATFORM_ID, signal} from '@angular/core';
|
||||
import {AppState} from '../model/state/app-state.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AppConfigService {
|
||||
private readonly STORAGE_KEY = 'appConfigState';
|
||||
private readonly STORAGE_KEY = 'appConfigState';
|
||||
appState = signal<AppState>({});
|
||||
document = inject(DOCUMENT);
|
||||
platformId = inject(PLATFORM_ID);
|
||||
private initialized = false;
|
||||
|
||||
appState = signal<AppState>({});
|
||||
constructor() {
|
||||
const initialState = this.loadAppState();
|
||||
this.appState.set({...initialState});
|
||||
this.document.documentElement.classList.add('p-dark');
|
||||
effect(
|
||||
() => {
|
||||
const state = this.appState();
|
||||
if (!this.initialized || !state) {
|
||||
this.initialized = true;
|
||||
return;
|
||||
}
|
||||
this.saveAppState(state);
|
||||
},
|
||||
{allowSignalWrites: true}
|
||||
);
|
||||
}
|
||||
|
||||
document = inject(DOCUMENT);
|
||||
|
||||
platformId = inject(PLATFORM_ID);
|
||||
|
||||
theme = computed(() => (this.appState()?.darkTheme ? 'dark' : 'light'));
|
||||
|
||||
transitionComplete = signal<boolean>(false);
|
||||
|
||||
private initialized = false;
|
||||
|
||||
constructor() {
|
||||
this.appState.set({ ...this.loadAppState() });
|
||||
|
||||
effect(
|
||||
() => {
|
||||
const state = this.appState();
|
||||
|
||||
if (!this.initialized || !state) {
|
||||
this.initialized = true;
|
||||
return;
|
||||
private loadAppState(): AppState {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
const storedState = localStorage.getItem(this.STORAGE_KEY);
|
||||
if (storedState) {
|
||||
return JSON.parse(storedState);
|
||||
}
|
||||
}
|
||||
this.saveAppState(state);
|
||||
this.handleDarkModeTransition(state);
|
||||
},
|
||||
{ allowSignalWrites: true }
|
||||
);
|
||||
}
|
||||
|
||||
private handleDarkModeTransition(state: AppState): void {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
if ((document as any).startViewTransition) {
|
||||
this.startViewTransition(state);
|
||||
} else {
|
||||
this.toggleDarkMode(state);
|
||||
this.onTransitionEnd();
|
||||
}
|
||||
return {
|
||||
preset: 'Aura',
|
||||
primary: 'green',
|
||||
surface: 'viva',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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 saveAppState(state: AppState): void {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private onTransitionEnd() {
|
||||
this.transitionComplete.set(true);
|
||||
setTimeout(() => {
|
||||
this.transitionComplete.set(false);
|
||||
});
|
||||
}
|
||||
|
||||
private loadAppState(): any {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
const storedState = localStorage.getItem(this.STORAGE_KEY);
|
||||
if (storedState) {
|
||||
return JSON.parse(storedState);
|
||||
}
|
||||
}
|
||||
return {
|
||||
preset: 'Aura',
|
||||
primary: 'noir',
|
||||
surface: null,
|
||||
darkTheme: true,
|
||||
menuActive: false,
|
||||
designerKey: 'primeng-designer-theme',
|
||||
RTL: false
|
||||
};
|
||||
}
|
||||
|
||||
private saveAppState(state: any): void {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
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';
|
||||
|
||||
interface ColorPalette {
|
||||
[key: string]: string; // Allows dynamic string keys like '500', '400', etc.
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
// Define interface for Palette
|
||||
interface Palette {
|
||||
name: string;
|
||||
palette: ColorPalette;
|
||||
@@ -34,58 +33,7 @@ const presets = {
|
||||
@Component({
|
||||
selector: 'app-configurator',
|
||||
standalone: true,
|
||||
template: `
|
||||
<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>
|
||||
`,
|
||||
templateUrl: './configurator.component.html',
|
||||
host: {
|
||||
class: 'config-panel hidden'
|
||||
},
|
||||
@@ -100,10 +48,6 @@ export class AppConfiguratorComponent {
|
||||
this.config.ripple.set(value);
|
||||
}
|
||||
|
||||
get isRTL() {
|
||||
return this.configService.appState().RTL;
|
||||
}
|
||||
|
||||
config: PrimeNG = inject(PrimeNG);
|
||||
|
||||
configService: AppConfigService = inject(AppConfigService);
|
||||
@@ -112,30 +56,10 @@ export class AppConfiguratorComponent {
|
||||
|
||||
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() {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
this.onPresetChange(this.configService.appState().preset);
|
||||
this.toggleRTL(this.configService.appState().RTL!);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
@import './layout/layout.scss';
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -1,135 +1,142 @@
|
||||
.layout-sidebar {
|
||||
position: fixed;
|
||||
width: 225px;
|
||||
height: calc(100vh - 6.5rem);
|
||||
z-index: 999;
|
||||
overflow-y: auto;
|
||||
user-select: none;
|
||||
top: 5.2rem;
|
||||
left: 1.2rem;
|
||||
transition: transform $transitionDuration, left $transitionDuration;
|
||||
background-color: var(--card-background);
|
||||
border-radius: $borderRadius;
|
||||
padding: 0.5rem 1.35rem;
|
||||
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);
|
||||
position: fixed;
|
||||
width: 225px;
|
||||
height: calc(100vh - 6.5rem);
|
||||
z-index: 999;
|
||||
overflow-y: auto;
|
||||
user-select: none;
|
||||
top: 5.2rem;
|
||||
left: 1.2rem;
|
||||
transition: transform $transitionDuration, left $transitionDuration;
|
||||
background-color: var(--card-background);
|
||||
border-radius: $borderRadius;
|
||||
padding: 0.5rem 1.35rem;
|
||||
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 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
|
||||
.layout-menuitem-text {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.layout-root-menuitem {
|
||||
> .layout-menuitem-root-text {
|
||||
font-size: .857rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
color: var(--surface-900);
|
||||
margin: .75rem 0;
|
||||
}
|
||||
|
||||
> a {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
user-select: none;
|
||||
|
||||
&.active-menuitem {
|
||||
> .layout-submenu-toggler {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
li.active-menuitem {
|
||||
> a {
|
||||
.layout-submenu-toggler {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
|
||||
.layout-root-menuitem {
|
||||
>.layout-menuitem-root-text {
|
||||
font-size: .857rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
color: var(--surface-900);
|
||||
margin: .75rem 0;
|
||||
}
|
||||
|
||||
>a {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
outline: 0 none;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 0.75rem 0.5rem 0.75rem 1rem;
|
||||
border-radius: $borderRadius;
|
||||
transition: background-color $transitionDuration, box-shadow $transitionDuration;
|
||||
|
||||
&.active-menuitem {
|
||||
>.layout-submenu-toggler {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
.layout-menuitem-icon {
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
li.active-menuitem {
|
||||
>a {
|
||||
.layout-submenu-toggler {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
.layout-submenu-toggler {
|
||||
font-size: 75%;
|
||||
margin-left: auto;
|
||||
transition: transform $transitionDuration;
|
||||
}
|
||||
|
||||
&.active-route {
|
||||
font-weight: 700;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
@include focused-inset();
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
overflow: hidden;
|
||||
border-radius: $borderRadius;
|
||||
|
||||
li {
|
||||
a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
outline: 0 none;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 0.75rem 0.5rem 0.75rem 1rem;
|
||||
border-radius: $borderRadius;
|
||||
transition: background-color $transitionDuration, box-shadow $transitionDuration;
|
||||
|
||||
.layout-menuitem-icon {
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
.layout-submenu-toggler {
|
||||
font-size: 75%;
|
||||
margin-left: auto;
|
||||
transition: transform $transitionDuration;
|
||||
}
|
||||
|
||||
&.active-route {
|
||||
font-weight: 700;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
@include focused-inset();
|
||||
}
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
ul {
|
||||
overflow: hidden;
|
||||
border-radius: $borderRadius;
|
||||
li {
|
||||
a {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 2.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 3rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 1rem;
|
||||
margin-left: 3.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 2.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 3rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 3.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
a {
|
||||
margin-left: 4rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
margin-left: 4rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
@mixin focus-visible() {
|
||||
&:focus-visible {
|
||||
outline: 1px solid var(--primary-color);
|
||||
outline-offset: var(--p-focus-ring-offset);
|
||||
}
|
||||
}
|
||||
|
||||
@mixin focused() {
|
||||
outline: 0 none;
|
||||
outline-offset: 0;
|
||||
@@ -11,3 +18,5 @@
|
||||
transition: box-shadow .2s;
|
||||
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 "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