Refactor application structure to use WorkspaceService for state management

- Removed direct state management from components and centralized it in WorkspaceService.
- Updated ApartmentsPage, TenantsPage, LeasesPage, and DashboardPage to utilize WorkspaceService for data handling.
- Introduced SessionService to manage user session state and authentication.
- Simplified component templates to reflect new service-based architecture.
- Removed unused ConfigService and its tests.
- Added lease.html template for lease document generation.
- Created app.routes.spec.ts for route mapping tests.
This commit is contained in:
nessar authored and Nessar committed 2026-08-17 14:18:15 +02:00
1 parent be1f680a62
commit 82f339e209
33 files changed
+292 -929

No files matched your search

@@ -9,9 +9,8 @@
mat-button
type="button"
class="navigation-item"
[class.active]="activeTab() === 'dashboard'"
[attr.aria-current]="activeTab() === 'dashboard' ? 'page' : null"
(click)="tabSelected.emit('dashboard')"
routerLink="/dashboard"
routerLinkActive="active"
>
<svg
viewBox="0 0 24 24"
@@ -31,9 +30,8 @@
mat-button
type="button"
class="navigation-item"
[class.active]="activeTab() === 'apartments'"
[attr.aria-current]="activeTab() === 'apartments' ? 'page' : null"
(click)="tabSelected.emit('apartments')"
routerLink="/apartments"
routerLinkActive="active"
>
<svg
viewBox="0 0 24 24"
@@ -51,9 +49,8 @@
mat-button
type="button"
class="navigation-item"
[class.active]="activeTab() === 'tenants'"
[attr.aria-current]="activeTab() === 'tenants' ? 'page' : null"
(click)="tabSelected.emit('tenants')"
routerLink="/tenants"
routerLinkActive="active"
>
<svg
viewBox="0 0 24 24"
@@ -73,9 +70,8 @@
mat-button
type="button"
class="navigation-item"
[class.active]="activeTab() === 'leases'"
[attr.aria-current]="activeTab() === 'leases' ? 'page' : null"
(click)="tabSelected.emit('leases')"
routerLink="/leases"
routerLinkActive="active"
>
<svg
viewBox="0 0 24 24"
@@ -93,9 +89,8 @@
mat-button
type="button"
class="navigation-item"
[class.active]="activeTab() === 'settings'"
[attr.aria-current]="activeTab() === 'settings' ? 'page' : null"
(click)="tabSelected.emit('settings')"
routerLink="/settings"
routerLinkActive="active"
>
<svg
viewBox="0 0 24 24"
@@ -116,8 +111,8 @@
<div class="sidebar-user">
<div class="compact-avatar">{{ userInitial() }}</div>
<div>
<strong>{{ username() }}</strong
><span>{{ email() }}</span>
<strong>{{ session.username() }}</strong
><span>{{ session.email() }}</span>
</div>
<button mat-button type="button" class="logout-action" (click)="logoutRequested.emit()">
Déconnexion
@@ -1,20 +1,18 @@
import { Component, input, output } from '@angular/core';
import { Component, inject, input, output } from '@angular/core';
import { RouterLink, RouterLinkActive } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
import { BrandMark } from '../brand-mark';
export type WorkspaceTab = 'dashboard' | 'apartments' | 'tenants' | 'leases' | 'settings';
import { SessionService } from '../../services/session.service';
@Component({
selector: 'app-workspace-navigation',
imports: [BrandMark, MatButtonModule],
imports: [BrandMark, MatButtonModule, RouterLink, RouterLinkActive],
templateUrl: './workspace-navigation.html',
styleUrl: './workspace-navigation.css',
})
export class WorkspaceNavigation {
readonly activeTab = input.required<WorkspaceTab>();
readonly username = input.required<string>();
readonly email = input.required<string>();
readonly userInitial = input.required<string>();
readonly tabSelected = output<WorkspaceTab>();
readonly logoutRequested = output<void>();
readonly session = inject(SessionService);
}