From eee1f1c72250ed61b2f11c3206e9f9f16fa67705 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 30 Jul 2022 21:26:08 +0200 Subject: [PATCH] Feature/add page titles (#1114) * Add page titles * Update changelog --- CHANGELOG.md | 4 ++++ apps/client/src/app/app-routing.module.ts | 8 +++++-- .../pages/about/about-page-routing.module.ts | 7 +++++- .../changelog-page-routing.module.ts | 7 +++++- .../privacy-policy-page-routing.module.ts | 7 +++++- .../account/account-page-routing.module.ts | 7 +++++- .../accounts/accounts-page-routing.module.ts | 7 +++++- .../pages/admin/admin-page-routing.module.ts | 7 +++--- .../pages/auth/auth-page-routing.module.ts | 4 ++-- .../hallo-ghostfolio-page-routing.module.ts | 5 ++-- .../hello-ghostfolio-page-routing.module.ts | 5 ++-- ...nths-in-open-source-page-routing.module.ts | 5 ++-- ...s-internet-identity-page-routing.module.ts | 5 ++-- ...y-finances-in-order-page-routing.module.ts | 5 ++-- .../pages/blog/blog-page-routing.module.ts | 7 +++++- .../app/pages/faq/faq-page-routing.module.ts | 7 +++++- .../features/features-page-routing.module.ts | 7 +++++- .../pages/home/home-page-routing.module.ts | 7 +++--- .../markets/markets-page-routing.module.ts | 7 +++++- .../allocations-page-routing.module.ts | 7 +++++- .../analysis/analysis-page-routing.module.ts | 7 +++++- .../fire/fire-page-routing.module.ts | 7 +++++- .../holdings/holdings-page-routing.module.ts | 7 +++++- .../portfolio-page-routing.module.ts | 7 +++++- .../report/report-page-routing.module.ts | 7 +++++- .../transactions-page-routing.module.ts | 7 +++++- .../pricing/pricing-page-routing.module.ts | 7 +++++- .../public/public-page-routing.module.ts | 7 +++++- .../register/register-page-routing.module.ts | 7 +++++- .../resources-page-routing.module.ts | 7 +++++- .../webauthn/webauthn-page-routing.module.ts | 4 +++- .../app/pages/zen/zen-page-routing.module.ts | 7 +++--- .../src/app/services/page-title.strategy.ts | 23 +++++++++++++++++++ 33 files changed, 185 insertions(+), 44 deletions(-) create mode 100644 apps/client/src/app/services/page-title.strategy.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 28c77e17..0ba5231c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added page titles + ### Changed - Improved the performance of data provider requests by introducing a maximum number of symbols per request (chunk size) diff --git a/apps/client/src/app/app-routing.module.ts b/apps/client/src/app/app-routing.module.ts index 13ed5d7d..558a3360 100644 --- a/apps/client/src/app/app-routing.module.ts +++ b/apps/client/src/app/app-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { RouterModule, Routes, TitleStrategy } from '@angular/router'; +import { PageTitleStrategy } from '@ghostfolio/client/services/page-title.strategy'; import { ModulePreloadService } from './core/module-preload.service'; @@ -234,7 +235,10 @@ const routes: Routes = [ } ) ], - providers: [ModulePreloadService], + providers: [ + ModulePreloadService, + { provide: TitleStrategy, useClass: PageTitleStrategy } + ], exports: [RouterModule] }) export class AppRoutingModule {} diff --git a/apps/client/src/app/pages/about/about-page-routing.module.ts b/apps/client/src/app/pages/about/about-page-routing.module.ts index 38e89077..441d130d 100644 --- a/apps/client/src/app/pages/about/about-page-routing.module.ts +++ b/apps/client/src/app/pages/about/about-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AboutPageComponent } from './about-page.component'; const routes: Routes = [ - { path: '', component: AboutPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: AboutPageComponent, + path: '', + title: 'About' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/about/changelog/changelog-page-routing.module.ts b/apps/client/src/app/pages/about/changelog/changelog-page-routing.module.ts index 052f5e01..f92cb12e 100644 --- a/apps/client/src/app/pages/about/changelog/changelog-page-routing.module.ts +++ b/apps/client/src/app/pages/about/changelog/changelog-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { ChangelogPageComponent } from './changelog-page.component'; const routes: Routes = [ - { path: '', component: ChangelogPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: ChangelogPageComponent, + path: '', + title: 'Changelog & License' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/about/privacy-policy/privacy-policy-page-routing.module.ts b/apps/client/src/app/pages/about/privacy-policy/privacy-policy-page-routing.module.ts index 285443bc..7cbeeb24 100644 --- a/apps/client/src/app/pages/about/privacy-policy/privacy-policy-page-routing.module.ts +++ b/apps/client/src/app/pages/about/privacy-policy/privacy-policy-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { PrivacyPolicyPageComponent } from './privacy-policy-page.component'; const routes: Routes = [ - { path: '', component: PrivacyPolicyPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: PrivacyPolicyPageComponent, + path: '', + title: 'Privacy Policy' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/account/account-page-routing.module.ts b/apps/client/src/app/pages/account/account-page-routing.module.ts index fc0fd034..1e5e6f00 100644 --- a/apps/client/src/app/pages/account/account-page-routing.module.ts +++ b/apps/client/src/app/pages/account/account-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AccountPageComponent } from './account-page.component'; const routes: Routes = [ - { path: '', component: AccountPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: AccountPageComponent, + path: '', + title: 'My Ghostfolio' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/accounts/accounts-page-routing.module.ts b/apps/client/src/app/pages/accounts/accounts-page-routing.module.ts index 7cb67a39..74f5ea05 100644 --- a/apps/client/src/app/pages/accounts/accounts-page-routing.module.ts +++ b/apps/client/src/app/pages/accounts/accounts-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AccountsPageComponent } from './accounts-page.component'; const routes: Routes = [ - { path: '', component: AccountsPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: AccountsPageComponent, + path: '', + title: 'Accounts' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/admin/admin-page-routing.module.ts b/apps/client/src/app/pages/admin/admin-page-routing.module.ts index 9c5b6fee..48cf239b 100644 --- a/apps/client/src/app/pages/admin/admin-page-routing.module.ts +++ b/apps/client/src/app/pages/admin/admin-page-routing.module.ts @@ -10,8 +10,6 @@ import { AdminPageComponent } from './admin-page.component'; const routes: Routes = [ { - path: '', - component: AdminPageComponent, canActivate: [AuthGuard], children: [ { path: '', redirectTo: 'overview', pathMatch: 'full' }, @@ -19,7 +17,10 @@ const routes: Routes = [ { path: 'market-data', component: AdminMarketDataComponent }, { path: 'overview', component: AdminOverviewComponent }, { path: 'users', component: AdminUsersComponent } - ] + ], + component: AdminPageComponent, + path: '', + title: 'Admin Control' } ]; diff --git a/apps/client/src/app/pages/auth/auth-page-routing.module.ts b/apps/client/src/app/pages/auth/auth-page-routing.module.ts index 37c13f94..2c974184 100644 --- a/apps/client/src/app/pages/auth/auth-page-routing.module.ts +++ b/apps/client/src/app/pages/auth/auth-page-routing.module.ts @@ -4,8 +4,8 @@ import { RouterModule, Routes } from '@angular/router'; import { AuthPageComponent } from './auth-page.component'; const routes: Routes = [ - { path: '', component: AuthPageComponent }, - { path: ':jwt', component: AuthPageComponent } + { component: AuthPageComponent, path: '' }, + { component: AuthPageComponent, path: ':jwt' } ]; @NgModule({ diff --git a/apps/client/src/app/pages/blog/2021/07/hallo-ghostfolio/hallo-ghostfolio-page-routing.module.ts b/apps/client/src/app/pages/blog/2021/07/hallo-ghostfolio/hallo-ghostfolio-page-routing.module.ts index d2f4532c..5c7bdb13 100644 --- a/apps/client/src/app/pages/blog/2021/07/hallo-ghostfolio/hallo-ghostfolio-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/2021/07/hallo-ghostfolio/hallo-ghostfolio-page-routing.module.ts @@ -6,9 +6,10 @@ import { HalloGhostfolioPageComponent } from './hallo-ghostfolio-page.component' const routes: Routes = [ { - path: '', + canActivate: [AuthGuard], component: HalloGhostfolioPageComponent, - canActivate: [AuthGuard] + path: '', + title: 'Hallo Ghostfolio' } ]; diff --git a/apps/client/src/app/pages/blog/2021/07/hello-ghostfolio/hello-ghostfolio-page-routing.module.ts b/apps/client/src/app/pages/blog/2021/07/hello-ghostfolio/hello-ghostfolio-page-routing.module.ts index 5165ad5b..cf54b8f8 100644 --- a/apps/client/src/app/pages/blog/2021/07/hello-ghostfolio/hello-ghostfolio-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/2021/07/hello-ghostfolio/hello-ghostfolio-page-routing.module.ts @@ -6,9 +6,10 @@ import { HelloGhostfolioPageComponent } from './hello-ghostfolio-page.component' const routes: Routes = [ { - path: '', + canActivate: [AuthGuard], component: HelloGhostfolioPageComponent, - canActivate: [AuthGuard] + path: '', + title: 'Hello Ghostfolio' } ]; diff --git a/apps/client/src/app/pages/blog/2022/01/first-months-in-open-source/first-months-in-open-source-page-routing.module.ts b/apps/client/src/app/pages/blog/2022/01/first-months-in-open-source/first-months-in-open-source-page-routing.module.ts index 96f8ab53..39364ffe 100644 --- a/apps/client/src/app/pages/blog/2022/01/first-months-in-open-source/first-months-in-open-source-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/2022/01/first-months-in-open-source/first-months-in-open-source-page-routing.module.ts @@ -6,9 +6,10 @@ import { FirstMonthsInOpenSourcePageComponent } from './first-months-in-open-sou const routes: Routes = [ { - path: '', + canActivate: [AuthGuard], component: FirstMonthsInOpenSourcePageComponent, - canActivate: [AuthGuard] + path: '', + title: 'First months in Open Source' } ]; diff --git a/apps/client/src/app/pages/blog/2022/07/ghostfolio-meets-internet-identity/ghostfolio-meets-internet-identity-page-routing.module.ts b/apps/client/src/app/pages/blog/2022/07/ghostfolio-meets-internet-identity/ghostfolio-meets-internet-identity-page-routing.module.ts index 6d2d1d49..999d79c3 100644 --- a/apps/client/src/app/pages/blog/2022/07/ghostfolio-meets-internet-identity/ghostfolio-meets-internet-identity-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/2022/07/ghostfolio-meets-internet-identity/ghostfolio-meets-internet-identity-page-routing.module.ts @@ -6,9 +6,10 @@ import { GhostfolioMeetsInternetIdentityPageComponent } from './ghostfolio-meets const routes: Routes = [ { - path: '', + canActivate: [AuthGuard], component: GhostfolioMeetsInternetIdentityPageComponent, - canActivate: [AuthGuard] + path: '', + title: 'Ghostfolio meets Internet Identity' } ]; diff --git a/apps/client/src/app/pages/blog/2022/07/how-do-i-get-my-finances-in-order/how-do-i-get-my-finances-in-order-page-routing.module.ts b/apps/client/src/app/pages/blog/2022/07/how-do-i-get-my-finances-in-order/how-do-i-get-my-finances-in-order-page-routing.module.ts index 19be1e49..93dbcb57 100644 --- a/apps/client/src/app/pages/blog/2022/07/how-do-i-get-my-finances-in-order/how-do-i-get-my-finances-in-order-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/2022/07/how-do-i-get-my-finances-in-order/how-do-i-get-my-finances-in-order-page-routing.module.ts @@ -6,9 +6,10 @@ import { HowDoIGetMyFinancesInOrderPageComponent } from './how-do-i-get-my-finan const routes: Routes = [ { - path: '', + canActivate: [AuthGuard], component: HowDoIGetMyFinancesInOrderPageComponent, - canActivate: [AuthGuard] + path: '', + title: 'How do I get my finances in order?' } ]; diff --git a/apps/client/src/app/pages/blog/blog-page-routing.module.ts b/apps/client/src/app/pages/blog/blog-page-routing.module.ts index 1b688ff5..44f02178 100644 --- a/apps/client/src/app/pages/blog/blog-page-routing.module.ts +++ b/apps/client/src/app/pages/blog/blog-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { BlogPageComponent } from './blog-page.component'; const routes: Routes = [ - { path: '', component: BlogPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: BlogPageComponent, + path: '', + title: 'Blog' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/faq/faq-page-routing.module.ts b/apps/client/src/app/pages/faq/faq-page-routing.module.ts index 682524ed..66b522e8 100644 --- a/apps/client/src/app/pages/faq/faq-page-routing.module.ts +++ b/apps/client/src/app/pages/faq/faq-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { FaqPageComponent } from './faq-page.component'; const routes: Routes = [ - { path: '', component: FaqPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: FaqPageComponent, + path: '', + title: 'FAQ' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/features/features-page-routing.module.ts b/apps/client/src/app/pages/features/features-page-routing.module.ts index 4e01e886..ffaed244 100644 --- a/apps/client/src/app/pages/features/features-page-routing.module.ts +++ b/apps/client/src/app/pages/features/features-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { FeaturesPageComponent } from './features-page.component'; const routes: Routes = [ - { path: '', component: FeaturesPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: FeaturesPageComponent, + path: '', + title: 'Features' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/home/home-page-routing.module.ts b/apps/client/src/app/pages/home/home-page-routing.module.ts index d2f1f04c..80c5a141 100644 --- a/apps/client/src/app/pages/home/home-page-routing.module.ts +++ b/apps/client/src/app/pages/home/home-page-routing.module.ts @@ -10,8 +10,6 @@ import { HomePageComponent } from './home-page.component'; const routes: Routes = [ { - path: '', - component: HomePageComponent, canActivate: [AuthGuard], children: [ { path: '', redirectTo: 'overview', pathMatch: 'full' }, @@ -19,7 +17,10 @@ const routes: Routes = [ { path: 'holdings', component: HomeHoldingsComponent }, { path: 'summary', component: HomeSummaryComponent }, { path: 'market', component: HomeMarketComponent } - ] + ], + component: HomePageComponent, + path: '', + title: 'Overview' } ]; diff --git a/apps/client/src/app/pages/markets/markets-page-routing.module.ts b/apps/client/src/app/pages/markets/markets-page-routing.module.ts index 80b50fea..47a10820 100644 --- a/apps/client/src/app/pages/markets/markets-page-routing.module.ts +++ b/apps/client/src/app/pages/markets/markets-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { MarketsPageComponent } from './markets-page.component'; const routes: Routes = [ - { path: '', component: MarketsPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: MarketsPageComponent, + path: '', + title: 'Markets' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts index 8b2182fe..f402823c 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AllocationsPageComponent } from './allocations-page.component'; const routes: Routes = [ - { path: '', component: AllocationsPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: AllocationsPageComponent, + path: '', + title: 'Allocations' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts index 2b2356fe..c2f15863 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { AnalysisPageComponent } from './analysis-page.component'; const routes: Routes = [ - { path: '', component: AnalysisPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: AnalysisPageComponent, + path: '', + title: 'Analysis' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page-routing.module.ts b/apps/client/src/app/pages/portfolio/fire/fire-page-routing.module.ts index 445457e0..50be7549 100644 --- a/apps/client/src/app/pages/portfolio/fire/fire-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/fire/fire-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { FirePageComponent } from './fire-page.component'; const routes: Routes = [ - { path: '', component: FirePageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: FirePageComponent, + path: '', + title: 'FIRE' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/holdings/holdings-page-routing.module.ts b/apps/client/src/app/pages/portfolio/holdings/holdings-page-routing.module.ts index a1ede073..208248bc 100644 --- a/apps/client/src/app/pages/portfolio/holdings/holdings-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/holdings/holdings-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { HoldingsPageComponent } from './holdings-page.component'; const routes: Routes = [ - { path: '', component: HoldingsPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: HoldingsPageComponent, + path: '', + title: 'Holdings' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts b/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts index acd0cf95..c0c5c55f 100644 --- a/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/portfolio-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { PortfolioPageComponent } from './portfolio-page.component'; const routes: Routes = [ - { path: '', component: PortfolioPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: PortfolioPageComponent, + path: '', + title: 'Portfolio' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts b/apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts index e1306a6f..9189debb 100644 --- a/apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/report/report-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { ReportPageComponent } from './report-page.component'; const routes: Routes = [ - { path: '', component: ReportPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: ReportPageComponent, + path: '', + title: 'X-ray' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts b/apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts index ae3de4db..17feefa2 100644 --- a/apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts +++ b/apps/client/src/app/pages/portfolio/transactions/transactions-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { TransactionsPageComponent } from './transactions-page.component'; const routes: Routes = [ - { path: '', component: TransactionsPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: TransactionsPageComponent, + path: '', + title: 'Activities' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/pricing/pricing-page-routing.module.ts b/apps/client/src/app/pages/pricing/pricing-page-routing.module.ts index 183dbed0..3380ccda 100644 --- a/apps/client/src/app/pages/pricing/pricing-page-routing.module.ts +++ b/apps/client/src/app/pages/pricing/pricing-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { PricingPageComponent } from './pricing-page.component'; const routes: Routes = [ - { path: '', component: PricingPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: PricingPageComponent, + path: '', + title: 'Pricing' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/public/public-page-routing.module.ts b/apps/client/src/app/pages/public/public-page-routing.module.ts index 2a648c0a..b303d499 100644 --- a/apps/client/src/app/pages/public/public-page-routing.module.ts +++ b/apps/client/src/app/pages/public/public-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { PublicPageComponent } from './public-page.component'; const routes: Routes = [ - { path: ':id', component: PublicPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: PublicPageComponent, + path: ':id', + title: 'Portfolio' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/register/register-page-routing.module.ts b/apps/client/src/app/pages/register/register-page-routing.module.ts index 730e5c95..b41e9365 100644 --- a/apps/client/src/app/pages/register/register-page-routing.module.ts +++ b/apps/client/src/app/pages/register/register-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { RegisterPageComponent } from './register-page.component'; const routes: Routes = [ - { path: '', component: RegisterPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: RegisterPageComponent, + path: '', + title: 'Registration' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/resources/resources-page-routing.module.ts b/apps/client/src/app/pages/resources/resources-page-routing.module.ts index 74b0502e..d6ff0249 100644 --- a/apps/client/src/app/pages/resources/resources-page-routing.module.ts +++ b/apps/client/src/app/pages/resources/resources-page-routing.module.ts @@ -5,7 +5,12 @@ import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; import { ResourcesPageComponent } from './resources-page.component'; const routes: Routes = [ - { path: '', component: ResourcesPageComponent, canActivate: [AuthGuard] } + { + canActivate: [AuthGuard], + component: ResourcesPageComponent, + path: '', + title: 'Resources' + } ]; @NgModule({ diff --git a/apps/client/src/app/pages/webauthn/webauthn-page-routing.module.ts b/apps/client/src/app/pages/webauthn/webauthn-page-routing.module.ts index 35bfb258..0297c10d 100644 --- a/apps/client/src/app/pages/webauthn/webauthn-page-routing.module.ts +++ b/apps/client/src/app/pages/webauthn/webauthn-page-routing.module.ts @@ -2,7 +2,9 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { WebauthnPageComponent } from '@ghostfolio/client/pages/webauthn/webauthn-page.component'; -const routes: Routes = [{ path: '', component: WebauthnPageComponent }]; +const routes: Routes = [ + { component: WebauthnPageComponent, path: '', title: 'Login' } +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/apps/client/src/app/pages/zen/zen-page-routing.module.ts b/apps/client/src/app/pages/zen/zen-page-routing.module.ts index 54b0cd69..77e8a216 100644 --- a/apps/client/src/app/pages/zen/zen-page-routing.module.ts +++ b/apps/client/src/app/pages/zen/zen-page-routing.module.ts @@ -8,14 +8,15 @@ import { ZenPageComponent } from './zen-page.component'; const routes: Routes = [ { - path: '', - component: ZenPageComponent, canActivate: [AuthGuard], children: [ { path: '', redirectTo: 'overview', pathMatch: 'full' }, { path: 'overview', component: HomeOverviewComponent }, { path: 'holdings', component: HomeHoldingsComponent } - ] + ], + component: ZenPageComponent, + path: '', + title: 'Overview' } ]; diff --git a/apps/client/src/app/services/page-title.strategy.ts b/apps/client/src/app/services/page-title.strategy.ts new file mode 100644 index 00000000..e8be5516 --- /dev/null +++ b/apps/client/src/app/services/page-title.strategy.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { Title } from '@angular/platform-browser'; +import { RouterStateSnapshot, TitleStrategy } from '@angular/router'; + +@Injectable() +export class PageTitleStrategy extends TitleStrategy { + private static readonly DEFAULT_TITLE = + 'Ghostfolio – Open Source Wealth Management Software'; + + public constructor(private readonly title: Title) { + super(); + } + + public override updateTitle(routerState: RouterStateSnapshot) { + const title = this.buildTitle(routerState); + + if (title) { + this.title.setTitle(`${title} – ${PageTitleStrategy.DEFAULT_TITLE}`); + } else { + this.title.setTitle(`${PageTitleStrategy.DEFAULT_TITLE}`); + } + } +}