diff --git a/src/app/layout/common/post/post.component.ts b/src/app/layout/common/post/post.component.ts index e737d73..8a342c8 100644 --- a/src/app/layout/common/post/post.component.ts +++ b/src/app/layout/common/post/post.component.ts @@ -179,7 +179,7 @@ export class PostComponent implements OnDestroy { }); } - + trackByToken(index: number, item: any): any { return item.id || index; } diff --git a/src/app/layout/common/user/user.component.html b/src/app/layout/common/user/user.component.html index 1972b42..f3b4728 100644 --- a/src/app/layout/common/user/user.component.html +++ b/src/app/layout/common/user/user.component.html @@ -10,32 +10,32 @@ - - - - - - - + + + + + + + + + + + diff --git a/src/app/layout/common/user/user.component.ts b/src/app/layout/common/user/user.component.ts index 6fa04e4..174fe76 100644 --- a/src/app/layout/common/user/user.component.ts +++ b/src/app/layout/common/user/user.component.ts @@ -22,6 +22,7 @@ import { Router, RouterModule } from '@angular/router'; import { StorageService } from 'app/services/storage.service'; import { SignerService } from 'app/services/signer.service'; import { NostrLoginService } from 'app/services/nostr-login.service'; +import { AuthService } from 'app/services/auth.service'; @Component({ selector: 'user', @@ -49,13 +50,17 @@ export class UserComponent { private router = inject(Router); private sanitizer = inject(DomSanitizer); private nostrLoginService = inject(NostrLoginService); + public authService = inject(AuthService); constructor() { // Initialize userPubKey signal this.userPubKey.set(this.signerService.getPublicKey()); - // Load user profile - this.loadUserProfile(); + // Check if user is logged in + if (this.authService.isLoggedIn()) { + // Load user profile + this.loadUserProfile(); + } // Subscribe to configuration changes effect(() => { @@ -89,7 +94,7 @@ export class UserComponent { Switch(): void { this.nostrLoginService.switchAccount(); } - + profile(): void { this.router.navigate(['/profile']); } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index de372fc..3eca8b7 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -9,30 +9,30 @@ import { AngorConfirmationService } from '@angor/services/confirmation'; export class AuthService { private signerService = inject(SignerService); private router = inject(Router); + private angorConfirmationService = inject(AngorConfirmationService); // Ensure this is injected here isLoggedIn(): boolean { return !!this.signerService.getPublicKey(); } promptLogin(): void { - const angorConfirmationService = inject(AngorConfirmationService); - const dialogRef = angorConfirmationService.open({ - title: 'Login Required', - message: 'You need to be logged in to perform this action. Would you like to login now?', + const dialogRef = this.angorConfirmationService.open({ + title: 'Login', + message: 'Would you like to login now?', icon: { show: true, - name: 'heroicons_solid:login', + name: 'heroicons_solid:user', color: 'primary', }, actions: { confirm: { show: true, - label: 'Login', + label: 'Yes, Login', color: 'primary', }, cancel: { show: true, - label: 'Cancel', + label: 'No, Thanks', }, }, dismissible: true,