Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/reload data on logo click (#2959)
Martin Muie7d4641d1347
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 60867ef1b9..26d39805e8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Changed++- Improved the usability by reloading the content with a logo click on the home page+## 2.48.1 - 2024-02-06### Fixeddiff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.htmlindex e192d7feec..c3cd958c14 100644--- a/apps/client/src/app/components/header/header.component.html+++ b/apps/client/src/app/components/header/header.component.html@@ -6,6 +6,7 @@mat-button[ngClass]="{ 'w-100': hasTabs }"[routerLink]="['/']"+ (click)="onLogoClick()"><gf-logo class="px-2" [label]="pageTitle" /></a>diff --git a/apps/client/src/app/components/header/header.component.ts b/apps/client/src/app/components/header/header.component.tsindex 412082de85..6f467c2387 100644--- a/apps/client/src/app/components/header/header.component.ts+++ b/apps/client/src/app/components/header/header.component.ts@@ -13,6 +13,7 @@ import { MatMenuTrigger } from '@angular/material/menu';import { Router } from '@angular/router';import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto';import { LoginWithAccessTokenDialog } from '@ghostfolio/client/components/login-with-access-token-dialog/login-with-access-token-dialog.component';+import { LayoutService } from '@ghostfolio/client/core/layout.service';import { DataService } from '@ghostfolio/client/services/data.service';import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';import {@@ -89,6 +90,7 @@ export class HeaderComponent implements OnChanges {private dataService: DataService,private dialog: MatDialog,private impersonationStorageService: ImpersonationStorageService,+ private layoutService: LayoutService,private router: Router,private settingsStorageService: SettingsStorageService,private tokenStorageService: TokenStorageService,@@ -192,6 +194,12 @@ export class HeaderComponent implements OnChanges {});}+ public onLogoClick() {+ if (this.currentRoute === 'home' || this.currentRoute === 'zen') {+ this.layoutService.getShouldReloadSubject().next();+ }+ }+public onMenuClosed() {this.isMenuOpen = false;}diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.tsindex 47809ee530..42993a71f9 100644--- a/apps/client/src/app/components/home-overview/home-overview.component.ts+++ b/apps/client/src/app/components/home-overview/home-overview.component.ts@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';import { ToggleComponent } from '@ghostfolio/client/components/toggle/toggle.component';import { DataService } from '@ghostfolio/client/services/data.service';import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';+import { LayoutService } from '@ghostfolio/client/core/layout.service';import { UserService } from '@ghostfolio/client/services/user/user.service';import {LineChartItem,@@ -43,6 +44,7 @@ export class HomeOverviewComponent implements OnDestroy, OnInit {private dataService: DataService,private deviceService: DeviceDetectorService,private impersonationStorageService: ImpersonationStorageService,+ private layoutService: LayoutService,private userService: UserService) {this.userService.stateChanged@@ -73,6 +75,12 @@ export class HomeOverviewComponent implements OnDestroy, OnInit {this.changeDetectorRef.markForCheck();});+ this.layoutService.shouldReloadContent$+ .pipe(takeUntil(this.unsubscribeSubject))+ .subscribe(() => {+ this.update();+ });+this.showDetails =!this.user.settings.isRestrictedView &&this.user.settings.viewMode !== 'ZEN';diff --git a/apps/client/src/app/core/layout.service.ts b/apps/client/src/app/core/layout.service.tsnew file mode 100644index 0000000000..3ba7af91e5--- /dev/null+++ b/apps/client/src/app/core/layout.service.ts@@ -0,0 +1,19 @@+import { Injectable } from '@angular/core';+import { Observable, Subject } from 'rxjs';++@Injectable({+ providedIn: 'root'+})+export class LayoutService {+ public shouldReloadContent$: Observable<void>;++ private shouldReloadSubject = new Subject<void>();++ public constructor() {+ this.shouldReloadContent$ = this.shouldReloadSubject.asObservable();+ }++ public getShouldReloadSubject() {+ return this.shouldReloadSubject;+ }+}diff --git a/git-hooks/pre-commit b/git-hooks/pre-commitold mode 100755new mode 100644