From 576b0fadc3e70dbcbb2e839d8b742840b75f1697 Mon Sep 17 00:00:00 2001 From: Milad Raeisi Date: Thu, 31 Oct 2024 06:43:26 +0400 Subject: [PATCH] Rename register to create --- src/app/app.config.ts | 5 ++--- src/app/app.routes.ts | 4 ++-- .../create.component.html} | 4 ++-- .../create.component.ts} | 4 ++-- .../register.routes.ts => create/create.routes.ts} | 2 +- src/app/components/auth/login/login.component.html | 4 ++-- src/app/components/profile/profile.component.ts | 12 ++++++++---- 7 files changed, 19 insertions(+), 16 deletions(-) rename src/app/components/auth/{register/register.component.html => create/create.component.html} (98%) rename src/app/components/auth/{register/register.component.ts => create/create.component.ts} (97%) rename src/app/components/auth/{register/register.routes.ts => create/create.routes.ts} (62%) diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 25475328..e70d5205 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -10,10 +10,9 @@ import { LuxonDateAdapter } from '@angular/material-luxon-adapter'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { provideAnimations } from '@angular/platform-browser/animations'; import { - PreloadAllModules, - provideRouter, + provideRouter, withInMemoryScrolling, - + } from '@angular/router'; import { provideServiceWorker } from '@angular/service-worker'; import { TranslocoService, provideTransloco } from '@ngneat/transloco'; diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 5dcf5813..3a70c602 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -39,9 +39,9 @@ export const appRoutes: Route[] = [ import('app/components/auth/login/login.routes'), }, { - path: 'register', + path: 'create', loadChildren: () => - import('app/components/auth/register/register.routes'), + import('app/components/auth/create/create.routes'), }, ], }, diff --git a/src/app/components/auth/register/register.component.html b/src/app/components/auth/create/create.component.html similarity index 98% rename from src/app/components/auth/register/register.component.html rename to src/app/components/auth/create/create.component.html index 74f3b31a..0caaca56 100644 --- a/src/app/components/auth/register/register.component.html +++ b/src/app/components/auth/create/create.component.html @@ -9,7 +9,7 @@
- Register + Create account
Already have an account?
@@ -97,7 +97,7 @@ [disabled]="!registerForm.valid || !generatedKeys" (click)="register()" > - Create your account + Create account Don't have an account?
RegisterCreate account diff --git a/src/app/components/profile/profile.component.ts b/src/app/components/profile/profile.component.ts index 17788333..6263d2bc 100644 --- a/src/app/components/profile/profile.component.ts +++ b/src/app/components/profile/profile.component.ts @@ -250,24 +250,28 @@ export class ProfileComponent implements OnInit, OnDestroy { { authors: [pubKey], kinds: [0], limit: 1 } ]; - this.subscriptionId = this._subscriptionService.addSubscriptions(filters, async (event: NostrEvent) => { try { - const newMetadata = JSON.parse(event.content); this.profileUser = newMetadata; + // Set followers and following counts, ensure they're integers and not null or undefined + this.followersCount = newMetadata.followersCount ?? 0; + this.followingCount = newMetadata.followingCount ?? 0; + // Save profile data await this._storageService.saveProfile(pubKey, newMetadata); - - this._changeDetectorRef.detectChanges(); + // Mark for check to force UI update + this._changeDetectorRef.markForCheck(); } catch (error) { console.error('Error processing metadata event:', error); } }); } + + getSafeUrl(url: string): SafeUrl { return this._sanitizer.bypassSecurityTrustUrl(url); }