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

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

@ -1,10 +1,7 @@
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { UserSettings } from '@ghostfolio/api/models/interfaces/user-settings.interface';
import { groupBy } from '@ghostfolio/common/helper';
import {
PortfolioPosition,
TimelinePosition
} from '@ghostfolio/common/interfaces';
import { TimelinePosition } from '@ghostfolio/common/interfaces';
import { Currency } from '@prisma/client';
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;
}
public abstract evaluate(aRuleSettings: T): EvaluationResult;
public abstract getSettings(aUserSettings: UserSettings): T;
public getName() {
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>
<button
*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 {
@Input() deviceType: string;
@Input() symbolUrl: string;
@Input() title: string;
@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 { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { GfSymbolIconModule } from '@ghostfolio/client/components/symbol-icon/symbol-icon.module';
import { DialogHeaderComponent } from './dialog-header.component';
@NgModule({
declarations: [DialogHeaderComponent],
exports: [DialogHeaderComponent],
imports: [CommonModule, GfSymbolIconModule, MatButtonModule],
imports: [CommonModule, MatButtonModule],
providers: [],
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;
locale: string;
symbol: string;
symbolUrl: string;
title: string;
}

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

@ -1,7 +1,6 @@
<gf-dialog-header
mat-dialog-title
[deviceType]="data.deviceType"
[symbolUrl]="data.symbolUrl"
[title]="data.title"
(closeButtonClicked)="onClose()"
></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,
locale: this.locale,
symbol: this.position?.symbol,
symbolUrl: this.position?.url,
title: this.position?.name
},
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',

Loading…
Cancel
Save