Browse Source

code review changes

pull/5117/head
Attila Cseh 2 months ago
parent
commit
37509bad3b
  1. 2
      CHANGELOG.md
  2. 12
      apps/client/src/app/pages/accounts/accounts-page.component.ts
  3. 4
      apps/client/src/app/pages/accounts/accounts-page.routes.ts
  4. 6
      apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
  5. 6
      apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

2
CHANGELOG.md

@ -10,8 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the language localization in the users table of the admin control panel - Improved the language localization in the users table of the admin control panel
- Refactored the portfolio pages to standalone
- Refactored the accounts pages to standalone - Refactored the accounts pages to standalone
- Refactored the portfolio pages to standalone
- Renamed `Settings` to `settings` in the `User` database schema - Renamed `Settings` to `settings` in the `User` database schema
- Improved the language localization for Catalan (`ca`) - Improved the language localization for Catalan (`ca`)
- Improved the language localization for Dutch (`nl`) - Improved the language localization for Dutch (`nl`)

12
apps/client/src/app/pages/accounts/accounts-page.component.ts

@ -23,8 +23,8 @@ import { DeviceDetectorService } from 'ngx-device-detector';
import { EMPTY, Subject, Subscription } from 'rxjs'; import { EMPTY, Subject, Subscription } from 'rxjs';
import { catchError, takeUntil } from 'rxjs/operators'; import { catchError, takeUntil } from 'rxjs/operators';
import { CreateOrUpdateAccountDialog } from './create-or-update-account-dialog/create-or-update-account-dialog.component'; import { GfCreateOrUpdateAccountDialogComponent } from './create-or-update-account-dialog/create-or-update-account-dialog.component';
import { TransferBalanceDialog } from './transfer-balance/transfer-balance-dialog.component'; import { GfTransferBalanceDialogComponent } from './transfer-balance/transfer-balance-dialog.component';
@Component({ @Component({
host: { class: 'has-fab page' }, host: { class: 'has-fab page' },
@ -38,7 +38,7 @@ import { TransferBalanceDialog } from './transfer-balance/transfer-balance-dialo
styleUrls: ['./accounts-page.scss'], styleUrls: ['./accounts-page.scss'],
templateUrl: './accounts-page.html' templateUrl: './accounts-page.html'
}) })
export class AccountsPageComponent implements OnDestroy, OnInit { export class GfAccountsPageComponent implements OnDestroy, OnInit {
public accounts: AccountModel[]; public accounts: AccountModel[];
public deviceType: string; public deviceType: string;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
@ -185,7 +185,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
name, name,
platformId platformId
}: AccountModel) { }: AccountModel) {
const dialogRef = this.dialog.open(CreateOrUpdateAccountDialog, { const dialogRef = this.dialog.open(GfCreateOrUpdateAccountDialogComponent, {
data: { data: {
account: { account: {
balance, balance,
@ -259,7 +259,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
} }
private openCreateAccountDialog() { private openCreateAccountDialog() {
const dialogRef = this.dialog.open(CreateOrUpdateAccountDialog, { const dialogRef = this.dialog.open(GfCreateOrUpdateAccountDialogComponent, {
data: { data: {
account: { account: {
balance: 0, balance: 0,
@ -301,7 +301,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
} }
private openTransferBalanceDialog() { private openTransferBalanceDialog() {
const dialogRef = this.dialog.open(TransferBalanceDialog, { const dialogRef = this.dialog.open(GfTransferBalanceDialogComponent, {
data: { data: {
accounts: this.accounts accounts: this.accounts
}, },

4
apps/client/src/app/pages/accounts/accounts-page.routes.ts

@ -3,12 +3,12 @@ import { internalRoutes } from '@ghostfolio/common/routes/routes';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AccountsPageComponent } from './accounts-page.component'; import { GfAccountsPageComponent } from './accounts-page.component';
export const routes: Routes = [ export const routes: Routes = [
{ {
canActivate: [AuthGuard], canActivate: [AuthGuard],
component: AccountsPageComponent, component: GfAccountsPageComponent,
path: '', path: '',
title: internalRoutes.accounts.title title: internalRoutes.accounts.title
} }

6
apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts

@ -37,6 +37,7 @@ import { map, startWith } from 'rxjs/operators';
import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces'; import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'h-100' }, host: { class: 'h-100' },
imports: [ imports: [
CommonModule, CommonModule,
@ -52,11 +53,10 @@ import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces';
ReactiveFormsModule ReactiveFormsModule
], ],
selector: 'gf-create-or-update-account-dialog', selector: 'gf-create-or-update-account-dialog',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['./create-or-update-account-dialog.scss'], styleUrls: ['./create-or-update-account-dialog.scss'],
templateUrl: 'create-or-update-account-dialog.html' templateUrl: 'create-or-update-account-dialog.html'
}) })
export class CreateOrUpdateAccountDialog implements OnDestroy { export class GfCreateOrUpdateAccountDialogComponent implements OnDestroy {
public accountForm: FormGroup; public accountForm: FormGroup;
public currencies: string[] = []; public currencies: string[] = [];
public filteredPlatforms: Observable<Platform[]>; public filteredPlatforms: Observable<Platform[]>;
@ -67,7 +67,7 @@ export class CreateOrUpdateAccountDialog implements OnDestroy {
public constructor( public constructor(
@Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateAccountDialogParams, @Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateAccountDialogParams,
private dataService: DataService, private dataService: DataService,
public dialogRef: MatDialogRef<CreateOrUpdateAccountDialog>, public dialogRef: MatDialogRef<GfCreateOrUpdateAccountDialogComponent>,
private formBuilder: FormBuilder private formBuilder: FormBuilder
) {} ) {}

6
apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

@ -30,6 +30,7 @@ import { Subject } from 'rxjs';
import { TransferBalanceDialogParams } from './interfaces/interfaces'; import { TransferBalanceDialogParams } from './interfaces/interfaces';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'h-100' }, host: { class: 'h-100' },
imports: [ imports: [
GfEntityLogoComponent, GfEntityLogoComponent,
@ -41,11 +42,10 @@ import { TransferBalanceDialogParams } from './interfaces/interfaces';
ReactiveFormsModule ReactiveFormsModule
], ],
selector: 'gf-transfer-balance-dialog', selector: 'gf-transfer-balance-dialog',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['./transfer-balance-dialog.scss'], styleUrls: ['./transfer-balance-dialog.scss'],
templateUrl: 'transfer-balance-dialog.html' templateUrl: 'transfer-balance-dialog.html'
}) })
export class TransferBalanceDialog implements OnDestroy { export class GfTransferBalanceDialogComponent implements OnDestroy {
public accounts: Account[] = []; public accounts: Account[] = [];
public currency: string; public currency: string;
public transferBalanceForm: FormGroup; public transferBalanceForm: FormGroup;
@ -54,7 +54,7 @@ export class TransferBalanceDialog implements OnDestroy {
public constructor( public constructor(
@Inject(MAT_DIALOG_DATA) public data: TransferBalanceDialogParams, @Inject(MAT_DIALOG_DATA) public data: TransferBalanceDialogParams,
public dialogRef: MatDialogRef<TransferBalanceDialog>, public dialogRef: MatDialogRef<GfTransferBalanceDialogComponent>,
private formBuilder: FormBuilder private formBuilder: FormBuilder
) {} ) {}

Loading…
Cancel
Save