Browse Source

Improve empty state

pull/3939/head
Thomas Kaul 10 months ago
parent
commit
b5c4e661e2
  1. 3
      apps/client/src/app/components/home-market/home-market.component.ts
  2. 10
      apps/client/src/app/components/home-market/home-market.html
  3. 4
      apps/client/src/app/components/home-market/home-market.module.ts
  4. 15
      libs/ui/src/lib/benchmark/benchmark.component.html
  5. 5
      libs/ui/src/lib/benchmark/benchmark.component.ts

3
apps/client/src/app/components/home-market/home-market.component.ts

@ -29,7 +29,6 @@ export class HomeMarketComponent implements OnDestroy, OnInit {
public hasPermissionToAccessFearAndGreedIndex: boolean;
public historicalDataItems: HistoricalDataItem[];
public info: InfoItem;
public isLoading = true;
public readonly numberOfDays = 365;
public user: User;
@ -43,7 +42,6 @@ export class HomeMarketComponent implements OnDestroy, OnInit {
) {
this.deviceType = this.deviceService.getDeviceInfo().deviceType;
this.info = this.dataService.fetchInfo();
this.isLoading = true;
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
@ -89,7 +87,6 @@ export class HomeMarketComponent implements OnDestroy, OnInit {
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ benchmarks }) => {
this.benchmarks = benchmarks;
this.isLoading = false;
this.changeDetectorRef.markForCheck();
});

10
apps/client/src/app/components/home-market/home-market.html

@ -36,16 +36,6 @@
[locale]="user?.settings?.locale || undefined"
[user]="user"
/>
@if (isLoading) {
<ngx-skeleton-loader
animation="pulse"
class="px-2 py-3"
[theme]="{
height: '1.5rem',
width: '100%'
}"
/>
}
</div>
</div>
</div>

4
apps/client/src/app/components/home-market/home-market.module.ts

@ -4,7 +4,6 @@ import { GfLineChartComponent } from '@ghostfolio/ui/line-chart';
import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { HomeMarketComponent } from './home-market.component';
@ -15,8 +14,7 @@ import { HomeMarketComponent } from './home-market.component';
CommonModule,
GfBenchmarkComponent,
GfFearAndGreedIndexModule,
GfLineChartComponent,
NgxSkeletonLoaderModule
GfLineChartComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})

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

@ -122,3 +122,18 @@
"
></tr>
</table>
@if (isLoading) {
<ngx-skeleton-loader
animation="pulse"
class="px-4 py-3"
[theme]="{
height: '1.5rem',
width: '100%'
}"
/>
} @else if (benchmarks?.length === 0) {
<div class="p-3 text-center text-muted">
<small i18n>No data available</small>
</div>
}

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

@ -49,6 +49,7 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy {
@Input() user: User;
public displayedColumns = ['name', 'date', 'change', 'marketCondition'];
public isLoading = true;
public resolveMarketCondition = resolveMarketCondition;
public translate = translate;
@ -76,6 +77,10 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy {
}
public ngOnChanges() {
if (this.benchmarks) {
this.isLoading = false;
}
if (this.user?.settings?.isExperimentalFeatures) {
this.displayedColumns = [
'name',

Loading…
Cancel
Save