From 71db6efe07dd2c5398af61bbbb5471fb648315dc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 18 Sep 2026 08:14:11 +0200 Subject: [PATCH] Feature/add previous and next navigation to personal finance tools (#7899) Add previous and next navigation --- .../personal-finance-tools-page.component.ts | 5 +- .../product-page.component.ts | 33 + .../personal-finance-tools/product-page.html | 29 +- libs/common/src/lib/personal-finance-tools.ts | 5446 +++++++++-------- 4 files changed, 2786 insertions(+), 2727 deletions(-) diff --git a/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.component.ts b/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.component.ts index 27a4f32658..0bc7602ccd 100644 --- a/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.component.ts +++ b/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.component.ts @@ -23,9 +23,8 @@ export class PersonalFinanceToolsPageComponent { public pathResources = publicRoutes.resources.path; public pathPersonalFinanceTools = publicRoutes.resources.subRoutes.personalFinanceTools.path; - public personalFinanceTools = personalFinanceTools.sort((a, b) => { - return a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }); - }); + + public personalFinanceTools = personalFinanceTools; public routerLinkAbout = publicRoutes.about.routerLink; public constructor() { diff --git a/apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts b/apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts index d33ec17d67..beda3e3fc2 100644 --- a/apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts +++ b/apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts @@ -1,4 +1,5 @@ import { getCountryName } from '@ghostfolio/common/helper'; +import { Product } from '@ghostfolio/common/interfaces'; import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools'; import { publicRoutes } from '@ghostfolio/common/routes/routes'; import { translate } from '@ghostfolio/ui/i18n'; @@ -91,9 +92,20 @@ export class GfProductPageComponent { protected readonly routerLinkAbout = publicRoutes.about.routerLink; protected readonly routerLinkFeatures = publicRoutes.features.routerLink; + protected readonly routerLinkResourcesPersonalFinanceTools = publicRoutes.resources.subRoutes.personalFinanceTools.routerLink; + protected readonly titlePrefix = $localize`The Open Source Alternative to`; + + protected readonly nextProduct = computed(() => { + return personalFinanceTools[this.getCurrentProductIndex() + 1]; + }); + + protected readonly previousProduct = computed(() => { + return personalFinanceTools[this.getCurrentProductIndex() - 1]; + }); + protected readonly tags = computed(() => { const product1 = this.product1(); const product2 = this.product2(); @@ -139,6 +151,27 @@ export class GfProductPageComponent { private readonly dataService = inject(DataService); private readonly route = inject(ActivatedRoute); + protected getProductRouterLink(product?: Product) { + if (!product) { + return this.routerLinkResourcesPersonalFinanceTools; + } + + return [ + ...this.routerLinkResourcesPersonalFinanceTools, + `${publicRoutes.resources.subRoutes.personalFinanceTools.subRoutes.product.path}-${product.alias ?? product.key}` + ]; + } + + protected getProductTitle(product?: Product) { + return `Ghostfolio: ${this.titlePrefix} ${product?.name ?? ''}`; + } + + private getCurrentProductIndex() { + return personalFinanceTools.findIndex(({ key }) => { + return key === this.product2().key; + }); + } + private getSortedTranslations(values?: string[]) { return values ?.map((value) => { diff --git a/apps/client/src/app/pages/resources/personal-finance-tools/product-page.html b/apps/client/src/app/pages/resources/personal-finance-tools/product-page.html index 192b3cadbb..01fb9a39d0 100644 --- a/apps/client/src/app/pages/resources/personal-finance-tools/product-page.html +++ b/apps/client/src/app/pages/resources/personal-finance-tools/product-page.html @@ -4,9 +4,8 @@

- Ghostfolio: - The Open Source Alternative to {{ product2().name }} + Ghostfolio: {{ titlePrefix }} + {{ product2().name }}

@if (product2().isArchived) { @@ -379,7 +378,7 @@ > -
+
    @for (tag of tags(); track tag) {
  • @@ -388,9 +387,29 @@ }
+