Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/migrate register page component to standalone (#5393)

Bernardo Jordão66ee2c13bb41
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 717cf28139..c1d8adeec4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Refactored the register page to standalone
- Migrated the login with access token dialog from `ngModel` to form control
## 2.193.0 - 2025-08-22
diff --git a/apps/client/src/app/app-routing.module.ts b/apps/client/src/app/app-routing.module.ts
index 70d4f8b30b..549a671f70 100644
--- a/apps/client/src/app/app-routing.module.ts
+++ b/apps/client/src/app/app-routing.module.ts
@@ -120,9 +120,7 @@ const routes: Routes = [
{
path: publicRoutes.register.path,
loadChildren: () =>
- import('./pages/register/register-page.module').then(
- (m) => m.RegisterPageModule
- )
+ import('./pages/register/register-page.routes').then((m) => m.routes)
},
{
path: publicRoutes.resources.path,
diff --git a/apps/client/src/app/pages/register/register-page-routing.module.ts b/apps/client/src/app/pages/register/register-page-routing.module.ts
deleted file mode 100644
index 1573029991..0000000000
--- a/apps/client/src/app/pages/register/register-page-routing.module.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
-import { publicRoutes } from '@ghostfolio/common/routes/routes';
-
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { RegisterPageComponent } from './register-page.component';
-
-const routes: Routes = [
- {
- canActivate: [AuthGuard],
- component: RegisterPageComponent,
- path: '',
- title: publicRoutes.register.title
- }
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
-})
-export class RegisterPageRoutingModule {}
diff --git a/apps/client/src/app/pages/register/register-page.component.ts b/apps/client/src/app/pages/register/register-page.component.ts
index 11b81c32a1..35b9d5cd2b 100644
--- a/apps/client/src/app/pages/register/register-page.component.ts
+++ b/apps/client/src/app/pages/register/register-page.component.ts
@@ -3,26 +3,39 @@ import { InternetIdentityService } from '@ghostfolio/client/services/internet-id
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
import { InfoItem, LineChartItem } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
+import { GfLogoComponent } from '@ghostfolio/ui/logo';
-import { Component, OnDestroy, OnInit } from '@angular/core';
+import {
+ Component,
+ CUSTOM_ELEMENTS_SCHEMA,
+ OnDestroy,
+ OnInit
+} from '@angular/core';
+import { MatButtonModule } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
-import { Router } from '@angular/router';
+import { Router, RouterModule } from '@angular/router';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { ShowAccessTokenDialogParams } from './show-access-token-dialog/interfaces/interfaces';
import { ShowAccessTokenDialog } from './show-access-token-dialog/show-access-token-dialog.component';
+import { ShowAccessTokenDialogModule } from './show-access-token-dialog/show-access-token-dialog.module';
@Component({
host: { class: 'page' },
+ imports: [
+ GfLogoComponent,
+ MatButtonModule,
+ RouterModule,
+ ShowAccessTokenDialogModule
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
selector: 'gf-register-page',
styleUrls: ['./register-page.scss'],
- templateUrl: './register-page.html',
- standalone: false
+ templateUrl: './register-page.html'
})
-export class RegisterPageComponent implements OnDestroy, OnInit {
- public demoAuthToken: string;
+export class GfRegisterPageComponent implements OnDestroy, OnInit {
public deviceType: string;
public hasPermissionForSocialLogin: boolean;
public hasPermissionForSubscription: boolean;
@@ -46,18 +59,20 @@ export class RegisterPageComponent implements OnDestroy, OnInit {
}
public ngOnInit() {
- const { demoAuthToken, globalPermissions } = this.dataService.fetchInfo();
+ const { globalPermissions } = this.dataService.fetchInfo();
- this.demoAuthToken = demoAuthToken;
this.deviceType = this.deviceService.getDeviceInfo().deviceType;
+
this.hasPermissionForSocialLogin = hasPermission(
globalPermissions,
permissions.enableSocialLogin
);
+
this.hasPermissionForSubscription = hasPermission(
globalPermissions,
permissions.enableSubscription
);
+
this.hasPermissionToCreateUser = hasPermission(
globalPermissions,
permissions.createUserAccount
diff --git a/apps/client/src/app/pages/register/register-page.module.ts b/apps/client/src/app/pages/register/register-page.module.ts
deleted file mode 100644
index 5ce8e3ed91..0000000000
--- a/apps/client/src/app/pages/register/register-page.module.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { GfLogoComponent } from '@ghostfolio/ui/logo';
-
-import { CommonModule } from '@angular/common';
-import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
-import { MatButtonModule } from '@angular/material/button';
-import { RouterModule } from '@angular/router';
-import { IonIcon } from '@ionic/angular/standalone';
-
-import { RegisterPageRoutingModule } from './register-page-routing.module';
-import { RegisterPageComponent } from './register-page.component';
-import { ShowAccessTokenDialogModule } from './show-access-token-dialog/show-access-token-dialog.module';
-
-@NgModule({
- declarations: [RegisterPageComponent],
- imports: [
- CommonModule,
- GfLogoComponent,
- IonIcon,
- MatButtonModule,
- RegisterPageRoutingModule,
- RouterModule,
- ShowAccessTokenDialogModule
- ],
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
-})
-export class RegisterPageModule {}
diff --git a/apps/client/src/app/pages/register/register-page.routes.ts b/apps/client/src/app/pages/register/register-page.routes.ts
new file mode 100644
index 0000000000..ca5b00376a
--- /dev/null
+++ b/apps/client/src/app/pages/register/register-page.routes.ts
@@ -0,0 +1,15 @@
+import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
+import { publicRoutes } from '@ghostfolio/common/routes/routes';
+
+import { Routes } from '@angular/router';
+
+import { GfRegisterPageComponent } from './register-page.component';
+
+export const routes: Routes = [
+ {
+ canActivate: [AuthGuard],
+ component: GfRegisterPageComponent,
+ path: '',
+ title: publicRoutes.register.title
+ }
+];