Browse Source

Refactoring

pull/2135/head
Thomas 2 years ago
parent
commit
41b9364ae6
  1. 25
      apps/client/src/app/pages/alternatives/alternatives-page-routing.module.ts
  2. 4
      apps/client/src/app/pages/alternatives/alternatives-page.component.ts
  3. 5
      apps/client/src/app/pages/alternatives/page-template.html
  4. 17
      apps/client/src/app/pages/alternatives/products.ts
  5. 7
      apps/client/src/app/pages/alternatives/products/maybe-page.component.ts
  6. 7
      apps/client/src/app/pages/alternatives/products/parqet-page.component.ts
  7. 7
      apps/client/src/app/pages/alternatives/products/yeekatee-page.component.ts
  8. 4
      libs/common/src/lib/interfaces/index.ts
  9. 3
      libs/common/src/lib/interfaces/product.ts

25
apps/client/src/app/pages/alternatives/alternatives-page-routing.module.ts

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
import { AlternativesPageComponent } from './alternatives-page.component'; import { AlternativesPageComponent } from './alternatives-page.component';
import { data } from './data'; import { products } from './products';
const routes: Routes = [ const routes: Routes = [
{ {
@ -12,14 +12,27 @@ const routes: Routes = [
path: '', path: '',
title: $localize`Alternatives` title: $localize`Alternatives`
}, },
{ ...products
.filter(({ key }) => {
return key !== 'ghostfolio';
})
.map(({ component, key, name }) => {
return {
canActivate: [AuthGuard],
path: key,
loadComponent: () =>
import(`./products/${key}-page.component`).then(() => component),
title: `Open Source Alternative to ${name}`
};
})
/*{
canActivate: [AuthGuard], canActivate: [AuthGuard],
path: 'maybe', path: 'maybe',
loadComponent: () => loadComponent: () =>
import('./products/maybe-page.component').then( import('./products/maybe-page.component').then(
(c) => c.MaybePageComponent (c) => c.MaybePageComponent
), ),
title: data.find(({ key }) => key === 'maybe').name title: products.find(({ key }) => key === 'maybe').name
}, },
{ {
canActivate: [AuthGuard], canActivate: [AuthGuard],
@ -28,7 +41,7 @@ const routes: Routes = [
import('./products/parqet-page.component').then( import('./products/parqet-page.component').then(
(c) => c.ParqetPageComponent (c) => c.ParqetPageComponent
), ),
title: data.find(({ key }) => key === 'parqet').name title: products.find(({ key }) => key === 'parqet').name
}, },
{ {
canActivate: [AuthGuard], canActivate: [AuthGuard],
@ -37,8 +50,8 @@ const routes: Routes = [
import('./products/yeekatee-page.component').then( import('./products/yeekatee-page.component').then(
(c) => c.YeekateePageComponent (c) => c.YeekateePageComponent
), ),
title: data.find(({ key }) => key === 'yeekatee').name title: products.find(({ key }) => key === 'yeekatee').name
} }*/
]; ];
@NgModule({ @NgModule({

4
apps/client/src/app/pages/alternatives/alternatives-page.component.ts

@ -1,7 +1,7 @@
import { Component, OnDestroy } from '@angular/core'; import { Component, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { data } from './data'; import { products } from './products';
@Component({ @Component({
host: { class: 'page' }, host: { class: 'page' },
@ -10,7 +10,7 @@ import { data } from './data';
templateUrl: './alternatives-page.html' templateUrl: './alternatives-page.html'
}) })
export class AlternativesPageComponent implements OnDestroy { export class AlternativesPageComponent implements OnDestroy {
public products = data.filter(({ key }) => { public products = products.filter(({ key }) => {
return key !== 'ghostfolio'; return key !== 'ghostfolio';
}); });

5
apps/client/src/app/pages/alternatives/page-template.html

@ -145,6 +145,11 @@
</li> </li>
</ol> </ol>
</nav> </nav>
<section class="m-4 text-center">
<small class="text-muted"
>This website is not affiliated with {{ product2.name }}.</small
>
</section>
</article> </article>
</div> </div>
</div> </div>

17
apps/client/src/app/pages/alternatives/data.ts → apps/client/src/app/pages/alternatives/products.ts

@ -1,7 +1,11 @@
import { Comparison } from '@ghostfolio/common/interfaces'; import { Product } from '@ghostfolio/common/interfaces';
import { MaybePageComponent } from './products/maybe-page.component';
import { ParqetPageComponent } from './products/parqet-page.component';
import { YeekateePageComponent } from './products/yeekatee-page.component';
export const data: Comparison[] = [ export const products: Product[] = [
{ {
component: undefined,
founded: 2021, founded: 2021,
hasFreePlan: true, hasFreePlan: true,
isOpenSource: true, isOpenSource: true,
@ -15,6 +19,7 @@ export const data: Comparison[] = [
slogan: 'Open Source Wealth Management' slogan: 'Open Source Wealth Management'
}, },
{ {
component: MaybePageComponent,
founded: 2021, founded: 2021,
isOpenSource: false, isOpenSource: false,
key: 'maybe', key: 'maybe',
@ -27,21 +32,25 @@ export const data: Comparison[] = [
slogan: 'Your financial future, in your control' slogan: 'Your financial future, in your control'
}, },
{ {
component: ParqetPageComponent,
founded: 2020,
hasFreePlan: true, hasFreePlan: true,
isOpenSource: false, isOpenSource: false,
key: 'parqet', key: 'parqet',
name: 'Parqet', name: 'Parqet',
origin: 'Germany', origin: 'Germany',
region: 'DACH', pricing: 'Starting from €88 / year',
region: 'Austria, Germany, Switzerland',
slogan: 'Dein Vermögen immer im Blick' slogan: 'Dein Vermögen immer im Blick'
}, },
{ {
component: YeekateePageComponent,
founded: 2021, founded: 2021,
isOpenSource: false, isOpenSource: false,
key: 'yeekatee', key: 'yeekatee',
name: 'yeekatee', name: 'yeekatee',
origin: 'Switzerland', origin: 'Switzerland',
region: 'CH', region: 'Switzerland',
slogan: 'Connect. Share. Invest.' slogan: 'Connect. Share. Invest.'
} }
]; ];

7
apps/client/src/app/pages/alternatives/products/maybe-page.component.ts

@ -2,9 +2,8 @@ import { CommonModule } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { Comparison } from '@ghostfolio/common/interfaces';
import { data } from '../data'; import { products } from '../products';
@Component({ @Component({
host: { class: 'page' }, host: { class: 'page' },
@ -14,11 +13,11 @@ import { data } from '../data';
templateUrl: '../page-template.html' templateUrl: '../page-template.html'
}) })
export class MaybePageComponent { export class MaybePageComponent {
public product1: Comparison = data.find(({ key }) => { public product1 = products.find(({ key }) => {
return key === 'ghostfolio'; return key === 'ghostfolio';
}); });
public product2: Comparison = data.find(({ key }) => { public product2 = products.find(({ key }) => {
return key === 'maybe'; return key === 'maybe';
}); });
} }

7
apps/client/src/app/pages/alternatives/products/parqet-page.component.ts

@ -2,9 +2,8 @@ import { CommonModule } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { Comparison } from '@ghostfolio/common/interfaces';
import { data } from '../data'; import { products } from '../products';
@Component({ @Component({
host: { class: 'page' }, host: { class: 'page' },
@ -14,11 +13,11 @@ import { data } from '../data';
templateUrl: '../page-template.html' templateUrl: '../page-template.html'
}) })
export class ParqetPageComponent { export class ParqetPageComponent {
public product1: Comparison = data.find(({ key }) => { public product1 = products.find(({ key }) => {
return key === 'ghostfolio'; return key === 'ghostfolio';
}); });
public product2: Comparison = data.find(({ key }) => { public product2 = products.find(({ key }) => {
return key === 'parqet'; return key === 'parqet';
}); });
} }

7
apps/client/src/app/pages/alternatives/products/yeekatee-page.component.ts

@ -2,9 +2,8 @@ import { CommonModule } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { Comparison } from '@ghostfolio/common/interfaces';
import { data } from '../data'; import { products } from '../products';
@Component({ @Component({
host: { class: 'page' }, host: { class: 'page' },
@ -14,11 +13,11 @@ import { data } from '../data';
templateUrl: '../page-template.html' templateUrl: '../page-template.html'
}) })
export class YeekateePageComponent { export class YeekateePageComponent {
public product1: Comparison = data.find(({ key }) => { public product1 = products.find(({ key }) => {
return key === 'ghostfolio'; return key === 'ghostfolio';
}); });
public product2: Comparison = data.find(({ key }) => { public product2 = products.find(({ key }) => {
return key === 'yeekatee'; return key === 'yeekatee';
}); });
} }

4
libs/common/src/lib/interfaces/index.ts

@ -10,7 +10,6 @@ import type {
import type { BenchmarkMarketDataDetails } from './benchmark-market-data-details.interface'; import type { BenchmarkMarketDataDetails } from './benchmark-market-data-details.interface';
import type { BenchmarkProperty } from './benchmark-property.interface'; import type { BenchmarkProperty } from './benchmark-property.interface';
import type { Benchmark } from './benchmark.interface'; import type { Benchmark } from './benchmark.interface';
import { Comparison } from './comparison';
import type { Coupon } from './coupon.interface'; import type { Coupon } from './coupon.interface';
import type { DataProviderInfo } from './data-provider-info.interface'; import type { DataProviderInfo } from './data-provider-info.interface';
import type { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface'; import type { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface';
@ -33,6 +32,7 @@ import type { PortfolioReportRule } from './portfolio-report-rule.interface';
import type { PortfolioReport } from './portfolio-report.interface'; import type { PortfolioReport } from './portfolio-report.interface';
import type { PortfolioSummary } from './portfolio-summary.interface'; import type { PortfolioSummary } from './portfolio-summary.interface';
import type { Position } from './position.interface'; import type { Position } from './position.interface';
import type { Product } from './product';
import type { BenchmarkResponse } from './responses/benchmark-response.interface'; import type { BenchmarkResponse } from './responses/benchmark-response.interface';
import type { ResponseError } from './responses/errors.interface'; import type { ResponseError } from './responses/errors.interface';
import type { ImportResponse } from './responses/import-response.interface'; import type { ImportResponse } from './responses/import-response.interface';
@ -59,7 +59,6 @@ export {
BenchmarkMarketDataDetails, BenchmarkMarketDataDetails,
BenchmarkProperty, BenchmarkProperty,
BenchmarkResponse, BenchmarkResponse,
Comparison,
Coupon, Coupon,
DataProviderInfo, DataProviderInfo,
EnhancedSymbolProfile, EnhancedSymbolProfile,
@ -85,6 +84,7 @@ export {
PortfolioReportRule, PortfolioReportRule,
PortfolioSummary, PortfolioSummary,
Position, Position,
Product,
ResponseError, ResponseError,
ScraperConfiguration, ScraperConfiguration,
Statistics, Statistics,

3
libs/common/src/lib/interfaces/comparison.ts → libs/common/src/lib/interfaces/product.ts

@ -1,4 +1,5 @@
export interface Comparison { export interface Product {
component: any;
founded?: number; founded?: number;
hasFreePlan?: boolean; hasFreePlan?: boolean;
isOpenSource: boolean; isOpenSource: boolean;
Loading…
Cancel
Save