Feature/reload data on logo click (#2959)
* Reload data on logo click * Update changelog
This commit is contained in:
parent
cc1d9811e0
commit
e7d4641d13
@ -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
|
||||
|
@ -6,6 +6,7 @@
|
||||
mat-button
|
||||
[ngClass]="{ 'w-100': hasTabs }"
|
||||
[routerLink]="['/']"
|
||||
(click)="onLogoClick()"
|
||||
>
|
||||
<gf-logo class="px-2" [label]="pageTitle" />
|
||||
</a>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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';
|
||||
|
19
apps/client/src/app/core/layout.service.ts
Normal file
19
apps/client/src/app/core/layout.service.ts
Normal file
@ -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;
|
||||
}
|
||||
}
|
0
git-hooks/pre-commit
Executable file → Normal file
0
git-hooks/pre-commit
Executable file → Normal file
Loading…
x
Reference in New Issue
Block a user