Feature/add no transactions info on zen page (#222)

* Add no transactions info to zen page

* Update changelog
pull/223/head
Thomas 3 years ago committed by GitHub
parent 120b691336
commit 9072cbdba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the onboarding - Improved the onboarding
- Flow of creating a new account
- Info message to add the first transaction
### Fixed ### Fixed

@ -5,8 +5,8 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { LoginWithAccessTokenDialogModule } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.module'; import { LoginWithAccessTokenDialogModule } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.module';
import { GfLogoModule } from '@ghostfolio/client/components/logo/logo.module';
import { GfLogoModule } from '../logo/logo.module';
import { HeaderComponent } from './header.component'; import { HeaderComponent } from './header.component';
@NgModule({ @NgModule({

@ -1,4 +1,4 @@
<span class="align-items-center d-flex" <span class="align-items-center d-flex"
><span class="d-inline-block logo mr-1"></span> ><span class="d-inline-block logo mr-1"></span>
<span class="name">Ghostfolio</span></span <span *ngIf="!hideName" class="name">Ghostfolio</span></span
> >

@ -14,10 +14,12 @@ import {
}) })
export class LogoComponent implements OnInit { export class LogoComponent implements OnInit {
@HostBinding('class') @Input() size: 'large' | 'medium'; @HostBinding('class') @Input() size: 'large' | 'medium';
@Input() hideName: boolean;
public constructor() {} public constructor() {}
public ngOnInit() { public ngOnInit() {
this.size = this.size || 'medium'; this.hideName = this.hideName ?? false;
this.size = this.size ?? 'medium';
} }
} }

@ -1,9 +1,13 @@
<div class="p-3">
<div class="d-flex justify-content-center mb-1">
<gf-logo size="large" [hideName]="true"></gf-logo>
</div>
<a <a
class="align-items-center justify-content-center" class="align-items-center justify-content-center"
color="primary" color="primary"
[routerLink]="['/transactions']" [routerLink]="['/transactions']"
mat-button mat-button
> >
<ion-icon class="mr-1" name="time-outline" size="large"></ion-icon>
<span i18n>Time to add your first transaction.</span> <span i18n>Time to add your first transaction.</span>
</a> </a>
</div>

@ -1,3 +1,13 @@
:host { :host {
border: 1px solid rgba(var(--dark-dividers));
border-radius: 0.25rem;
display: block; display: block;
gf-logo {
opacity: 0.25;
}
}
:host-context(.is-dark-theme) {
border-color: rgba(var(--light-dividers));
} }

@ -2,13 +2,14 @@ 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 { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { GfLogoModule } from '@ghostfolio/client/components/logo/logo.module';
import { NoTransactionsInfoComponent } from './no-transactions-info.component'; import { NoTransactionsInfoComponent } from './no-transactions-info.component';
@NgModule({ @NgModule({
declarations: [NoTransactionsInfoComponent], declarations: [NoTransactionsInfoComponent],
exports: [NoTransactionsInfoComponent], exports: [NoTransactionsInfoComponent],
imports: [CommonModule, MatButtonModule, RouterModule], imports: [CommonModule, GfLogoModule, MatButtonModule, RouterModule],
providers: [], providers: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}) })

@ -20,6 +20,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
public deviceType: string; public deviceType: string;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
public hasPermissionToReadForeignPortfolio: boolean; public hasPermissionToReadForeignPortfolio: boolean;
public hasPositions: boolean;
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[];
public isLoadingPerformance = true; public isLoadingPerformance = true;
public performance: PortfolioPerformance; public performance: PortfolioPerformance;
@ -88,6 +89,8 @@ export class ZenPageComponent implements OnDestroy, OnInit {
}; };
}); });
this.hasPositions = this.historicalDataItems?.length > 0;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });

@ -1,4 +1,4 @@
<div class="container"> <div *ngIf="hasPositions || !historicalDataItems" class="container">
<div class="row"> <div class="row">
<div class="chart-container col mr-3"> <div class="chart-container col mr-3">
<gf-line-chart <gf-line-chart
@ -23,3 +23,10 @@
</div> </div>
</div> </div>
</div> </div>
<div
*ngIf="!hasPositions && historicalDataItems"
class="d-flex justify-content-center my-5"
>
<gf-no-transactions-info-indicator></gf-no-transactions-info-indicator>
</div>

@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { GfLineChartModule } from '@ghostfolio/client/components/line-chart/line-chart.module'; import { GfLineChartModule } from '@ghostfolio/client/components/line-chart/line-chart.module';
import { GfNoTransactionsInfoModule } from '@ghostfolio/client/components/no-transactions-info/no-transactions-info.module';
import { GfPortfolioPerformanceSummaryModule } from '@ghostfolio/client/components/portfolio-performance-summary/portfolio-performance-summary.module'; import { GfPortfolioPerformanceSummaryModule } from '@ghostfolio/client/components/portfolio-performance-summary/portfolio-performance-summary.module';
import { ZenPageRoutingModule } from './zen-page-routing.module'; import { ZenPageRoutingModule } from './zen-page-routing.module';
@ -13,6 +14,7 @@ import { ZenPageComponent } from './zen-page.component';
imports: [ imports: [
CommonModule, CommonModule,
GfLineChartModule, GfLineChartModule,
GfNoTransactionsInfoModule,
GfPortfolioPerformanceSummaryModule, GfPortfolioPerformanceSummaryModule,
MatCardModule, MatCardModule,
ZenPageRoutingModule ZenPageRoutingModule

Loading…
Cancel
Save