mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
23 changed files with 224 additions and 114 deletions
@ -0,0 +1,15 @@ |
|||||
|
import { NgModule } from '@angular/core'; |
||||
|
import { RouterModule, Routes } from '@angular/router'; |
||||
|
import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; |
||||
|
|
||||
|
import { MarketsPageComponent } from './markets-page.component'; |
||||
|
|
||||
|
const routes: Routes = [ |
||||
|
{ path: '', component: MarketsPageComponent, canActivate: [AuthGuard] } |
||||
|
]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
imports: [RouterModule.forChild(routes)], |
||||
|
exports: [RouterModule] |
||||
|
}) |
||||
|
export class MarketsPageRoutingModule {} |
@ -0,0 +1,21 @@ |
|||||
|
import { Component, OnDestroy, OnInit } from '@angular/core'; |
||||
|
import { Subject } from 'rxjs'; |
||||
|
|
||||
|
@Component({ |
||||
|
host: { class: 'page' }, |
||||
|
selector: 'gf-markets-page', |
||||
|
styleUrls: ['./markets-page.scss'], |
||||
|
templateUrl: './markets-page.html' |
||||
|
}) |
||||
|
export class MarketsPageComponent implements OnDestroy, OnInit { |
||||
|
private unsubscribeSubject = new Subject<void>(); |
||||
|
|
||||
|
public constructor() {} |
||||
|
|
||||
|
public ngOnInit() {} |
||||
|
|
||||
|
public ngOnDestroy() { |
||||
|
this.unsubscribeSubject.next(); |
||||
|
this.unsubscribeSubject.complete(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<gf-home-market></gf-home-market> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
@ -0,0 +1,13 @@ |
|||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; |
||||
|
import { GfHomeMarketModule } from '@ghostfolio/client/components/home-market/home-market.module'; |
||||
|
|
||||
|
import { MarketsPageRoutingModule } from './markets-page-routing.module'; |
||||
|
import { MarketsPageComponent } from './markets-page.component'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [MarketsPageComponent], |
||||
|
imports: [CommonModule, GfHomeMarketModule, MarketsPageRoutingModule], |
||||
|
schemas: [CUSTOM_ELEMENTS_SCHEMA] |
||||
|
}) |
||||
|
export class MarketsPageModule {} |
@ -0,0 +1,3 @@ |
|||||
|
:host { |
||||
|
display: block; |
||||
|
} |
@ -1,49 +1,50 @@ |
|||||
<div class="align-items-center d-flex"> |
<table class="gf-table w-100"> |
||||
<div *ngIf="benchmark?.name" class="flex-grow-1 text-truncate"> |
<thead> |
||||
{{ benchmark.name }} |
<tr class="mat-header-row"> |
||||
</div> |
<th class="mat-header-cell px-1 py-2" i18n>Index</th> |
||||
<div *ngIf="!benchmark?.name" class="flex-grow-1"> |
<th class="mat-header-cell px-1 py-2 text-right"> |
||||
<ngx-skeleton-loader |
<span class="d-none d-sm-block text-nowrap" i18n |
||||
animation="pulse" |
>Change from All Time High</span |
||||
[theme]="{ |
> |
||||
width: '67%' |
<span class="d-block d-sm-none text-nowrap" i18n>from ATH</span> |
||||
}" |
</th> |
||||
></ngx-skeleton-loader> |
<th class="mat-header-cell px-1 py-2 text-right" i18n></th> |
||||
</div> |
</tr> |
||||
<gf-value |
</thead> |
||||
class="mx-2" |
<tbody> |
||||
size="medium" |
<tr *ngFor="let benchmark of benchmarks" class="mat-row"> |
||||
[isPercent]="true" |
<td class="mat-cell px-1 py-2"> |
||||
[locale]="locale" |
<div class="d-flex align-items-center"> |
||||
[ngClass]="{ |
{{ benchmark.name }} |
||||
'text-danger': |
</div> |
||||
benchmark?.performances?.allTimeHigh?.performancePercent < 0, |
</td> |
||||
'text-success': |
<td class="mat-cell px-1 py-2 text-right"> |
||||
benchmark?.performances?.allTimeHigh?.performancePercent > 0 |
<gf-value |
||||
}" |
class="d-inline-block justify-content-end" |
||||
[value]=" |
size="medium" |
||||
benchmark?.performances?.allTimeHigh?.performancePercent ?? undefined |
[isPercent]="true" |
||||
" |
[locale]="locale" |
||||
></gf-value> |
[ngClass]="{ |
||||
<div class="text-muted"> |
'text-danger': |
||||
<small class="d-none d-sm-block text-nowrap" i18n>from All Time High</small |
benchmark?.performances?.allTimeHigh?.performancePercent < 0, |
||||
><small class="d-block d-sm-none text-nowrap" i18n>from ATH</small> |
'text-success': |
||||
</div> |
benchmark?.performances?.allTimeHigh?.performancePercent > 0 |
||||
<div class="ml-2"> |
}" |
||||
<div |
[value]=" |
||||
*ngIf="benchmark?.marketCondition" |
benchmark?.performances?.allTimeHigh?.performancePercent ?? |
||||
[title]="benchmark?.marketCondition" |
undefined |
||||
> |
" |
||||
{{ resolveMarketCondition(benchmark.marketCondition).emoji }} |
></gf-value> |
||||
</div> |
</td> |
||||
<ngx-skeleton-loader |
<td class="mat-cell px-1 py-2"> |
||||
*ngIf="!benchmark?.marketCondition" |
<div |
||||
animation="pulse" |
*ngIf="benchmark?.marketCondition" |
||||
appearance="circle" |
class="text-center" |
||||
[theme]="{ |
[title]="benchmark?.marketCondition" |
||||
height: '1rem', |
> |
||||
width: '1rem' |
{{ resolveMarketCondition(benchmark.marketCondition).emoji }} |
||||
}" |
</div> |
||||
></ngx-skeleton-loader> |
</td> |
||||
</div> |
</tr> |
||||
</div> |
</tbody> |
||||
|
</table> |
||||
|
Loading…
Reference in new issue