refactor(frontend): rename booklore-ui to frontend

- Frontend path:
  - rename the tracked Angular app tree from `booklore-ui/` to `frontend/`
  - preserve file contents during the move so this commit stays focused on the path change itself
- Frontend docs:
  - update the moved frontend README and contribution guide where they refer to the renamed folder
  - keep those edits limited to path references introduced by the directory rename
This commit is contained in:
James Cox
2026-04-22 17:26:39 -04:00
committed by Zach Yale
parent c99aa87877
commit 874b013f75
1493 changed files with 3 additions and 3 deletions
@@ -0,0 +1,161 @@
<ng-container *transloco="let t; prefix: 'dashboard.settings'">
<div class="dashboard-settings">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-sliders-h header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">{{ t('title') }}</h2>
<p class="panel-description">{{ t('description') }}</p>
</div>
<p-button
icon="pi pi-times"
[text]="true"
[rounded]="true"
severity="secondary"
(onClick)="cancel()"
class="close-button"
/>
</div>
<div class="scrollers-container">
@for (scroller of config.scrollers; track scroller.id; let i = $index) {
<div class="scroller-item">
<div class="scroller-content">
<div class="scroller-controls-left">
<p-checkbox [(ngModel)]="scroller.enabled" [binary]="true"></p-checkbox>
</div>
<div class="scroller-fields">
<div class="scroller-field" [class.expanded]="scroller.type !== 'magicShelf'">
<label [for]="'dashboard-scroller-type-' + scroller.id">{{ t('type') }}</label>
<p-select
fluid
[inputId]="'dashboard-scroller-type-' + scroller.id"
[options]="availableScrollerTypes"
[(ngModel)]="scroller.type"
(onChange)="onScrollerTypeChange(scroller)"
[placeholder]="t('selectType')"
appendTo="body">
</p-select>
</div>
@if (scroller.type === 'magicShelf') {
<div class="scroller-field">
<label [for]="'dashboard-scroller-magic-shelf-' + scroller.id">{{ t('magicShelf') }}</label>
<p-select
fluid
[inputId]="'dashboard-scroller-magic-shelf-' + scroller.id"
[options]="magicShelves()"
[(ngModel)]="scroller.magicShelfId"
[placeholder]="t('selectMagicShelf')"
appendTo="body">
</p-select>
</div>
<div class="scroller-field">
<label [for]="'dashboard-scroller-sort-field-' + scroller.id">{{ t('sortField') }}</label>
<p-select
fluid
[inputId]="'dashboard-scroller-sort-field-' + scroller.id"
[options]="sortFieldOptions"
[(ngModel)]="scroller.sortField"
[placeholder]="t('selectField')"
appendTo="body">
</p-select>
</div>
<div class="scroller-field">
<label [for]="'dashboard-scroller-sort-direction-' + scroller.id">{{ t('direction') }}</label>
<p-select
fluid
[inputId]="'dashboard-scroller-sort-direction-' + scroller.id"
[options]="sortDirectionOptions"
[(ngModel)]="scroller.sortDirection"
[placeholder]="t('selectDirection')"
appendTo="body">
</p-select>
</div>
}
</div>
<div class="scroller-field max-items-field">
<label [for]="'dashboard-scroller-max-items-' + scroller.id">{{ t('maxItems') }}</label>
<p-inputNumber
fluid
[inputId]="'dashboard-scroller-max-items-' + scroller.id"
[(ngModel)]="scroller.maxItems"
[min]="MIN_ITEMS"
[max]="MAX_ITEMS"
[showButtons]="true">
</p-inputNumber>
</div>
<div class="scroller-controls-right">
<p-button
icon="pi pi-arrow-up"
outlined
rounded
severity="info"
size="small"
[disabled]="i === 0"
(click)="moveUp(i)">
</p-button>
<p-button
icon="pi pi-arrow-down"
outlined
rounded
severity="info"
size="small"
[disabled]="i === config.scrollers.length - 1"
(click)="moveDown(i)">
</p-button>
<p-button
icon="pi pi-trash"
outlined
rounded
size="small"
severity="danger"
(click)="removeScroller(i)"
[disabled]="config.scrollers.length === 1">
</p-button>
</div>
</div>
</div>
}
</div>
<div class="dialog-footer">
<div class="footer-left">
<p-button
[label]="t('addScroller')"
icon="pi pi-plus"
severity="primary"
(click)="addScroller()"
[disabled]="config.scrollers.length >= 5">
</p-button>
<p-button
[label]="t('resetToDefault')"
icon="pi pi-refresh"
severity="secondary"
text
(click)="resetToDefault()">
</p-button>
</div>
<div class="footer-actions">
<p-button
[label]="'common.cancel' | transloco"
[outlined]="true"
severity="secondary"
(click)="cancel()">
</p-button>
<p-button
[label]="'common.save' | transloco"
icon="pi pi-check"
severity="success"
(click)="save()">
</p-button>
</div>
</div>
</div>
</ng-container>
@@ -0,0 +1,225 @@
@use '../../../../shared/styles/panel-shared' as panel;
.dashboard-settings {
display: flex;
flex-direction: column;
@media (max-width: 640px) {
width: 100%;
max-width: 100%;
}
}
.panel-header {
@include panel.panel-header;
}
.settings-controls {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 1rem 2rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
.settings-info {
.info-content {
display: flex;
gap: 0.75rem;
padding: 0.75rem;
background: var(--overlay-background);
border-radius: 6px;
border: 1px solid var(--p-primary-300);
.info-icon {
color: var(--primary-color);
font-size: 1.125rem;
flex-shrink: 0;
margin-top: 0.125rem;
}
.info-text {
flex: 1;
p {
margin: 0;
line-height: 1.5;
font-size: 0.875rem;
color: var(--text-color-secondary);
}
}
}
}
@media (max-width: 480px) {
padding: 1rem;
gap: 0.5rem;
.settings-info {
.info-content {
flex-direction: column;
gap: 0.5rem;
}
}
}
}
.scrollers-container {
padding: 1.5rem 2rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
min-height: 200px;
max-height: 450px;
overflow-y: auto;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: var(--overlay-background);
border-radius: 3px;
}
&::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 3px;
&:hover {
background: var(--primary-color);
}
}
@media (max-width: 480px) {
padding: 1rem;
max-height: 400px;
}
}
.scroller-item {
border: var(--card-border);
transition: all 0.2s;
border-color: var(--p-content-border-color);
background: var(--p-content-background);
padding: 1rem;
margin-bottom: 0.75rem;
border-radius: 0.375rem;
@media (max-width: 768px) {
padding: 0.75rem !important;
}
}
.scroller-content {
display: flex;
align-items: flex-end;
gap: 0.75rem;
@media (max-width: 768px) {
flex-direction: column;
align-items: stretch;
gap: 1rem;
}
}
.scroller-controls-left {
display: flex;
align-items: center;
padding-bottom: 0.65rem;
@media (max-width: 768px) {
padding-bottom: 0;
align-self: flex-start;
}
}
.scroller-controls-right {
display: flex;
gap: 0.5rem;
padding-bottom: 0.25rem;
@media (max-width: 768px) {
padding-bottom: 0;
align-self: flex-end;
}
}
.scroller-fields {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 0.75rem;
flex: 1;
@media (max-width: 768px) {
grid-template-columns: 1fr;
gap: 0.75rem;
}
@media (max-width: 640px) {
gap: 0.5rem;
}
}
.scroller-field {
label {
display: block;
margin-bottom: 0.5rem;
}
&.expanded {
flex: 1;
@media (max-width: 768px) {
flex: unset;
}
}
}
.max-items-field {
max-width: 9rem;
flex-shrink: 0;
@media (max-width: 768px) {
max-width: none;
}
}
label {
color: var(--text-color-secondary);
font-size: 0.875rem;
font-weight: 500;
}
.dialog-footer {
@include panel.dialog-footer;
border-top: none;
.footer-left {
display: flex;
align-items: center;
gap: 0.5rem;
}
@media (max-width: 640px) {
.footer-left {
flex-direction: column;
gap: 0.5rem;
::ng-deep .p-button {
width: 100%;
}
}
.footer-actions {
::ng-deep .p-button {
flex: 1;
}
}
}
}
.add-scroller-wrapper {
margin-bottom: 0;
}
@@ -0,0 +1,206 @@
import {Component, computed, effect, inject} from '@angular/core';
import {toSignal} from '@angular/core/rxjs-interop';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
import {ButtonModule} from 'primeng/button';
import {CheckboxModule} from 'primeng/checkbox';
import {InputTextModule} from 'primeng/inputtext';
import {SelectModule} from 'primeng/select';
import {InputNumberModule} from 'primeng/inputnumber';
import {DashboardConfig, ScrollerConfig, ScrollerType} from '../../models/dashboard-config.model';
import {DashboardConfigService} from '../../services/dashboard-config.service';
import {MagicShelfService} from '../../../magic-shelf/service/magic-shelf.service';
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
export const MAX_SCROLLERS = 5;
export const DEFAULT_MAX_ITEMS = 20;
export const MIN_ITEMS = 10;
export const MAX_ITEMS = 20;
@Component({
selector: 'app-dashboard-settings',
standalone: true,
imports: [
CommonModule,
FormsModule,
ButtonModule,
CheckboxModule,
InputTextModule,
SelectModule,
InputNumberModule,
TranslocoDirective,
TranslocoPipe
],
templateUrl: './dashboard-settings.component.html',
styleUrls: ['./dashboard-settings.component.scss']
})
export class DashboardSettingsComponent {
private configService = inject(DashboardConfigService);
private dialogRef = inject(DynamicDialogRef);
private magicShelfService = inject(MagicShelfService);
private translocoService = inject(TranslocoService);
private readonly activeLanguage = toSignal(this.translocoService.langChanges$, {
initialValue: this.translocoService.getActiveLang()
});
config: DashboardConfig = structuredClone(this.configService.config());
availableScrollerTypes: {label: string; value: ScrollerType}[] = [];
sortFieldOptions: {label: string; value: string}[] = [];
sortDirectionOptions: {label: string; value: string}[] = [];
magicShelves = computed(() =>
this.magicShelfService.shelves().map(shelf => ({
label: shelf.name,
value: shelf.id!
}))
);
private magicShelvesMap = computed(() => {
const shelfMap = new Map<number, string>();
this.magicShelfService.shelves().forEach(shelf => {
if (shelf.id) {
shelfMap.set(shelf.id, shelf.name);
}
});
return shelfMap;
});
readonly MIN_ITEMS = MIN_ITEMS;
readonly MAX_ITEMS = MAX_ITEMS;
private readonly syncTranslatedOptionsEffect = effect(() => {
this.activeLanguage();
this.buildTranslatedOptions();
});
private readonly syncConfigEffect = effect(() => {
this.config = structuredClone(this.configService.config());
});
private buildTranslatedOptions(): void {
const t = (key: string) => this.translocoService.translate(`dashboard.settings.${key}`);
this.availableScrollerTypes = [
{label: t('scrollerTypes.lastRead'), value: ScrollerType.LAST_READ},
{label: t('scrollerTypes.lastListened'), value: ScrollerType.LAST_LISTENED},
{label: t('scrollerTypes.latestAdded'), value: ScrollerType.LATEST_ADDED},
{label: t('scrollerTypes.random'), value: ScrollerType.RANDOM},
{label: t('scrollerTypes.magicShelf'), value: ScrollerType.MAGIC_SHELF}
];
this.sortFieldOptions = [
{label: t('sortFields.title'), value: 'title'},
{label: t('sortFields.fileName'), value: 'fileName'},
{label: t('sortFields.filePath'), value: 'filePath'},
{label: t('sortFields.addedOn'), value: 'addedOn'},
{label: t('sortFields.author'), value: 'author'},
{label: t('sortFields.authorSurnameVorname'), value: 'authorSurnameVorname'},
{label: t('sortFields.seriesName'), value: 'seriesName'},
{label: t('sortFields.seriesNumber'), value: 'seriesNumber'},
{label: t('sortFields.personalRating'), value: 'personalRating'},
{label: t('sortFields.publisher'), value: 'publisher'},
{label: t('sortFields.publishedDate'), value: 'publishedDate'},
{label: t('sortFields.lastReadTime'), value: 'lastReadTime'},
{label: t('sortFields.readStatus'), value: 'readStatus'},
{label: t('sortFields.dateFinished'), value: 'dateFinished'},
{label: t('sortFields.readingProgress'), value: 'readingProgress'},
{label: t('sortFields.bookType'), value: 'bookType'},
{label: t('sortFields.pageCount'), value: 'pageCount'}
];
this.sortDirectionOptions = [
{label: t('sortDirections.asc'), value: 'asc'},
{label: t('sortDirections.desc'), value: 'desc'}
];
}
getScrollerTitle(scroller: ScrollerConfig): string {
if (scroller.type === ScrollerType.MAGIC_SHELF && scroller.magicShelfId) {
return this.magicShelvesMap().get(scroller.magicShelfId) || 'dashboard.scroller.magicShelf';
}
switch (scroller.type) {
case ScrollerType.LAST_READ:
return 'dashboard.scroller.continueReading';
case ScrollerType.LAST_LISTENED:
return 'dashboard.scroller.continueListening';
case ScrollerType.LATEST_ADDED:
return 'dashboard.scroller.recentlyAdded';
case ScrollerType.RANDOM:
return 'dashboard.scroller.discoverNew';
default:
return 'dashboard.scroller.default';
}
}
addScroller(): void {
if (this.config.scrollers.length >= MAX_SCROLLERS) {
return;
}
const newId = (Math.max(...this.config.scrollers.map((s: ScrollerConfig) => parseInt(s.id)), 0) + 1).toString();
this.config.scrollers.push({
id: newId,
type: ScrollerType.LATEST_ADDED,
title: '',
enabled: true,
order: this.config.scrollers.length + 1,
maxItems: DEFAULT_MAX_ITEMS
});
}
removeScroller(index: number): void {
if (this.config.scrollers.length <= 1) {
return;
}
this.config.scrollers.splice(index, 1);
this.updateOrder();
}
onScrollerTypeChange(scroller: ScrollerConfig): void {
if (scroller.type === ScrollerType.MAGIC_SHELF) {
scroller.magicShelfId = undefined;
} else {
delete scroller.magicShelfId;
}
}
moveUp(index: number): void {
if (index > 0) {
[this.config.scrollers[index], this.config.scrollers[index - 1]] =
[this.config.scrollers[index - 1], this.config.scrollers[index]];
this.updateOrder();
}
}
moveDown(index: number): void {
if (index < this.config.scrollers.length - 1) {
[this.config.scrollers[index], this.config.scrollers[index + 1]] =
[this.config.scrollers[index + 1], this.config.scrollers[index]];
this.updateOrder();
}
}
private updateOrder(): void {
this.config.scrollers.forEach((scroller, index) => {
scroller.order = index + 1;
});
}
save(): void {
this.config.scrollers.forEach(scroller => {
scroller.title = this.getScrollerTitle(scroller);
});
this.configService.saveConfig(this.config);
this.dialogRef.close();
}
cancel(): void {
this.dialogRef.close();
}
resetToDefault(): void {
this.configService.resetToDefault();
this.dialogRef.close();
}
}