Browse Source

Feature/add icon column to benchmark component (#6907)

* Add icon column

* Update changelog
pull/6872/head^2
Thomas Kaul 2 days ago
committed by GitHub
parent
commit
e0a43cb214
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 1
      apps/client/src/app/components/home-watchlist/home-watchlist.html
  3. 33
      libs/ui/src/lib/benchmark/benchmark.component.html
  4. 4
      libs/ui/src/lib/benchmark/benchmark.component.ts

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added the icon column to the benchmark component
- Added support for the `DIRECT_URL` environment variable to enable direct database connections - Added support for the `DIRECT_URL` environment variable to enable direct database connections
### Changed ### Changed

1
apps/client/src/app/components/home-watchlist/home-watchlist.html

@ -14,6 +14,7 @@
[deviceType]="deviceType()" [deviceType]="deviceType()"
[hasPermissionToDeleteItem]="hasPermissionToDeleteWatchlistItem" [hasPermissionToDeleteItem]="hasPermissionToDeleteWatchlistItem"
[locale]="user?.settings?.locale || undefined" [locale]="user?.settings?.locale || undefined"
[showIcon]="true"
[user]="user" [user]="user"
(itemDeleted)="onWatchlistItemDeleted($event)" (itemDeleted)="onWatchlistItemDeleted($event)"
/> />

33
libs/ui/src/lib/benchmark/benchmark.component.html

@ -7,11 +7,22 @@
matSortDirection="asc" matSortDirection="asc"
[dataSource]="dataSource" [dataSource]="dataSource"
> >
<ng-container matColumnDef="name" sticky> <ng-container matColumnDef="icon" sticky>
<th *matHeaderCellDef class="px-2" mat-header-cell mat-sort-header> <th *matHeaderCellDef class="px-1" mat-header-cell></th>
<td *matCellDef="let element" class="px-1 text-center" mat-cell>
<gf-entity-logo
[dataSource]="element.dataSource"
[symbol]="element.symbol"
[tooltip]="element.name"
/>
</td>
</ng-container>
<ng-container matColumnDef="name">
<th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header>
<ng-container i18n>Name</ng-container> <ng-container i18n>Name</ng-container>
</th> </th>
<td *matCellDef="let element" class="px-2 text-nowrap" mat-cell> <td *matCellDef="let element" class="px-1 text-nowrap" mat-cell>
<div class="text-truncate"> <div class="text-truncate">
{{ element?.name }} {{ element?.name }}
</div> </div>
@ -26,14 +37,14 @@
<ng-container matColumnDef="trend50d"> <ng-container matColumnDef="trend50d">
<th <th
*matHeaderCellDef *matHeaderCellDef
class="d-none d-lg-table-cell px-2 text-right" class="d-none d-lg-table-cell px-1 text-right"
mat-header-cell mat-header-cell
> >
<ng-container i18n>50-Day Trend</ng-container> <ng-container i18n>50-Day Trend</ng-container>
</th> </th>
<td <td
*matCellDef="let element" *matCellDef="let element"
class="d-none d-lg-table-cell px-2" class="d-none d-lg-table-cell px-1"
mat-cell mat-cell
> >
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
@ -55,14 +66,14 @@
<ng-container matColumnDef="trend200d"> <ng-container matColumnDef="trend200d">
<th <th
*matHeaderCellDef *matHeaderCellDef
class="d-none d-lg-table-cell px-2 text-right" class="d-none d-lg-table-cell px-1 text-right"
mat-header-cell mat-header-cell
> >
<ng-container i18n>200-Day Trend</ng-container> <ng-container i18n>200-Day Trend</ng-container>
</th> </th>
<td <td
*matCellDef="let element" *matCellDef="let element"
class="d-none d-lg-table-cell px-2" class="d-none d-lg-table-cell px-1"
mat-cell mat-cell
> >
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
@ -84,14 +95,14 @@
<ng-container matColumnDef="date"> <ng-container matColumnDef="date">
<th <th
*matHeaderCellDef *matHeaderCellDef
class="d-none d-lg-table-cell px-2 text-right" class="d-none d-lg-table-cell px-1 text-right"
mat-header-cell mat-header-cell
> >
<ng-container i18n>Last All Time High</ng-container> <ng-container i18n>Last All Time High</ng-container>
</th> </th>
<td <td
*matCellDef="let element" *matCellDef="let element"
class="d-none d-lg-table-cell px-2" class="d-none d-lg-table-cell px-1"
mat-cell mat-cell
> >
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
@ -109,7 +120,7 @@
<ng-container matColumnDef="change"> <ng-container matColumnDef="change">
<th <th
*matHeaderCellDef *matHeaderCellDef
class="px-2 justify-content-end" class="justify-content-end px-1"
mat-header-cell mat-header-cell
mat-sort-header="performances.allTimeHigh.performancePercent" mat-sort-header="performances.allTimeHigh.performancePercent"
> >
@ -118,7 +129,7 @@
> >
<span class="d-block d-sm-none text-nowrap" i18n>from ATH</span> <span class="d-block d-sm-none text-nowrap" i18n>from ATH</span>
</th> </th>
<td *matCellDef="let element" class="px-2 text-right" mat-cell> <td *matCellDef="let element" class="px-1 text-right" mat-cell>
@if (isNumber(element?.performances?.allTimeHigh?.performancePercent)) { @if (isNumber(element?.performances?.allTimeHigh?.performancePercent)) {
<gf-value <gf-value
class="d-inline-block justify-content-end" class="d-inline-block justify-content-end"

4
libs/ui/src/lib/benchmark/benchmark.component.ts

@ -36,6 +36,7 @@ import { ellipsisHorizontal, trashOutline } from 'ionicons/icons';
import { isNumber } from 'lodash'; import { isNumber } from 'lodash';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { GfEntityLogoComponent } from '../entity-logo/entity-logo.component';
import { translate } from '../i18n'; import { translate } from '../i18n';
import { GfTrendIndicatorComponent } from '../trend-indicator/trend-indicator.component'; import { GfTrendIndicatorComponent } from '../trend-indicator/trend-indicator.component';
import { GfValueComponent } from '../value/value.component'; import { GfValueComponent } from '../value/value.component';
@ -45,6 +46,7 @@ import { BenchmarkDetailDialogParams } from './benchmark-detail-dialog/interface
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
imports: [ imports: [
GfEntityLogoComponent,
GfTrendIndicatorComponent, GfTrendIndicatorComponent,
GfValueComponent, GfValueComponent,
IonIcon, IonIcon,
@ -65,6 +67,7 @@ export class GfBenchmarkComponent {
public readonly deviceType = input.required<string>(); public readonly deviceType = input.required<string>();
public readonly hasPermissionToDeleteItem = input<boolean>(); public readonly hasPermissionToDeleteItem = input<boolean>();
public readonly locale = input(getLocale()); public readonly locale = input(getLocale());
public readonly showIcon = input(false);
public readonly showSymbol = input(true); public readonly showSymbol = input(true);
public readonly user = input<User>(); public readonly user = input<User>();
@ -75,6 +78,7 @@ export class GfBenchmarkComponent {
protected readonly dataSource = new MatTableDataSource<Benchmark>([]); protected readonly dataSource = new MatTableDataSource<Benchmark>([]);
protected readonly displayedColumns = computed(() => { protected readonly displayedColumns = computed(() => {
return [ return [
...(this.showIcon() ? ['icon'] : []),
'name', 'name',
...(this.user()?.settings?.isExperimentalFeatures ...(this.user()?.settings?.isExperimentalFeatures
? ['trend50d', 'trend200d'] ? ['trend50d', 'trend200d']

Loading…
Cancel
Save