From 8477ca33158d436b805aaaf80b7c0c78a8cfa525 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Jan 2024 09:20:33 +0100 Subject: [PATCH] Refactoring --- .../portfolio-performance.component.html | 8 +++----- .../portfolio-performance.component.ts | 2 +- .../create-or-update-access-dialog.component.ts | 4 ++-- libs/common/src/lib/interfaces/access.interface.ts | 3 ++- libs/common/src/lib/types/access-type.type.ts | 1 + libs/common/src/lib/types/index.ts | 2 ++ libs/ui/src/lib/value/value.component.html | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 libs/common/src/lib/types/access-type.type.ts diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html index 0325683be..77c643c3a 100644 --- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html +++ b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html @@ -1,14 +1,12 @@
-
+
@if (errors?.length > 0 && !isLoading) { }
diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts index 4ff1677a2..f8e96471c 100644 --- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts +++ b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts @@ -70,7 +70,7 @@ export class PortfolioPerformanceComponent implements OnChanges, OnInit { } ).start(); } else { - this.value.nativeElement.innerHTML = '***'; + this.value.nativeElement.innerHTML = '*****'; } } } diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts index 4afde8031..0e3c5533e 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts @@ -42,11 +42,11 @@ export class CreateOrUpdateAccessDialog implements OnDestroy { userId: [this.data.access.grantee, Validators.required] }); - this.accessForm.get('type').valueChanges.subscribe((value) => { + this.accessForm.get('type').valueChanges.subscribe((accessType) => { const permissionsControl = this.accessForm.get('permissions'); const userIdControl = this.accessForm.get('userId'); - if (value === 'PRIVATE') { + if (accessType === 'PRIVATE') { permissionsControl.setValidators(Validators.required); userIdControl.setValidators(Validators.required); } else { diff --git a/libs/common/src/lib/interfaces/access.interface.ts b/libs/common/src/lib/interfaces/access.interface.ts index cfed7bde6..092978942 100644 --- a/libs/common/src/lib/interfaces/access.interface.ts +++ b/libs/common/src/lib/interfaces/access.interface.ts @@ -1,3 +1,4 @@ +import { AccessType } from '@ghostfolio/common/types'; import { AccessPermission } from '@prisma/client'; export interface Access { @@ -5,5 +6,5 @@ export interface Access { grantee?: string; id: string; permissions: AccessPermission[]; - type: 'PRIVATE' | 'PUBLIC'; + type: AccessType; } diff --git a/libs/common/src/lib/types/access-type.type.ts b/libs/common/src/lib/types/access-type.type.ts new file mode 100644 index 000000000..fa8e966aa --- /dev/null +++ b/libs/common/src/lib/types/access-type.type.ts @@ -0,0 +1 @@ +export type AccessType = 'PRIVATE' | 'PUBLIC'; diff --git a/libs/common/src/lib/types/index.ts b/libs/common/src/lib/types/index.ts index e99bd50b6..f1ea770d2 100644 --- a/libs/common/src/lib/types/index.ts +++ b/libs/common/src/lib/types/index.ts @@ -1,3 +1,4 @@ +import type { AccessType } from './access-type.type'; import type { AccessWithGranteeUser } from './access-with-grantee-user.type'; import type { AccountWithPlatform } from './account-with-platform.type'; import type { AccountWithValue } from './account-with-value.type'; @@ -18,6 +19,7 @@ import type { UserWithSettings } from './user-with-settings.type'; import type { ViewMode } from './view-mode.type'; export type { + AccessType, AccessWithGranteeUser, AccountWithPlatform, AccountWithValue, diff --git a/libs/ui/src/lib/value/value.component.html b/libs/ui/src/lib/value/value.component.html index 6ee6fc876..b6dfd3bde 100644 --- a/libs/ui/src/lib/value/value.component.html +++ b/libs/ui/src/lib/value/value.component.html @@ -32,7 +32,7 @@ }" > - *** + ***** {{ formattedValue }}