diff --git a/frontend/src/app/components/about/about.component.html b/frontend/src/app/components/about/about.component.html index 55f406d00..b9309c916 100644 --- a/frontend/src/app/components/about/about.component.html +++ b/frontend/src/app/components/about/about.component.html @@ -34,7 +34,7 @@

Support the Project

- Become a Sponsor! + Become a Sponsor!
diff --git a/frontend/src/app/shared/components/global-footer/global-footer.component.html b/frontend/src/app/shared/components/global-footer/global-footer.component.html index 8e5279a94..30727e662 100644 --- a/frontend/src/app/shared/components/global-footer/global-footer.component.html +++ b/frontend/src/app/shared/components/global-footer/global-footer.component.html @@ -14,8 +14,12 @@
- -

Sign In

+
+
Logged in as {{ username}}
+ + +
+

Sign In

Broadcast Transaction

Connect to our Nodes

diff --git a/frontend/src/app/shared/components/global-footer/global-footer.component.ts b/frontend/src/app/shared/components/global-footer/global-footer.component.ts index d4f1946ea..cdb0f1159 100644 --- a/frontend/src/app/shared/components/global-footer/global-footer.component.ts +++ b/frontend/src/app/shared/components/global-footer/global-footer.component.ts @@ -1,10 +1,13 @@ -import { ChangeDetectionStrategy, Component, OnInit, Inject, LOCALE_ID } from '@angular/core'; -import { Observable, merge, of, Subject } from 'rxjs'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject, LOCALE_ID } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Observable, merge, of, Subject, Subscription } from 'rxjs'; import { tap, takeUntil } from 'rxjs/operators'; import { Env, StateService } from '../../../services/state.service'; import { IBackendInfo } from '../../../interfaces/websocket.interface'; import { LanguageService } from '../../../services/language.service'; import { NavigationService } from '../../../services/navigation.service'; +import { StorageService } from '../../../services/storage.service'; +import { WebsocketService } from '../../../services/websocket.service'; @Component({ selector: 'app-global-footer', @@ -23,12 +26,19 @@ export class GlobalFooterComponent implements OnInit { network$: Observable; networkPaths: { [network: string]: string }; currentNetwork = ''; + loggedIn = false; + username = null; + urlSubscription: Subscription; constructor( public stateService: StateService, private languageService: LanguageService, private navigationService: NavigationService, @Inject(LOCALE_ID) public locale: string, + private storageService: StorageService, + private route: ActivatedRoute, + private cd: ChangeDetectorRef, + private websocketService: WebsocketService ) {} ngOnInit(): void { @@ -46,11 +56,23 @@ export class GlobalFooterComponent implements OnInit { this.network$.pipe(takeUntil(this.destroy$)).subscribe((network) => { this.currentNetwork = network; }); + + this.urlSubscription = this.route.url.subscribe((url) => { + this.loggedIn = JSON.parse(this.storageService.getValue('auth')) !== null; + const auth = JSON.parse(this.storageService.getValue('auth')); + if (auth?.user?.username) { + this.username = auth.user.username; + } else { + this.username = null; + } + this.cd.markForCheck(); + }) } ngOnDestroy(): void { this.destroy$.next(true); this.destroy$.complete(); + this.urlSubscription.unsubscribe(); } networkLink(network) {