Browse Source
Feature/refactor various routes (part 2) (#4949)
* Refactor various routes
pull/4947/head
Thomas Kaul
2 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with
22 additions and
26 deletions
-
apps/client/src/app/app-routing.module.ts
-
apps/client/src/app/app.component.ts
-
apps/client/src/app/components/access-table/access-table.component.ts
-
apps/client/src/app/core/auth.guard.ts
-
apps/client/src/app/pages/home/home-page-routing.module.ts
-
apps/client/src/app/pages/home/home-page.component.ts
-
libs/common/src/lib/routes/routes.ts
|
|
@ -119,7 +119,7 @@ const routes: Routes = [ |
|
|
|
) |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: ghostfolioRoutes.public, |
|
|
|
path: publicRoutes.public.path, |
|
|
|
loadChildren: () => |
|
|
|
import('./pages/public/public-page.module').then( |
|
|
|
(m) => m.PublicPageModule |
|
|
|
|
|
@ -3,11 +3,7 @@ import { HoldingDetailDialogParams } from '@ghostfolio/client/components/holding |
|
|
|
import { getCssVariable } from '@ghostfolio/common/helper'; |
|
|
|
import { InfoItem, User } from '@ghostfolio/common/interfaces'; |
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
|
import { |
|
|
|
internalRoutes, |
|
|
|
publicRoutes, |
|
|
|
routes |
|
|
|
} from '@ghostfolio/common/routes/routes'; |
|
|
|
import { internalRoutes, publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
import { ColorScheme } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
import { DOCUMENT } from '@angular/common'; |
|
|
@ -213,7 +209,7 @@ export class AppComponent implements OnDestroy, OnInit { |
|
|
|
this.currentRoute === publicRoutes.features.path || |
|
|
|
this.currentRoute === publicRoutes.markets.path || |
|
|
|
this.currentRoute === publicRoutes.openStartup.path || |
|
|
|
this.currentRoute === routes.public || |
|
|
|
this.currentRoute === publicRoutes.public.path || |
|
|
|
this.currentRoute === publicRoutes.pricing.path || |
|
|
|
this.currentRoute === publicRoutes.register.path || |
|
|
|
this.currentRoute === publicRoutes.start.path) && |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; |
|
|
|
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; |
|
|
|
import { Access, User } from '@ghostfolio/common/interfaces'; |
|
|
|
import { routes } from '@ghostfolio/common/routes/routes'; |
|
|
|
import { publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
|
|
|
|
import { Clipboard } from '@angular/cdk/clipboard'; |
|
|
|
import { |
|
|
@ -55,7 +55,7 @@ export class AccessTableComponent implements OnChanges { |
|
|
|
public getPublicUrl(aId: string): string { |
|
|
|
const languageCode = this.user.settings.language; |
|
|
|
|
|
|
|
return `${this.baseUrl}/${languageCode}/${routes.public}/${aId}`; |
|
|
|
return `${this.baseUrl}/${languageCode}/${publicRoutes.public.path}/${aId}`; |
|
|
|
} |
|
|
|
|
|
|
|
public onCopyUrlToClipboard(aId: string): void { |
|
|
|
|
|
@ -1,11 +1,7 @@ |
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
|
import { SettingsStorageService } from '@ghostfolio/client/services/settings-storage.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { |
|
|
|
internalRoutes, |
|
|
|
publicRoutes, |
|
|
|
routes |
|
|
|
} from '@ghostfolio/common/routes/routes'; |
|
|
|
import { internalRoutes, publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
|
|
|
|
import { Injectable } from '@angular/core'; |
|
|
|
import { |
|
|
@ -27,7 +23,7 @@ export class AuthGuard { |
|
|
|
`/${publicRoutes.markets.path}`, |
|
|
|
`/${publicRoutes.openStartup.path}`, |
|
|
|
`/${publicRoutes.pricing.path}`, |
|
|
|
`/${routes.public}`, |
|
|
|
`/${publicRoutes.public.path}`, |
|
|
|
`/${publicRoutes.register.path}`, |
|
|
|
`/${publicRoutes.resources.path}` |
|
|
|
]; |
|
|
|
|
|
@ -4,10 +4,7 @@ import { HomeOverviewComponent } from '@ghostfolio/client/components/home-overvi |
|
|
|
import { HomeSummaryComponent } from '@ghostfolio/client/components/home-summary/home-summary.component'; |
|
|
|
import { HomeWatchlistComponent } from '@ghostfolio/client/components/home-watchlist/home-watchlist.component'; |
|
|
|
import { AuthGuard } from '@ghostfolio/client/core/auth.guard'; |
|
|
|
import { |
|
|
|
routes as ghostfolioRoutes, |
|
|
|
internalRoutes |
|
|
|
} from '@ghostfolio/common/routes/routes'; |
|
|
|
import { internalRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
|
|
|
|
import { NgModule } from '@angular/core'; |
|
|
|
import { RouterModule, Routes } from '@angular/router'; |
|
|
@ -33,9 +30,9 @@ const routes: Routes = [ |
|
|
|
title: internalRoutes.home.subRoutes.summary.title |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: ghostfolioRoutes.market, |
|
|
|
path: internalRoutes.home.subRoutes.markets.path, |
|
|
|
component: HomeMarketComponent, |
|
|
|
title: $localize`Markets` |
|
|
|
title: internalRoutes.home.subRoutes.markets.title |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: internalRoutes.home.subRoutes.watchlist.path, |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { TabConfiguration, User } from '@ghostfolio/common/interfaces'; |
|
|
|
import { internalRoutes, routes } from '@ghostfolio/common/routes/routes'; |
|
|
|
import { internalRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
|
|
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; |
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
@ -56,8 +56,8 @@ export class HomePageComponent implements OnDestroy, OnInit { |
|
|
|
}, |
|
|
|
{ |
|
|
|
iconName: 'newspaper-outline', |
|
|
|
label: $localize`Markets`, |
|
|
|
routerLink: ['/' + internalRoutes.home.path, routes.market] |
|
|
|
label: internalRoutes.home.subRoutes.markets.title, |
|
|
|
routerLink: internalRoutes.home.subRoutes.markets.routerLink |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
@ -5,9 +5,7 @@ import { IRoute } from './interfaces/interfaces'; |
|
|
|
export const routes = { |
|
|
|
api: 'api', |
|
|
|
i18n: 'i18n', |
|
|
|
market: 'market', |
|
|
|
personalFinanceTools: 'personal-finance-tools', |
|
|
|
public: 'p', |
|
|
|
|
|
|
|
// Publicly accessible pages
|
|
|
|
openSourceAlternativeTo: $localize`:kebab-case:open-source-alternative-to` |
|
|
@ -79,6 +77,11 @@ export const internalRoutes: Record<string, IRoute> = { |
|
|
|
routerLink: ['/home', 'holdings'], |
|
|
|
title: $localize`Holdings` |
|
|
|
}, |
|
|
|
markets: { |
|
|
|
path: 'markets', |
|
|
|
routerLink: ['/home', 'markets'], |
|
|
|
title: $localize`Markets` |
|
|
|
}, |
|
|
|
summary: { |
|
|
|
path: 'summary', |
|
|
|
routerLink: ['/home', 'summary'], |
|
|
@ -240,6 +243,10 @@ export const publicRoutes = { |
|
|
|
routerLink: ['/' + $localize`:kebab-case:pricing`], |
|
|
|
title: $localize`Pricing` |
|
|
|
}, |
|
|
|
public: { |
|
|
|
path: 'p', |
|
|
|
routerLink: ['/p'] |
|
|
|
}, |
|
|
|
register: { |
|
|
|
path: $localize`:kebab-case:register`, |
|
|
|
routerLink: ['/' + $localize`:kebab-case:register`], |
|
|
|