Browse Source

Feature/add link to transactions below holdings (#329)

* Add link: Manage transactions

* Update changelog
pull/326/head^2
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
ba9e6eab58
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 8
      apps/client/src/app/pages/home/home-page.component.ts
  3. 34
      apps/client/src/app/pages/home/home-page.html
  4. 9
      apps/client/src/app/pages/zen/zen-page.component.ts
  5. 33
      apps/client/src/app/pages/zen/zen-page.html

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Unreleased ### Unreleased
### Added
- Added a link below the holdings to manage the transactions
### Fixed ### Fixed
- Fixed the value formatting for integers (transactions count) - Fixed the value formatting for integers (transactions count)

8
apps/client/src/app/pages/home/home-page.component.ts

@ -58,6 +58,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
public fearAndGreedIndex: number; public fearAndGreedIndex: number;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
public hasPermissionToAccessFearAndGreedIndex: boolean; public hasPermissionToAccessFearAndGreedIndex: boolean;
public hasPermissionToCreateOrder: boolean;
public hasPositions: boolean; public hasPositions: boolean;
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[];
public isLoadingPerformance = true; public isLoadingPerformance = true;
@ -119,6 +120,11 @@ export class HomePageComponent implements OnDestroy, OnInit {
}); });
} }
this.hasPermissionToCreateOrder = hasPermission(
this.user.permissions,
permissions.createOrder
);
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
} }
}); });
@ -135,6 +141,8 @@ export class HomePageComponent implements OnDestroy, OnInit {
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((aId) => { .subscribe((aId) => {
this.hasImpersonationId = !!aId; this.hasImpersonationId = !!aId;
this.changeDetectorRef.markForCheck();
}); });
this.dateRange = this.dateRange =

34
apps/client/src/app/pages/home/home-page.html

@ -91,18 +91,28 @@
(change)="onChangeDateRange($event.value)" (change)="onChangeDateRange($event.value)"
></gf-toggle> ></gf-toggle>
</div> </div>
<ng-container *ngIf="hasPositions === true">
<mat-card *ngIf="hasPositions === true" class="p-0"> <mat-card class="p-0">
<mat-card-content> <mat-card-content>
<gf-positions <gf-positions
[baseCurrency]="user?.settings?.baseCurrency" [baseCurrency]="user?.settings?.baseCurrency"
[deviceType]="deviceType" [deviceType]="deviceType"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[positions]="positions" [positions]="positions"
[range]="dateRange" [range]="dateRange"
></gf-positions> ></gf-positions>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<div *ngIf="hasPermissionToCreateOrder" class="text-center">
<a
class="mt-3"
i18n
mat-button
[routerLink]="['/portfolio', 'transactions']"
>Manage Transactions...</a
>
</div>
</ng-container>
<div <div
*ngIf="hasPositions === false" *ngIf="hasPositions === false"
class="d-flex justify-content-center" class="d-flex justify-content-center"

9
apps/client/src/app/pages/zen/zen-page.component.ts

@ -19,6 +19,7 @@ import {
Position, Position,
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DateRange } from '@ghostfolio/common/types'; import { DateRange } from '@ghostfolio/common/types';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
@ -36,6 +37,7 @@ export class ZenPageComponent implements AfterViewInit, OnDestroy, OnInit {
public dateRange: DateRange = 'max'; public dateRange: DateRange = 'max';
public deviceType: string; public deviceType: string;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
public hasPermissionToCreateOrder: boolean;
public hasPositions: boolean; public hasPositions: boolean;
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[];
public isLoadingPerformance = true; public isLoadingPerformance = true;
@ -63,6 +65,11 @@ export class ZenPageComponent implements AfterViewInit, OnDestroy, OnInit {
if (state?.user) { if (state?.user) {
this.user = state.user; this.user = state.user;
this.hasPermissionToCreateOrder = hasPermission(
this.user.permissions,
permissions.createOrder
);
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
} }
}); });
@ -76,6 +83,8 @@ export class ZenPageComponent implements AfterViewInit, OnDestroy, OnInit {
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((aId) => { .subscribe((aId) => {
this.hasImpersonationId = !!aId; this.hasImpersonationId = !!aId;
this.changeDetectorRef.markForCheck();
}); });
this.update(); this.update();

33
apps/client/src/app/pages/zen/zen-page.html

@ -64,17 +64,28 @@
<h3 class="d-flex justify-content-center mb-3" i18n>Holdings</h3> <h3 class="d-flex justify-content-center mb-3" i18n>Holdings</h3>
<div class="row"> <div class="row">
<div class="align-items-center col"> <div class="align-items-center col">
<mat-card *ngIf="hasPositions === true" class="p-0"> <ng-container *ngIf="hasPositions === true">
<mat-card-content> <mat-card class="p-0">
<gf-positions <mat-card-content>
[baseCurrency]="user?.settings?.baseCurrency" <gf-positions
[deviceType]="deviceType" [baseCurrency]="user?.settings?.baseCurrency"
[locale]="user?.settings?.locale" [deviceType]="deviceType"
[positions]="positions" [locale]="user?.settings?.locale"
[range]="dateRange" [positions]="positions"
></gf-positions> [range]="dateRange"
</mat-card-content> ></gf-positions>
</mat-card> </mat-card-content>
</mat-card>
<div *ngIf="hasPermissionToCreateOrder" class="text-center">
<a
class="mt-3"
i18n
mat-button
[routerLink]="['/portfolio', 'transactions']"
>Manage Transactions...</a
>
</div>
</ng-container>
<div <div
*ngIf="hasPositions === false" *ngIf="hasPositions === false"
class="d-flex justify-content-center" class="d-flex justify-content-center"

Loading…
Cancel
Save