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,67 @@
<ng-container *transloco="let t; prefix: 'settingsMeta.matchWeights'">
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-sliders-h"></i>
{{ t('sectionTitle') }}
</h3>
<p class="section-description">
{{ t('sectionDesc') }}
</p>
</div>
<div class="section-body">
<div class="setting-item action-item">
<div class="action-row">
<div class="action-info">
<span class="action-label">{{ t('recalculateLabel') }}</span>
<span class="action-description">{{ t('recalculateDesc') }}</span>
</div>
<p-button
type="button"
icon="pi pi-refresh"
[label]="t('recalculateBtn')"
[disabled]="isRecalculating"
(click)="recalculate()"
outlined>
</p-button>
</div>
</div>
<div class="setting-item weights-item">
<div class="weights-header">
<span class="weights-icon pi pi-sliders-v"></span>
<h4 class="weights-label">{{ t('fieldWeights') }}</h4>
</div>
<form [formGroup]="form" class="weights-form">
<div class="weights-grid">
@for (key of orderedKeys; track key) {
<div class="weight-field">
<label class="field-label">{{ getFieldLabel(key) }}</label>
<p-inputNumber
size="small"
[formControlName]="key"
[min]="0"
[max]="10"
fluid
[showButtons]="true"/>
</div>
}
</div>
<div class="form-actions">
<p-button
type="button"
severity="success"
[label]="t('saveWeights')"
icon="pi pi-save"
outlined
[disabled]="isSaving"
(click)="save()">
</p-button>
</div>
</form>
</div>
</div>
</div>
</ng-container>
@@ -0,0 +1,171 @@
.settings-card {
display: flex;
flex-direction: column;
gap: 1.25rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 1rem;
gap: 1rem;
}
}
.section-header {
margin-bottom: 0.25rem;
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.section-body {
display: flex;
flex-direction: column;
gap: 2rem;
padding-left: 1rem;
@media (max-width: 768px) {
padding-left: 0.5rem;
}
}
.setting-item {
padding: 0.875rem 1rem;
border-radius: 6px;
border-left: 3px solid var(--primary-color);
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.action-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
}
}
.action-info {
display: flex;
flex-direction: column;
gap: 0.125rem;
}
.action-label {
font-size: 0.9375rem;
font-weight: 500;
color: var(--text-color);
}
.action-description {
font-size: 0.875rem;
color: var(--p-text-muted-color);
line-height: 1.4;
}
.weights-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.weights-icon {
color: var(--primary-color);
font-size: 0.875rem;
flex-shrink: 0;
}
.weights-label {
font-size: 0.9375rem;
font-weight: 500;
color: var(--text-color);
margin: 0;
}
.weights-form {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.weights-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 0.625rem;
padding-top: 0.5rem;
border-top: 1px dashed var(--p-content-border-color);
@media (max-width: 768px) {
grid-template-columns: 1fr 1fr;
gap: 0.5rem;
}
@media (max-width: 400px) {
grid-template-columns: 1fr;
}
}
.weight-field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
padding: 0.5rem 0.625rem;
background: var(--ground-background);
border: 1px solid var(--p-content-border-color);
border-radius: 4px;
.field-label {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-color);
text-transform: capitalize;
}
::ng-deep p-inputnumber {
width: 6rem;
}
}
.form-actions {
display: flex;
justify-content: flex-end;
padding-top: 0.75rem;
border-top: 1px dashed var(--p-content-border-color);
@media (max-width: 768px) {
p-button {
width: 100%;
}
}
}
@@ -0,0 +1,139 @@
import {Component, inject, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
import {MessageService} from 'primeng/api';
import {MetadataMatchWeightsService} from '../../../../shared/service/metadata-match-weights.service';
import {Button} from 'primeng/button';
import {AppSettingKey, AppSettings} from '../../../../shared/model/app-settings.model';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {InputNumber} from 'primeng/inputnumber';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
@Component({
selector: 'app-metadata-match-weights-component',
imports: [
ReactiveFormsModule,
Button,
InputNumber,
TranslocoDirective
],
templateUrl: './metadata-match-weights-component.html',
styleUrl: './metadata-match-weights-component.scss'
})
export class MetadataMatchWeightsComponent implements OnInit {
readonly orderedFieldKeys: string[] = [
'title', 'subtitle', 'authors', 'description', 'publisher', 'publishedDate',
'categories', 'coverImage', 'seriesName', 'seriesNumber', 'seriesTotal',
'language', 'isbn13', 'isbn10', 'pageCount',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'audibleRating', 'audibleReviewCount',
'doubanRating', 'doubanReviewCount', 'ranobedbRating'
];
form!: FormGroup;
isSaving = false;
isRecalculating = false;
private weightsService = inject(MetadataMatchWeightsService);
private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService);
private fb = inject(FormBuilder);
private t = inject(TranslocoService);
ngOnInit(): void {
this.form = this.fb.group({
title: [0, [Validators.required, Validators.min(0)]],
subtitle: [0, [Validators.required, Validators.min(0)]],
description: [0, [Validators.required, Validators.min(0)]],
publisher: [0, [Validators.required, Validators.min(0)]],
publishedDate: [0, [Validators.required, Validators.min(0)]],
authors: [0, [Validators.required, Validators.min(0)]],
categories: [0, [Validators.required, Validators.min(0)]],
seriesName: [0, [Validators.required, Validators.min(0)]],
seriesNumber: [0, [Validators.required, Validators.min(0)]],
seriesTotal: [0, [Validators.required, Validators.min(0)]],
isbn13: [0, [Validators.required, Validators.min(0)]],
isbn10: [0, [Validators.required, Validators.min(0)]],
pageCount: [0, [Validators.required, Validators.min(0)]],
language: [0, [Validators.required, Validators.min(0)]],
amazonRating: [0, [Validators.required, Validators.min(0)]],
amazonReviewCount: [0, [Validators.required, Validators.min(0)]],
goodreadsRating: [0, [Validators.required, Validators.min(0)]],
goodreadsReviewCount: [0, [Validators.required, Validators.min(0)]],
hardcoverRating: [0, [Validators.required, Validators.min(0)]],
hardcoverReviewCount: [0, [Validators.required, Validators.min(0)]],
doubanRating: [0, [Validators.required, Validators.min(0)]],
doubanReviewCount: [0, [Validators.required, Validators.min(0)]],
ranobedbRating: [0, [Validators.required, Validators.min(0)]],
audibleRating: [0, [Validators.required, Validators.min(0)]],
audibleReviewCount: [0, [Validators.required, Validators.min(0)]],
coverImage: [0, [Validators.required, Validators.min(0)]],
});
const settings = this.appSettingsService.appSettings();
if (settings?.metadataMatchWeights) {
this.form.patchValue(settings.metadataMatchWeights);
}
}
get orderedKeys(): string[] {
return this.orderedFieldKeys;
}
getFieldLabel(key: string): string {
return this.t.translate('settingsMeta.matchWeights.fields.' + key);
}
save(): void {
if (this.form.invalid) return;
this.isSaving = true;
const payload = [
{
key: AppSettingKey.METADATA_MATCH_WEIGHTS,
newValue: this.form.value
}
];
this.appSettingsService.saveSettings(payload).subscribe({
next: () => {
this.messageService.add({
severity: 'success',
summary: this.t.translate('common.success'),
detail: this.t.translate('settingsMeta.matchWeights.saveSuccess')
});
this.isSaving = false;
},
error: () => {
this.messageService.add({
severity: 'error',
summary: this.t.translate('common.error'),
detail: this.t.translate('settingsMeta.matchWeights.saveError')
});
this.isSaving = false;
}
});
}
recalculate(): void {
this.isRecalculating = true;
this.weightsService.recalculateAll().subscribe({
next: () => {
this.messageService.add({
severity: 'success',
summary: this.t.translate('common.success'),
detail: this.t.translate('settingsMeta.matchWeights.recalcSuccess')
});
this.isRecalculating = false;
},
error: () => {
this.messageService.add({
severity: 'error',
summary: this.t.translate('common.error'),
detail: this.t.translate('settingsMeta.matchWeights.recalcError')
});
this.isRecalculating = false;
}
});
}
}