Browse Source

Feature/improve empty state in benchmarks of markets overview (#3939)

* Improve empty state

* Update changelog
pull/3942/head
Thomas Kaul 4 months ago
committed by GitHub
parent
commit
7f30424792
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 3
      apps/client/src/app/components/home-market/home-market.component.ts
  3. 10
      apps/client/src/app/components/home-market/home-market.html
  4. 4
      apps/client/src/app/components/home-market/home-market.module.ts
  5. 15
      libs/ui/src/lib/benchmark/benchmark.component.html
  6. 5
      libs/ui/src/lib/benchmark/benchmark.component.ts

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the empty state in the benchmarks of the markets overview
- Disabled the text hover effect in the chart of the holdings tab on the home page (experimental) - Disabled the text hover effect in the chart of the holdings tab on the home page (experimental)
- Improved the usability to customize the rule thresholds in the _X-ray_ section by introducing units (experimental) - Improved the usability to customize the rule thresholds in the _X-ray_ section by introducing units (experimental)
- Switched to adjusted market prices (splits and dividends) in the get historical functionality of the _EOD Historical Data_ service - Switched to adjusted market prices (splits and dividends) in the get historical functionality of the _EOD Historical Data_ service

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

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

@ -36,16 +36,6 @@
[locale]="user?.settings?.locale || undefined" [locale]="user?.settings?.locale || undefined"
[user]="user" [user]="user"
/> />
@if (isLoading) {
<ngx-skeleton-loader
animation="pulse"
class="px-2 py-3"
[theme]="{
height: '1.5rem',
width: '100%'
}"
/>
}
</div> </div>
</div> </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 { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { HomeMarketComponent } from './home-market.component'; import { HomeMarketComponent } from './home-market.component';
@ -15,8 +14,7 @@ import { HomeMarketComponent } from './home-market.component';
CommonModule, CommonModule,
GfBenchmarkComponent, GfBenchmarkComponent,
GfFearAndGreedIndexModule, GfFearAndGreedIndexModule,
GfLineChartComponent, GfLineChartComponent
NgxSkeletonLoaderModule
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}) })

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

@ -122,3 +122,18 @@
" "
></tr> ></tr>
</table> </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; @Input() user: User;
public displayedColumns = ['name', 'date', 'change', 'marketCondition']; public displayedColumns = ['name', 'date', 'change', 'marketCondition'];
public isLoading = true;
public resolveMarketCondition = resolveMarketCondition; public resolveMarketCondition = resolveMarketCondition;
public translate = translate; public translate = translate;
@ -76,6 +77,10 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy {
} }
public ngOnChanges() { public ngOnChanges() {
if (this.benchmarks) {
this.isLoading = false;
}
if (this.user?.settings?.isExperimentalFeatures) { if (this.user?.settings?.isExperimentalFeatures) {
this.displayedColumns = [ this.displayedColumns = [
'name', 'name',

Loading…
Cancel
Save