chore: add husky pre-commit hook and lint-staged configuration

- Created a pre-commit hook in .husky to run lint-staged.
- Added .lintstagedrc.mjs to format frontend files with Prettier and apply Spotless to backend Java files.
- Introduced .prettierignore to exclude specific directories from formatting.
This commit is contained in:
nessar committed 2026-08-17 14:18:16 +02:00
1 parent 5d2d85aa8c
commit 878da155bd
564 files changed
+61467 -47179

No files matched your search

@@ -1,123 +1,123 @@
:host {
display: block;
display: block;
}
.empty-illustration {
display: grid;
width: 68px;
height: 68px;
place-items: center;
margin: 0 auto 22px;
border-radius: 16px;
background: var(--surface-accent);
color: var(--accent);
display: grid;
width: 68px;
height: 68px;
place-items: center;
margin: 0 auto 22px;
border-radius: 16px;
background: var(--surface-accent);
color: var(--accent);
}
.empty-illustration fa-icon {
display: flex;
width: 34px;
height: 34px;
display: flex;
width: 34px;
height: 34px;
}
.empty-illustration fa-icon svg {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.empty-state > p:not(.eyebrow) {
max-width: 440px;
margin: 0 auto 22px;
line-height: 1.6;
max-width: 440px;
margin: 0 auto 22px;
line-height: 1.6;
}
.apartments-grid {
display: grid;
grid-template-columns: 1fr;
gap: 16px;
display: grid;
grid-template-columns: 1fr;
gap: 16px;
}
.apartment-card-topline {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 14px;
margin-bottom: 22px;
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 14px;
margin-bottom: 22px;
}
.property-label {
margin: 0;
margin: 0;
}
.property-value {
font-size: 1rem;
font-weight: 800;
font-size: 1rem;
font-weight: 800;
}
.apt-info h2 {
margin-bottom: 9px;
font-size: 1.35rem;
letter-spacing: -0.035em;
margin-bottom: 9px;
font-size: 1.35rem;
letter-spacing: -0.035em;
}
.apt-address {
display: flex;
align-items: flex-start;
gap: 8px;
margin-bottom: 12px;
color: var(--text-muted);
font-size: 0.88rem;
line-height: 1.5;
display: flex;
align-items: flex-start;
gap: 8px;
margin-bottom: 12px;
color: var(--text-muted);
font-size: 0.88rem;
line-height: 1.5;
}
.apt-address fa-icon {
display: flex;
width: 17px;
height: 17px;
flex: 0 0 17px;
margin-top: 2px;
display: flex;
width: 17px;
height: 17px;
flex: 0 0 17px;
margin-top: 2px;
}
.apt-address fa-icon svg {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.apt-desc {
margin-bottom: 0;
color: var(--text-muted);
font-size: 0.88rem;
line-height: 1.55;
margin-bottom: 0;
color: var(--text-muted);
font-size: 0.88rem;
line-height: 1.55;
}
.apt-actions {
display: flex;
gap: 4px;
justify-content: flex-end;
margin-top: 20px;
padding-top: 12px;
border-top: 1px solid var(--border);
display: flex;
gap: 4px;
justify-content: flex-end;
margin-top: 20px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.apt-actions .mat-mdc-button {
--mdc-text-button-label-text-color: var(--accent);
--mdc-text-button-label-text-color: var(--accent);
}
.apt-actions .danger-action.mat-mdc-button {
--mdc-text-button-label-text-color: var(--danger);
--mdc-text-button-label-text-color: var(--danger);
}
.card-error {
margin: 14px 0 0;
margin: 14px 0 0;
}
@media (min-width: 700px) {
.apartments-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.apartments-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (min-width: 1180px) {
.apartments-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.apartments-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@@ -11,82 +11,102 @@
<div class="content-region" [attr.aria-busy]="loadState().loading">
@if (loadState().loaded && loadState().loading) {
<mat-progress-bar mode="indeterminate" aria-label="Actualisation des appartements" />
<mat-progress-bar mode="indeterminate" aria-label="Actualisation des appartements" />
}
@if (loadState().loaded && loadState().error) {
<div class="refresh-error" role="alert">
<p>{{ loadState().error }}</p>
<button mat-button type="button" (click)="retryRequested.emit()">Réessayer</button>
</div>
<div class="refresh-error" role="alert">
<p>{{ loadState().error }}</p>
<button mat-button type="button" (click)="retryRequested.emit()">Réessayer</button>
</div>
}
@if (!loadState().loaded && loadState().loading) {
<div class="apartments-grid loading-region" aria-busy="true" aria-label="Chargement des appartements">
@for (placeholder of [1, 2, 3]; track placeholder) {
<article class="apartment-card skeleton-card" aria-hidden="true">
<span class="skeleton-line skeleton-line-short"></span>
<span class="skeleton-line skeleton-line-title"></span>
<span class="skeleton-line"></span>
<span class="skeleton-line skeleton-line-medium"></span>
</article>
}
</div>
} @else if (!loadState().loaded && loadState().error) {
<article class="load-error" role="alert">
<h2>Chargement impossible</h2>
<p>{{ loadState().error }}</p>
<button mat-stroked-button type="button" (click)="retryRequested.emit()">Réessayer</button>
</article>
} @else if (apartments().length === 0) {
<article class="empty-state">
<div class="empty-illustration" aria-hidden="true">
<fa-icon [icon]="faHouse" />
</div>
<p class="eyebrow">Commencez ici</p>
<h2>Aucun appartement enregistré</h2>
<p>Ajoutez votre premier bien pour construire votre portefeuille.</p>
<button mat-stroked-button type="button" (click)="addRequested.emit()">
Ajouter un appartement
</button>
</article>
} @else {
<div class="apartments-grid">
@for (apt of apartments(); track apt.id) {
<article class="apartment-card" [attr.aria-busy]="!!apt.id && deletingIds().has(apt.id)">
<div class="apartment-card-topline">
<span class="property-label">Bien immobilier</span>
<span class="property-value">{{ apt.purchasePrice.toLocaleString('fr-FR') }} €</span>
</div>
<div class="apt-info">
<h2>{{ apt.name }}</h2>
<p class="apt-address">
<fa-icon [icon]="faLocationDot" aria-hidden="true" />
{{ apt.address }}
</p>
@if (apt.description) {
<p class="apt-desc">{{ apt.description }}</p>
}
</div>
@if (apt.id && deleteErrors()[apt.id]) {
<p class="card-error" role="alert">{{ deleteErrors()[apt.id] }}</p>
<div
class="apartments-grid loading-region"
aria-busy="true"
aria-label="Chargement des appartements"
>
@for (placeholder of [1, 2, 3]; track placeholder) {
<article class="apartment-card skeleton-card" aria-hidden="true">
<span class="skeleton-line skeleton-line-short"></span>
<span class="skeleton-line skeleton-line-title"></span>
<span class="skeleton-line"></span>
<span class="skeleton-line skeleton-line-medium"></span>
</article>
}
<div class="apt-actions" aria-live="polite">
<button mat-button type="button" [disabled]="!!apt.id && deletingIds().has(apt.id)"
(click)="editRequested.emit(apt)">
Modifier
</button>
@if (apt.id) {
<button mat-button type="button" class="danger-action" [disabled]="deletingIds().has(apt.id)"
(click)="deleteRequested.emit(apt.id)">
@if (deletingIds().has(apt.id)) {
<mat-spinner diameter="16" aria-hidden="true" /> Suppression…
} @else {
Supprimer
}
</button>
}
</div>
</div>
} @else if (!loadState().loaded && loadState().error) {
<article class="load-error" role="alert">
<h2>Chargement impossible</h2>
<p>{{ loadState().error }}</p>
<button mat-stroked-button type="button" (click)="retryRequested.emit()">
Réessayer
</button>
</article>
}
</div>
} @else if (apartments().length === 0) {
<article class="empty-state">
<div class="empty-illustration" aria-hidden="true">
<fa-icon [icon]="faHouse" />
</div>
<p class="eyebrow">Commencez ici</p>
<h2>Aucun appartement enregistré</h2>
<p>Ajoutez votre premier bien pour construire votre portefeuille.</p>
<button mat-stroked-button type="button" (click)="addRequested.emit()">
Ajouter un appartement
</button>
</article>
} @else {
<div class="apartments-grid">
@for (apt of apartments(); track apt.id) {
<article
class="apartment-card"
[attr.aria-busy]="!!apt.id && deletingIds().has(apt.id)"
>
<div class="apartment-card-topline">
<span class="property-label">Bien immobilier</span>
<span class="property-value"
>{{ apt.purchasePrice.toLocaleString('fr-FR') }} €</span
>
</div>
<div class="apt-info">
<h2>{{ apt.name }}</h2>
<p class="apt-address">
<fa-icon [icon]="faLocationDot" aria-hidden="true" />
{{ apt.address }}
</p>
@if (apt.description) {
<p class="apt-desc">{{ apt.description }}</p>
}
</div>
@if (apt.id && deleteErrors()[apt.id]) {
<p class="card-error" role="alert">{{ deleteErrors()[apt.id] }}</p>
}
<div class="apt-actions" aria-live="polite">
<button
mat-button
type="button"
[disabled]="!!apt.id && deletingIds().has(apt.id)"
(click)="editRequested.emit(apt)"
>
Modifier
</button>
@if (apt.id) {
<button
mat-button
type="button"
class="danger-action"
[disabled]="deletingIds().has(apt.id)"
(click)="deleteRequested.emit(apt.id)"
>
@if (deletingIds().has(apt.id)) {
<mat-spinner diameter="16" aria-hidden="true" /> Suppression…
} @else {
Supprimer
}
</button>
}
</div>
</article>
}
</div>
}
</div>
</div>
@@ -8,20 +8,20 @@ import { Apartment } from '../../services/apartment.service';
import { LoadState } from '../../services/workspace-resource';
@Component({
selector: 'app-apartment-list',
imports: [FontAwesomeModule, MatButtonModule, MatProgressBarModule, MatProgressSpinnerModule],
templateUrl: './apartment-list.html',
styleUrl: './apartment-list.css',
selector: 'app-apartment-list',
imports: [FontAwesomeModule, MatButtonModule, MatProgressBarModule, MatProgressSpinnerModule],
templateUrl: './apartment-list.html',
styleUrl: './apartment-list.css',
})
export class ApartmentList {
readonly faHouse = faHouse;
readonly faLocationDot = faLocationDot;
readonly apartments = input.required<Apartment[]>();
readonly loadState = input.required<LoadState>();
readonly deletingIds = input<ReadonlySet<string>>(new Set());
readonly deleteErrors = input<Record<string, string>>({});
readonly addRequested = output<void>();
readonly editRequested = output<Apartment>();
readonly deleteRequested = output<string>();
readonly retryRequested = output<void>();
readonly faHouse = faHouse;
readonly faLocationDot = faLocationDot;
readonly apartments = input.required<Apartment[]>();
readonly loadState = input.required<LoadState>();
readonly deletingIds = input<ReadonlySet<string>>(new Set());
readonly deleteErrors = input<Record<string, string>>({});
readonly addRequested = output<void>();
readonly editRequested = output<Apartment>();
readonly deleteRequested = output<string>();
readonly retryRequested = output<void>();
}