From f743c03e174873ec85765c3349b3ba631cfa2211 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 7 Aug 2021 07:12:40 +0200 Subject: [PATCH] Feature/restructure page hierarchy (#259) * Introduce portfolio group, remove tools * Extract allocations to separate page * Update changelog --- CHANGELOG.md | 4 + apps/client/src/app/app-routing.module.ts | 61 ++++++------ .../components/header/header.component.html | 35 +++---- .../no-transactions-info.component.html | 2 +- .../positions-table.component.html | 2 +- apps/client/src/app/pages/home/home-page.html | 2 +- .../allocations-page-routing.module.ts | 15 +++ .../allocations-page.component.ts} | 25 +---- .../allocations/allocations-page.html} | 34 ++----- .../allocations/allocations-page.module.ts} | 12 +-- .../allocations/allocations-page.scss} | 12 --- .../analysis/analysis-page-routing.module.ts | 0 .../analysis/analysis-page.component.ts | 92 +++++++++++++++++++ .../portfolio/analysis/analysis-page.html | 20 ++++ .../analysis/analysis-page.module.ts | 21 +++++ .../portfolio/analysis/analysis-page.scss | 9 ++ .../portfolio-page-routing.module.ts} | 6 +- .../portfolio/portfolio-page.component.ts | 44 +++++++++ .../app/pages/portfolio/portfolio-page.html | 83 +++++++++++++++++ .../portfolio-page.module.ts} | 12 +-- .../portfolio-page.scss} | 0 .../report/report-page-routing.module.ts | 0 .../report/report-page.component.ts | 0 .../report/report-page.html | 0 .../report/report-page.module.ts | 0 .../report/report-page.scss} | 0 ...-or-update-transaction-dialog.component.ts | 2 +- .../create-or-update-transaction-dialog.html | 0 ...ate-or-update-transaction-dialog.module.ts | 0 .../create-or-update-transaction-dialog.scss | 0 .../interfaces/interfaces.ts | 0 .../transactions-page-routing.module.ts | 0 .../transactions-page.component.ts | 0 .../transactions/transactions-page.html | 0 .../transactions/transactions-page.module.ts | 0 .../transactions/transactions-page.scss | 0 .../app/pages/tools/tools-page.component.ts | 21 ----- .../src/app/pages/tools/tools-page.html | 43 --------- apps/client/src/app/pages/zen/zen-page.html | 2 +- 39 files changed, 369 insertions(+), 190 deletions(-) create mode 100644 apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts rename apps/client/src/app/pages/{tools/analysis/analysis-page.component.ts => portfolio/allocations/allocations-page.component.ts} (91%) rename apps/client/src/app/pages/{tools/analysis/analysis-page.html => portfolio/allocations/allocations-page.html} (87%) rename apps/client/src/app/pages/{tools/analysis/analysis-page.module.ts => portfolio/allocations/allocations-page.module.ts} (68%) rename apps/client/src/app/pages/{tools/analysis/analysis-page.scss => portfolio/allocations/allocations-page.scss} (76%) rename apps/client/src/app/pages/{tools => portfolio}/analysis/analysis-page-routing.module.ts (100%) create mode 100644 apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts create mode 100644 apps/client/src/app/pages/portfolio/analysis/analysis-page.html create mode 100644 apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts create mode 100644 apps/client/src/app/pages/portfolio/analysis/analysis-page.scss rename apps/client/src/app/pages/{tools/tools-page-routing.module.ts => portfolio/portfolio-page-routing.module.ts} (59%) create mode 100644 apps/client/src/app/pages/portfolio/portfolio-page.component.ts create mode 100644 apps/client/src/app/pages/portfolio/portfolio-page.html rename apps/client/src/app/pages/{tools/tools-page.module.ts => portfolio/portfolio-page.module.ts} (61%) rename apps/client/src/app/pages/{tools/report/report-page.scss => portfolio/portfolio-page.scss} (100%) rename apps/client/src/app/pages/{tools => portfolio}/report/report-page-routing.module.ts (100%) rename apps/client/src/app/pages/{tools => portfolio}/report/report-page.component.ts (100%) rename apps/client/src/app/pages/{tools => portfolio}/report/report-page.html (100%) rename apps/client/src/app/pages/{tools => portfolio}/report/report-page.module.ts (100%) rename apps/client/src/app/pages/{tools/tools-page.scss => portfolio/report/report-page.scss} (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts (98%) rename apps/client/src/app/pages/{ => portfolio}/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.html (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.module.ts (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.scss (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/create-or-update-transaction-dialog/interfaces/interfaces.ts (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/transactions-page-routing.module.ts (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/transactions-page.component.ts (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/transactions-page.html (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/transactions-page.module.ts (100%) rename apps/client/src/app/pages/{ => portfolio}/transactions/transactions-page.scss (100%) delete mode 100644 apps/client/src/app/pages/tools/tools-page.component.ts delete mode 100644 apps/client/src/app/pages/tools/tools-page.html diff --git a/CHANGELOG.md b/CHANGELOG.md index b774d54f..cd1a0943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Changed + +- Restructured the page hierarchy + ### Fixed - Fixed an issue with the currency conversion of the market price in the position detail dialog diff --git a/apps/client/src/app/app-routing.module.ts b/apps/client/src/app/app-routing.module.ts index d08757c8..5ad41c07 100644 --- a/apps/client/src/app/app-routing.module.ts +++ b/apps/client/src/app/app-routing.module.ts @@ -52,6 +52,41 @@ const routes: Routes = [ loadChildren: () => import('./pages/home/home-page.module').then((m) => m.HomePageModule) }, + { + path: 'portfolio', + loadChildren: () => + import('./pages/portfolio/portfolio-page.module').then( + (m) => m.PortfolioPageModule + ) + }, + { + path: 'portfolio/allocations', + loadChildren: () => + import('./pages/portfolio/allocations/allocations-page.module').then( + (m) => m.AllocationsPageModule + ) + }, + { + path: 'portfolio/analysis', + loadChildren: () => + import('./pages/portfolio/analysis/analysis-page.module').then( + (m) => m.AnalysisPageModule + ) + }, + { + path: 'portfolio/report', + loadChildren: () => + import('./pages/portfolio/report/report-page.module').then( + (m) => m.ReportPageModule + ) + }, + { + path: 'portfolio/transactions', + loadChildren: () => + import('./pages/portfolio/transactions/transactions-page.module').then( + (m) => m.TransactionsPageModule + ) + }, { path: 'pricing', loadChildren: () => @@ -80,32 +115,6 @@ const routes: Routes = [ (m) => m.LandingPageModule ) }, - { - path: 'tools', - loadChildren: () => - import('./pages/tools/tools-page.module').then((m) => m.ToolsPageModule) - }, - { - path: 'tools/analysis', - loadChildren: () => - import('./pages/tools/analysis/analysis-page.module').then( - (m) => m.AnalysisPageModule - ) - }, - { - path: 'tools/report', - loadChildren: () => - import('./pages/tools/report/report-page.module').then( - (m) => m.ReportPageModule - ) - }, - { - path: 'transactions', - loadChildren: () => - import('./pages/transactions/transactions-page.module').then( - (m) => m.TransactionsPageModule - ) - }, { path: 'webauthn', loadChildren: () => diff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.html index 71e61464..e6d3b504 100644 --- a/apps/client/src/app/components/header/header.component.html +++ b/apps/client/src/app/components/header/header.component.html @@ -22,27 +22,22 @@ i18n mat-flat-button [ngClass]="{ - 'font-weight-bold': - currentRoute === 'analysis' || - currentRoute === 'report' || - currentRoute === 'tools', - 'text-decoration-underline': - currentRoute === 'analysis' || - currentRoute === 'report' || - currentRoute === 'tools' + 'font-weight-bold': currentRoute === 'portfolio', + 'text-decoration-underline': currentRoute === 'portfolio' }" - [routerLink]="['/tools']" - >ToolsPortfolio Transactions ToolsPortfolio Transactions Time to add your first transaction. diff --git a/apps/client/src/app/components/positions-table/positions-table.component.html b/apps/client/src/app/components/positions-table/positions-table.component.html index c6cee5f6..8e9693a1 100644 --- a/apps/client/src/app/components/positions-table/positions-table.component.html +++ b/apps/client/src/app/components/positions-table/positions-table.component.html @@ -111,7 +111,7 @@ class="my-3 text-center" > diff --git a/apps/client/src/app/pages/home/home-page.html b/apps/client/src/app/pages/home/home-page.html index 861b5400..be87fcd7 100644 --- a/apps/client/src/app/pages/home/home-page.html +++ b/apps/client/src/app/pages/home/home-page.html @@ -79,7 +79,7 @@
-

Positions

+

Holdings

diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts new file mode 100644 index 00000000..8b2182fe --- /dev/null +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; + +import { AllocationsPageComponent } from './allocations-page.component'; + +const routes: Routes = [ + { path: '', component: AllocationsPageComponent, canActivate: [AuthGuard] } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AllocationsPageRoutingModule {} diff --git a/apps/client/src/app/pages/tools/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts similarity index 91% rename from apps/client/src/app/pages/tools/analysis/analysis-page.component.ts rename to apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 433bf63b..6aaf8114 100644 --- a/apps/client/src/app/pages/tools/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -4,22 +4,17 @@ import { DataService } from '@ghostfolio/client/services/data.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UNKNOWN_KEY } from '@ghostfolio/common/config'; -import { - PortfolioItem, - PortfolioPosition, - User -} from '@ghostfolio/common/interfaces'; -import { InvestmentItem } from '@ghostfolio/common/interfaces/investment-item.interface'; +import { PortfolioPosition, User } from '@ghostfolio/common/interfaces'; import { DeviceDetectorService } from 'ngx-device-detector'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @Component({ - selector: 'gf-analysis-page', - templateUrl: './analysis-page.html', - styleUrls: ['./analysis-page.scss'] + selector: 'gf-allocations-page', + templateUrl: './allocations-page.html', + styleUrls: ['./allocations-page.scss'] }) -export class AnalysisPageComponent implements OnDestroy, OnInit { +export class AllocationsPageComponent implements OnDestroy, OnInit { public accounts: { [symbol: string]: Pick & { value: number }; }; @@ -36,7 +31,6 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { { label: 'Initial', value: 'original' }, { label: 'Current', value: 'current' } ]; - public investments: InvestmentItem[]; public portfolioPositions: { [symbol: string]: PortfolioPosition }; public positions: { [symbol: string]: any }; public positionsArray: PortfolioPosition[]; @@ -71,15 +65,6 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { this.hasImpersonationId = !!aId; }); - this.dataService - .fetchInvestments() - .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((response) => { - this.investments = response; - - this.changeDetectorRef.markForCheck(); - }); - this.dataService .fetchPortfolioPositions({}) .pipe(takeUntil(this.unsubscribeSubject)) diff --git a/apps/client/src/app/pages/tools/analysis/analysis-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html similarity index 87% rename from apps/client/src/app/pages/tools/analysis/analysis-page.html rename to apps/client/src/app/pages/portfolio/allocations/allocations-page.html index 37137839..05f34d31 100644 --- a/apps/client/src/app/pages/tools/analysis/analysis-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -1,16 +1,14 @@
-

Analysis

-
-

Positions

- -
+

Allocations

+
@@ -192,20 +190,4 @@
-
-
- - - Timeline - - - - - -
-
diff --git a/apps/client/src/app/pages/tools/analysis/analysis-page.module.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.module.ts similarity index 68% rename from apps/client/src/app/pages/tools/analysis/analysis-page.module.ts rename to apps/client/src/app/pages/portfolio/allocations/allocations-page.module.ts index d8974b3c..d5d9fe0b 100644 --- a/apps/client/src/app/pages/tools/analysis/analysis-page.module.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.module.ts @@ -1,22 +1,20 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatCardModule } from '@angular/material/card'; -import { GfInvestmentChartModule } from '@ghostfolio/client/components/investment-chart/investment-chart.module'; import { PortfolioProportionChartModule } from '@ghostfolio/client/components/portfolio-proportion-chart/portfolio-proportion-chart.module'; import { GfPositionsTableModule } from '@ghostfolio/client/components/positions-table/positions-table.module'; import { GfToggleModule } from '@ghostfolio/client/components/toggle/toggle.module'; import { GfWorldMapChartModule } from '@ghostfolio/client/components/world-map-chart/world-map-chart.module'; -import { AnalysisPageRoutingModule } from './analysis-page-routing.module'; -import { AnalysisPageComponent } from './analysis-page.component'; +import { AllocationsPageRoutingModule } from './allocations-page-routing.module'; +import { AllocationsPageComponent } from './allocations-page.component'; @NgModule({ - declarations: [AnalysisPageComponent], + declarations: [AllocationsPageComponent], exports: [], imports: [ - AnalysisPageRoutingModule, + AllocationsPageRoutingModule, CommonModule, - GfInvestmentChartModule, GfPositionsTableModule, GfToggleModule, GfWorldMapChartModule, @@ -26,4 +24,4 @@ import { AnalysisPageComponent } from './analysis-page.component'; providers: [], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) -export class AnalysisPageModule {} +export class AllocationsPageModule {} diff --git a/apps/client/src/app/pages/tools/analysis/analysis-page.scss b/apps/client/src/app/pages/portfolio/allocations/allocations-page.scss similarity index 76% rename from apps/client/src/app/pages/tools/analysis/analysis-page.scss rename to apps/client/src/app/pages/portfolio/allocations/allocations-page.scss index 09e4ea30..b41677eb 100644 --- a/apps/client/src/app/pages/tools/analysis/analysis-page.scss +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.scss @@ -1,16 +1,4 @@ :host { - .investment-chart { - .mat-card { - .mat-card-content { - aspect-ratio: 16 / 9; - - gf-investment-chart { - height: 100%; - } - } - } - } - .proportion-charts { .mat-card { .mat-card-content { diff --git a/apps/client/src/app/pages/tools/analysis/analysis-page-routing.module.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts similarity index 100% rename from apps/client/src/app/pages/tools/analysis/analysis-page-routing.module.ts rename to apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts new file mode 100644 index 00000000..18768393 --- /dev/null +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -0,0 +1,92 @@ +import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; +import { ToggleOption } from '@ghostfolio/client/components/toggle/interfaces/toggle-option.type'; +import { DataService } from '@ghostfolio/client/services/data.service'; +import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; +import { UserService } from '@ghostfolio/client/services/user/user.service'; +import { PortfolioPosition, User } from '@ghostfolio/common/interfaces'; +import { InvestmentItem } from '@ghostfolio/common/interfaces/investment-item.interface'; +import { DeviceDetectorService } from 'ngx-device-detector'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; + +@Component({ + selector: 'gf-analysis-page', + templateUrl: './analysis-page.html', + styleUrls: ['./analysis-page.scss'] +}) +export class AnalysisPageComponent implements OnDestroy, OnInit { + public accounts: { + [symbol: string]: Pick & { value: number }; + }; + public continents: { + [code: string]: { name: string; value: number }; + }; + public countries: { + [code: string]: { name: string; value: number }; + }; + public deviceType: string; + public hasImpersonationId: boolean; + public period = 'current'; + public periodOptions: ToggleOption[] = [ + { label: 'Initial', value: 'original' }, + { label: 'Current', value: 'current' } + ]; + public investments: InvestmentItem[]; + public portfolioPositions: { [symbol: string]: PortfolioPosition }; + public positions: { [symbol: string]: any }; + public sectors: { + [name: string]: { name: string; value: number }; + }; + public user: User; + + private unsubscribeSubject = new Subject(); + + /** + * @constructor + */ + public constructor( + private changeDetectorRef: ChangeDetectorRef, + private dataService: DataService, + private deviceService: DeviceDetectorService, + private impersonationStorageService: ImpersonationStorageService, + private userService: UserService + ) {} + + /** + * Initializes the controller + */ + public ngOnInit() { + this.deviceType = this.deviceService.getDeviceInfo().deviceType; + + this.impersonationStorageService + .onChangeHasImpersonation() + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((aId) => { + this.hasImpersonationId = !!aId; + }); + + this.dataService + .fetchInvestments() + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((response) => { + this.investments = response; + + this.changeDetectorRef.markForCheck(); + }); + + this.userService.stateChanged + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((state) => { + if (state?.user) { + this.user = state.user; + + this.changeDetectorRef.markForCheck(); + } + }); + } + + public ngOnDestroy() { + this.unsubscribeSubject.next(); + this.unsubscribeSubject.complete(); + } +} diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html new file mode 100644 index 00000000..66cda46c --- /dev/null +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html @@ -0,0 +1,20 @@ +
+
+
+

Analysis

+ + + Timeline + + + + + +
+
+
diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts new file mode 100644 index 00000000..53e9bb28 --- /dev/null +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.module.ts @@ -0,0 +1,21 @@ +import { CommonModule } from '@angular/common'; +import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { MatCardModule } from '@angular/material/card'; +import { GfInvestmentChartModule } from '@ghostfolio/client/components/investment-chart/investment-chart.module'; + +import { AnalysisPageRoutingModule } from './analysis-page-routing.module'; +import { AnalysisPageComponent } from './analysis-page.component'; + +@NgModule({ + declarations: [AnalysisPageComponent], + exports: [], + imports: [ + AnalysisPageRoutingModule, + CommonModule, + GfInvestmentChartModule, + MatCardModule + ], + providers: [], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class AnalysisPageModule {} diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.scss b/apps/client/src/app/pages/portfolio/analysis/analysis-page.scss new file mode 100644 index 00000000..e80fa02a --- /dev/null +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.scss @@ -0,0 +1,9 @@ +:host { + .investment-chart { + .mat-card { + .mat-card-content { + aspect-ratio: 16 / 9; + } + } + } +} diff --git a/apps/client/src/app/pages/tools/tools-page-routing.module.ts b/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts similarity index 59% rename from apps/client/src/app/pages/tools/tools-page-routing.module.ts rename to apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts index f3ab4b44..acd0cf95 100644 --- a/apps/client/src/app/pages/tools/tools-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts @@ -2,14 +2,14 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; -import { ToolsPageComponent } from './tools-page.component'; +import { PortfolioPageComponent } from './portfolio-page.component'; const routes: Routes = [ - { path: '', component: ToolsPageComponent, canActivate: [AuthGuard] } + { path: '', component: PortfolioPageComponent, canActivate: [AuthGuard] } ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class ToolsPageRoutingModule {} +export class PortfolioPageRoutingModule {} diff --git a/apps/client/src/app/pages/portfolio/portfolio-page.component.ts b/apps/client/src/app/pages/portfolio/portfolio-page.component.ts new file mode 100644 index 00000000..668d3e35 --- /dev/null +++ b/apps/client/src/app/pages/portfolio/portfolio-page.component.ts @@ -0,0 +1,44 @@ +import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; +import { UserService } from '@ghostfolio/client/services/user/user.service'; +import { User } from '@ghostfolio/common/interfaces'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; + +@Component({ + selector: 'gf-portfolio-page', + templateUrl: './portfolio-page.html', + styleUrls: ['./portfolio-page.scss'] +}) +export class PortfolioPageComponent implements OnDestroy, OnInit { + public user: User; + + private unsubscribeSubject = new Subject(); + + /** + * @constructor + */ + public constructor( + private changeDetectorRef: ChangeDetectorRef, + private userService: UserService + ) {} + + /** + * Initializes the controller + */ + public ngOnInit() { + this.userService.stateChanged + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((state) => { + if (state?.user) { + this.user = state.user; + + this.changeDetectorRef.markForCheck(); + } + }); + } + + public ngOnDestroy() { + this.unsubscribeSubject.next(); + this.unsubscribeSubject.complete(); + } +} diff --git a/apps/client/src/app/pages/portfolio/portfolio-page.html b/apps/client/src/app/pages/portfolio/portfolio-page.html new file mode 100644 index 00000000..1a2578be --- /dev/null +++ b/apps/client/src/app/pages/portfolio/portfolio-page.html @@ -0,0 +1,83 @@ +
+

Portfolio

+
+ +
+ +

Allocations

+

Check the allocations of your portfolio.

+

+ + Open Allocations → + +

+
+
+
+
+
+ +

Analysis

+

Ghostfolio Analysis visualizes your portfolio.

+

+ + Open Analysis → + +

+
+
+
+ +

X-ray

+

+ Ghostfolio X-ray uses static analysis to identify potential issues and + risks in your portfolio. +

+

+ + Open X-ray → + +

+
+
+
+
diff --git a/apps/client/src/app/pages/tools/tools-page.module.ts b/apps/client/src/app/pages/portfolio/portfolio-page.module.ts similarity index 61% rename from apps/client/src/app/pages/tools/tools-page.module.ts rename to apps/client/src/app/pages/portfolio/portfolio-page.module.ts index bd1fee69..e997b372 100644 --- a/apps/client/src/app/pages/tools/tools-page.module.ts +++ b/apps/client/src/app/pages/portfolio/portfolio-page.module.ts @@ -4,20 +4,20 @@ import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { RouterModule } from '@angular/router'; -import { ToolsPageRoutingModule } from './tools-page-routing.module'; -import { ToolsPageComponent } from './tools-page.component'; +import { PortfolioPageRoutingModule } from './portfolio-page-routing.module'; +import { PortfolioPageComponent } from './portfolio-page.component'; @NgModule({ - declarations: [ToolsPageComponent], + declarations: [PortfolioPageComponent], exports: [], imports: [ CommonModule, MatButtonModule, MatCardModule, - RouterModule, - ToolsPageRoutingModule + PortfolioPageRoutingModule, + RouterModule ], providers: [], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) -export class ToolsPageModule {} +export class PortfolioPageModule {} diff --git a/apps/client/src/app/pages/tools/report/report-page.scss b/apps/client/src/app/pages/portfolio/portfolio-page.scss similarity index 100% rename from apps/client/src/app/pages/tools/report/report-page.scss rename to apps/client/src/app/pages/portfolio/portfolio-page.scss diff --git a/apps/client/src/app/pages/tools/report/report-page-routing.module.ts b/apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts similarity index 100% rename from apps/client/src/app/pages/tools/report/report-page-routing.module.ts rename to apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts diff --git a/apps/client/src/app/pages/tools/report/report-page.component.ts b/apps/client/src/app/pages/portfolio/report/report-page.component.ts similarity index 100% rename from apps/client/src/app/pages/tools/report/report-page.component.ts rename to apps/client/src/app/pages/portfolio/report/report-page.component.ts diff --git a/apps/client/src/app/pages/tools/report/report-page.html b/apps/client/src/app/pages/portfolio/report/report-page.html similarity index 100% rename from apps/client/src/app/pages/tools/report/report-page.html rename to apps/client/src/app/pages/portfolio/report/report-page.html diff --git a/apps/client/src/app/pages/tools/report/report-page.module.ts b/apps/client/src/app/pages/portfolio/report/report-page.module.ts similarity index 100% rename from apps/client/src/app/pages/tools/report/report-page.module.ts rename to apps/client/src/app/pages/portfolio/report/report-page.module.ts diff --git a/apps/client/src/app/pages/tools/tools-page.scss b/apps/client/src/app/pages/portfolio/report/report-page.scss similarity index 100% rename from apps/client/src/app/pages/tools/tools-page.scss rename to apps/client/src/app/pages/portfolio/report/report-page.scss diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts similarity index 98% rename from apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts rename to apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts index 9507f174..42930fb2 100644 --- a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts @@ -9,6 +9,7 @@ import { FormControl, Validators } from '@angular/forms'; import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; +import { DataService } from '@ghostfolio/client/services/data.service'; import { Currency } from '@prisma/client'; import { Observable, Subject } from 'rxjs'; import { @@ -19,7 +20,6 @@ import { takeUntil } from 'rxjs/operators'; -import { DataService } from '../../../services/data.service'; import { CreateOrUpdateTransactionDialogParams } from './interfaces/interfaces'; @Component({ diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.html b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.html similarity index 100% rename from apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.html rename to apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.html diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.module.ts b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.module.ts similarity index 100% rename from apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.module.ts rename to apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.module.ts diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.scss b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.scss similarity index 100% rename from apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.scss rename to apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.scss diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/interfaces/interfaces.ts b/apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/interfaces/interfaces.ts similarity index 100% rename from apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/interfaces/interfaces.ts rename to apps/client/src/app/pages/portfolio/transactions/create-or-update-transaction-dialog/interfaces/interfaces.ts diff --git a/apps/client/src/app/pages/transactions/transactions-page-routing.module.ts b/apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts similarity index 100% rename from apps/client/src/app/pages/transactions/transactions-page-routing.module.ts rename to apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts diff --git a/apps/client/src/app/pages/transactions/transactions-page.component.ts b/apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts similarity index 100% rename from apps/client/src/app/pages/transactions/transactions-page.component.ts rename to apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts diff --git a/apps/client/src/app/pages/transactions/transactions-page.html b/apps/client/src/app/pages/portfolio/transactions/transactions-page.html similarity index 100% rename from apps/client/src/app/pages/transactions/transactions-page.html rename to apps/client/src/app/pages/portfolio/transactions/transactions-page.html diff --git a/apps/client/src/app/pages/transactions/transactions-page.module.ts b/apps/client/src/app/pages/portfolio/transactions/transactions-page.module.ts similarity index 100% rename from apps/client/src/app/pages/transactions/transactions-page.module.ts rename to apps/client/src/app/pages/portfolio/transactions/transactions-page.module.ts diff --git a/apps/client/src/app/pages/transactions/transactions-page.scss b/apps/client/src/app/pages/portfolio/transactions/transactions-page.scss similarity index 100% rename from apps/client/src/app/pages/transactions/transactions-page.scss rename to apps/client/src/app/pages/portfolio/transactions/transactions-page.scss diff --git a/apps/client/src/app/pages/tools/tools-page.component.ts b/apps/client/src/app/pages/tools/tools-page.component.ts deleted file mode 100644 index aa0f0601..00000000 --- a/apps/client/src/app/pages/tools/tools-page.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Subject } from 'rxjs'; - -@Component({ - selector: 'gf-tools-page', - templateUrl: './tools-page.html', - styleUrls: ['./tools-page.scss'] -}) -export class ToolsPageComponent implements OnInit { - private unsubscribeSubject = new Subject(); - - /** - * @constructor - */ - public constructor() {} - - /** - * Initializes the controller - */ - public ngOnInit() {} -} diff --git a/apps/client/src/app/pages/tools/tools-page.html b/apps/client/src/app/pages/tools/tools-page.html deleted file mode 100644 index 13ddaa81..00000000 --- a/apps/client/src/app/pages/tools/tools-page.html +++ /dev/null @@ -1,43 +0,0 @@ -
-

Tools

-
-
- -

Analysis

-

- Ghostfolio Analysis shows your positions and visualizes your - portfolio. -

-

- - Open Analysis → - -

-
-
-
- -

X-ray

-

- Ghostfolio X-ray uses static analysis to identify potential issues and - risks in your portfolio. -

-

- - Open X-ray → - -

-
-
-
-
diff --git a/apps/client/src/app/pages/zen/zen-page.html b/apps/client/src/app/pages/zen/zen-page.html index a3f06be4..200825c1 100644 --- a/apps/client/src/app/pages/zen/zen-page.html +++ b/apps/client/src/app/pages/zen/zen-page.html @@ -60,7 +60,7 @@
-

Positions

+

Holdings