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

+2 -52
View File
@@ -1,13 +1,9 @@
@if (!isLoggedIn) {
@if (!session.isLoggedIn()) {
<app-sign-in-page (loginRequested)="login()" />
} @else {
<div class="workspace-shell">
<app-workspace-navigation
[activeTab]="activeTab()"
[username]="username"
[email]="email"
[userInitial]="userInitial()"
(tabSelected)="activeTab.set($event)"
(logoutRequested)="logout()"
/>
@@ -21,53 +17,7 @@
</header>
<div class="page-container">
@if (activeTab() === 'dashboard') {
<app-dashboard-page
[username]="username"
[email]="email"
[userInitial]="userInitial()"
[apartmentCount]="apartments().length"
[helloMessage]="helloMessage()"
(apartmentsRequested)="activeTab.set('apartments')"
(connectionCheckRequested)="callHelloApi()"
/>
}
@if (activeTab() === 'apartments') {
<app-apartments-page
[apartments]="apartments()"
(deleteRequested)="deleteApartment($event)"
(apartmentSaved)="saveApartment($event)"
/>
}
@if (activeTab() === 'tenants') {
<app-tenants-page
[tenants]="tenants()"
[attachmentError]="tenantAttachmentError()"
(tenantSaved)="saveTenant($event)"
(deleteRequested)="deleteTenant($event)"
(attachmentUploadRequested)="uploadTenantAttachment($event)"
(attachmentDownloadRequested)="downloadTenantAttachment($event)"
/>
}
@if (activeTab() === 'leases') {
<app-leases-page
[leases]="leases()"
[apartments]="apartments()"
[tenants]="tenants()"
(leaseSaved)="saveLease($event)"
(deleteRequested)="deleteLease($event)"
(pdfRequested)="downloadLeasePdf($event)"
/>
}
@if (activeTab() === 'settings') {
<app-settings-page
[username]="username"
[email]="email"
[themePreference]="themePreference()"
(themePreferenceChanged)="themeService.setPreference($event)"
(logoutRequested)="logout()"
/>
}
<router-outlet />
</div>
</main>
</div>