Image Upload, spinner aktivirt, listings & details überarbeitet

This commit is contained in:
2024-03-18 18:17:04 +01:00
parent 2b27ab8ba5
commit fd91adda57
31 changed files with 582 additions and 263 deletions

View File

@@ -1,11 +1,14 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, debounceTime, distinctUntilChanged, map, shareReplay } from 'rxjs';
import { BehaviorSubject, Observable, debounceTime, distinctUntilChanged, map, shareReplay } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class LoadingService {
public loading$ = new BehaviorSubject<string[]>([]);
private loadingTextSubject = new BehaviorSubject<string | null>(null);
loadingText$: Observable<string | null> = this.loadingTextSubject.asObservable();
public isLoading$ = this.loading$.asObservable().pipe(
map((loading) => loading.length > 0),
@@ -14,15 +17,21 @@ export class LoadingService {
shareReplay(1)
);
public startLoading(type: string): void {
public startLoading(type: string,request:string): void {
if (!this.loading$.value.includes(type)) {
this.loading$.next(this.loading$.value.concat(type));
if (request.includes('uploadPropertyPicture')) {
this.loadingTextSubject.next("Please wait - we're processing your image...");
} else {
this.loadingTextSubject.next(null);
}
}
}
public stopLoading(type: string): void {
if (this.loading$.value.includes(type)) {
this.loading$.next(this.loading$.value.filter((t) => t !== type));
this.loadingTextSubject.next(null);
}
}
}