diff --git a/CHANGELOG.md b/CHANGELOG.md index 60867ef1b..26d39805e 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 ### Fixed diff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.html index e192d7fee..c3cd958c1 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()" > diff --git a/apps/client/src/app/components/header/header.component.ts b/apps/client/src/app/components/header/header.component.ts index 412082de8..6f467c238 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.ts index 47809ee53..42993a71f 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.ts new file mode 100644 index 000000000..3ba7af91e --- /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; + + private shouldReloadSubject = new Subject(); + + public constructor() { + this.shouldReloadContent$ = this.shouldReloadSubject.asObservable(); + } + + public getShouldReloadSubject() { + return this.shouldReloadSubject; + } +} diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit old mode 100755 new mode 100644