Browse Source

Feature/reuse value component in ghostfolio in numbers section (#846)

* Reuse value component

* Update changelog
pull/849/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
0e4c39d145
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 61
      apps/client/src/app/pages/about/about-page.html
  3. 2
      apps/client/src/app/pages/about/about-page.module.ts
  4. 9
      libs/ui/src/lib/value/value.component.html
  5. 4
      libs/ui/src/lib/value/value.component.scss
  6. 1
      libs/ui/src/lib/value/value.component.ts

5
CHANGELOG.md

@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Added
- Added support for sub-labels in the value component
### Changed ### Changed
- Reused the value component in the _Ghostfolio in Numbers_ section of the about page
- Upgraded `yahoo-finance2` from version `2.3.0` to `2.3.1` - Upgraded `yahoo-finance2` from version `2.3.0` to `2.3.1`
## 1.139.0 - 18.04.2022 ## 1.139.0 - 18.04.2022

61
apps/client/src/app/pages/about/about-page.html

@ -109,38 +109,39 @@
<mat-card-content> <mat-card-content>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
<h3 class="mb-0">{{ statistics?.activeUsers1d || '-' }}</h3> <gf-value
<div class="h6 mb-0"> label="Active Users"
<span i18n>Active Users</span>&nbsp;<small class="text-muted" size="large"
>(Last 24 hours)</small subLabel="(Last 24 hours)"
> [value]="statistics?.activeUsers1d ?? '-'"
</div> ></gf-value>
</div> </div>
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
<h3 class="mb-0">{{ statistics?.newUsers30d ?? '-' }}</h3> <gf-value
<div class="h6 mb-0"> label="New Users"
<span i18n>New Users</span>&nbsp;<small class="text-muted" size="large"
>(Last 30 days)</small subLabel="(Last 30 days)"
> [value]="statistics?.newUsers30d ?? '-'"
</div> ></gf-value>
</div> </div>
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
<h3 class="mb-0">{{ statistics?.activeUsers30d ?? '-' }}</h3> <gf-value
<div class="h6 mb-0"> label="Active Users"
<span i18n>Active Users</span>&nbsp;<small class="text-muted" size="large"
>(Last 30 days)</small subLabel="(Last 30 days)"
> [value]="statistics?.activeUsers30d ?? '-'"
</div> ></gf-value>
</div> </div>
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
<a <a
class="d-block" class="d-block"
href="https://join.slack.com/t/ghostfolio/shared_invite/zt-vsaan64h-F_I0fEo5M0P88lP9ibCxFg" href="https://join.slack.com/t/ghostfolio/shared_invite/zt-vsaan64h-F_I0fEo5M0P88lP9ibCxFg"
> >
<h3 class="mb-0"> <gf-value
{{ statistics?.slackCommunityUsers ?? '-' }} label="Users in Slack community"
</h3> size="large"
<div class="h6 mb-0" i18n>Users in Slack community</div> [value]="statistics?.slackCommunityUsers ?? '-'"
></gf-value>
</a> </a>
</div> </div>
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
@ -148,10 +149,11 @@
class="d-block" class="d-block"
href="https://github.com/ghostfolio/ghostfolio/graphs/contributors" href="https://github.com/ghostfolio/ghostfolio/graphs/contributors"
> >
<h3 class="mb-0"> <gf-value
{{ statistics?.gitHubContributors ?? '-' }} label="Contributors on GitHub"
</h3> size="large"
<div class="h6 mb-0" i18n>Contributors on GitHub</div> [value]="statistics?.gitHubContributors ?? '-'"
></gf-value>
</a> </a>
</div> </div>
<div class="col-xs-12 col-md-4 my-2"> <div class="col-xs-12 col-md-4 my-2">
@ -159,8 +161,11 @@
class="d-block" class="d-block"
href="https://github.com/ghostfolio/ghostfolio/stargazers" href="https://github.com/ghostfolio/ghostfolio/stargazers"
> >
<h3 class="mb-0">{{ statistics?.gitHubStargazers ?? '-' }}</h3> <gf-value
<div class="h6 mb-0" i18n>Stars on GitHub</div> label="Stars on GitHub"
size="large"
[value]="statistics?.gitHubStargazers ?? '-'"
></gf-value>
</a> </a>
</div> </div>
</div> </div>

2
apps/client/src/app/pages/about/about-page.module.ts

@ -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 { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { GfValueModule } from '@ghostfolio/ui/value';
import { AboutPageRoutingModule } from './about-page-routing.module'; import { AboutPageRoutingModule } from './about-page-routing.module';
import { AboutPageComponent } from './about-page.component'; import { AboutPageComponent } from './about-page.component';
@ -12,6 +13,7 @@ import { AboutPageComponent } from './about-page.component';
imports: [ imports: [
AboutPageRoutingModule, AboutPageRoutingModule,
CommonModule, CommonModule,
GfValueModule,
MatButtonModule, MatButtonModule,
MatCardModule MatCardModule
], ],

9
libs/ui/src/lib/value/value.component.html

@ -10,14 +10,14 @@
</ng-container> </ng-container>
<div <div
*ngIf="isPercent" *ngIf="isPercent"
class="mb-0" class="mb-0 value"
[ngClass]="{ h2: size === 'large', h4: size === 'medium' }" [ngClass]="{ h2: size === 'large', h4: size === 'medium' }"
> >
{{ formattedValue }}% {{ formattedValue }}%
</div> </div>
<div <div
*ngIf="!isPercent" *ngIf="!isPercent"
class="mb-0" class="mb-0 value"
[ngClass]="{ h2: size === 'large', h4: size === 'medium' }" [ngClass]="{ h2: size === 'large', h4: size === 'medium' }"
> >
<ng-container *ngIf="value === null"> <ng-container *ngIf="value === null">
@ -36,7 +36,7 @@
</ng-container> </ng-container>
<ng-container *ngIf="isString"> <ng-container *ngIf="isString">
<div <div
class="mb-0 text-truncate" class="mb-0 text-truncate value"
[ngClass]="{ h2: size === 'large', h4: size === 'medium' }" [ngClass]="{ h2: size === 'large', h4: size === 'medium' }"
> >
{{ formattedValue | titlecase }} {{ formattedValue | titlecase }}
@ -45,7 +45,8 @@
</div> </div>
<ng-container *ngIf="label"> <ng-container *ngIf="label">
<div *ngIf="size === 'large'"> <div *ngIf="size === 'large'">
{{ label }} <span class="h6">{{ label }}</span>
<span *ngIf="subLabel" class="text-muted"> {{ subLabel }}</span>
</div> </div>
<small *ngIf="size !== 'large'"> <small *ngIf="size !== 'large'">
{{ label }} {{ label }}

4
libs/ui/src/lib/value/value.component.scss

@ -2,4 +2,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
.h2 {
line-height: 1;
}
} }

1
libs/ui/src/lib/value/value.component.ts

@ -25,6 +25,7 @@ export class ValueComponent implements OnChanges {
@Input() position = ''; @Input() position = '';
@Input() precision: number | undefined; @Input() precision: number | undefined;
@Input() size: 'large' | 'medium' | 'small' = 'small'; @Input() size: 'large' | 'medium' | 'small' = 'small';
@Input() subLabel = '';
@Input() value: number | string = ''; @Input() value: number | string = '';
public absoluteValue = 0; public absoluteValue = 0;

Loading…
Cancel
Save