Browse Source

Feature/remove symbol icon from dialog header (#244)

* Remove symbol icon from dialog header

* Clean up code
pull/246/head
Thomas 4 years ago
committed by GitHub
parent
commit
423ceec317
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      apps/api/src/app/portfolio/portfolio.service.ts
  2. 13
      apps/api/src/models/rule.ts
  3. 6
      apps/client/src/app/components/dialog-header/dialog-header.component.html
  4. 1
      apps/client/src/app/components/dialog-header/dialog-header.component.ts
  5. 3
      apps/client/src/app/components/dialog-header/dialog-header.module.ts
  6. 1
      apps/client/src/app/components/position/position-detail-dialog/interfaces/interfaces.ts
  7. 1
      apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
  8. 1
      apps/client/src/app/components/position/position.component.ts

15
apps/api/src/app/portfolio/portfolio.service.ts

@ -17,7 +17,6 @@ import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee
import { DataProviderService } from '@ghostfolio/api/services/data-provider.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider.service';
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service';
import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service'; import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service';
import { Type } from '@ghostfolio/api/services/interfaces/interfaces';
import { EnhancedSymbolProfile } from '@ghostfolio/api/services/interfaces/symbol-profile.interface'; import { EnhancedSymbolProfile } from '@ghostfolio/api/services/interfaces/symbol-profile.interface';
import { RulesService } from '@ghostfolio/api/services/rules.service'; import { RulesService } from '@ghostfolio/api/services/rules.service';
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service';
@ -264,9 +263,7 @@ export class PortfolioService {
this.request.user.Settings.currency this.request.user.Settings.currency
); );
const { transactionPoints, orders } = await this.getTransactionPoints( const { transactionPoints } = await this.getTransactionPoints(userId);
userId
);
if (transactionPoints?.length <= 0) { if (transactionPoints?.length <= 0) {
return { return {
@ -352,18 +349,18 @@ export class PortfolioService {
} }
return { return {
averagePrice: averagePrice.toNumber(),
currency, currency,
firstBuyDate, firstBuyDate,
investment: investment.toNumber(),
marketPrice, marketPrice,
maxPrice, maxPrice,
minPrice, minPrice,
quantity: quantity.toNumber(),
transactionCount, transactionCount,
averagePrice: averagePrice.toNumber(),
grossPerformance: position.grossPerformance.toNumber(), grossPerformance: position.grossPerformance.toNumber(),
grossPerformancePercent: position.grossPerformancePercentage.toNumber(), grossPerformancePercent: position.grossPerformancePercentage.toNumber(),
historicalData: historicalDataArray, historicalData: historicalDataArray,
investment: investment.toNumber(),
quantity: quantity.toNumber(),
symbol: aSymbol symbol: aSymbol
}; };
} else { } else {
@ -452,9 +449,7 @@ export class PortfolioService {
position.grossPerformancePercentage?.toNumber() ?? null, position.grossPerformancePercentage?.toNumber() ?? null,
investment: new Big(position.investment).toNumber(), investment: new Big(position.investment).toNumber(),
name: position.name, name: position.name,
quantity: new Big(position.quantity).toNumber(), quantity: new Big(position.quantity).toNumber()
type: Type.Unknown, // TODO
url: '' // TODO
}; };
}) })
}; };

13
apps/api/src/models/rule.ts

@ -1,10 +1,7 @@
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface'; import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface';
import { groupBy } from '@ghostfolio/common/helper'; import { groupBy } from '@ghostfolio/common/helper';
import { import { TimelinePosition } from '@ghostfolio/common/interfaces';
PortfolioPosition,
TimelinePosition
} from '@ghostfolio/common/interfaces';
import { Currency } from '@prisma/client'; import { Currency } from '@prisma/client';
import { ExchangeRateDataService } from '../services/exchange-rate-data.service'; import { ExchangeRateDataService } from '../services/exchange-rate-data.service';
@ -25,10 +22,6 @@ export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
this.name = name; this.name = name;
} }
public abstract evaluate(aRuleSettings: T): EvaluationResult;
public abstract getSettings(aUserSettings: UserSettings): T;
public getName() { public getName() {
return this.name; return this.name;
} }
@ -59,4 +52,8 @@ export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
}) })
); );
} }
public abstract evaluate(aRuleSettings: T): EvaluationResult;
public abstract getSettings(aUserSettings: UserSettings): T;
} }

6
apps/client/src/app/components/dialog-header/dialog-header.component.html

@ -1,9 +1,3 @@
<gf-symbol-icon
*ngIf="symbolUrl"
class="mr-1"
size="large"
[url]="symbolUrl"
></gf-symbol-icon>
<span class="flex-grow-1 text-truncate">{{ title }}</span> <span class="flex-grow-1 text-truncate">{{ title }}</span>
<button <button
*ngIf="deviceType !== 'mobile'" *ngIf="deviceType !== 'mobile'"

1
apps/client/src/app/components/dialog-header/dialog-header.component.ts

@ -16,7 +16,6 @@ import {
}) })
export class DialogHeaderComponent implements OnInit { export class DialogHeaderComponent implements OnInit {
@Input() deviceType: string; @Input() deviceType: string;
@Input() symbolUrl: string;
@Input() title: string; @Input() title: string;
@Output() closeButtonClicked = new EventEmitter<void>(); @Output() closeButtonClicked = new EventEmitter<void>();

3
apps/client/src/app/components/dialog-header/dialog-header.module.ts

@ -1,14 +1,13 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { GfSymbolIconModule } from '@ghostfolio/client/components/symbol-icon/symbol-icon.module';
import { DialogHeaderComponent } from './dialog-header.component'; import { DialogHeaderComponent } from './dialog-header.component';
@NgModule({ @NgModule({
declarations: [DialogHeaderComponent], declarations: [DialogHeaderComponent],
exports: [DialogHeaderComponent], exports: [DialogHeaderComponent],
imports: [CommonModule, GfSymbolIconModule, MatButtonModule], imports: [CommonModule, MatButtonModule],
providers: [], providers: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}) })

1
apps/client/src/app/components/position/position-detail-dialog/interfaces/interfaces.ts

@ -3,6 +3,5 @@ export interface PositionDetailDialogParams {
deviceType: string; deviceType: string;
locale: string; locale: string;
symbol: string; symbol: string;
symbolUrl: string;
title: string; title: string;
} }

1
apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html

@ -1,7 +1,6 @@
<gf-dialog-header <gf-dialog-header
mat-dialog-title mat-dialog-title
[deviceType]="data.deviceType" [deviceType]="data.deviceType"
[symbolUrl]="data.symbolUrl"
[title]="data.title" [title]="data.title"
(closeButtonClicked)="onClose()" (closeButtonClicked)="onClose()"
></gf-dialog-header> ></gf-dialog-header>

1
apps/client/src/app/components/position/position.component.ts

@ -65,7 +65,6 @@ export class PositionComponent implements OnDestroy, OnInit {
deviceType: this.deviceType, deviceType: this.deviceType,
locale: this.locale, locale: this.locale,
symbol: this.position?.symbol, symbol: this.position?.symbol,
symbolUrl: this.position?.url,
title: this.position?.name title: this.position?.name
}, },
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh', height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',

Loading…
Cancel
Save