|
|
@ -1,4 +1,4 @@ |
|
|
import { getCountryName } from '@ghostfolio/common/helper'; |
|
|
import { getCountryName, getEmojiFlag } from '@ghostfolio/common/helper'; |
|
|
import { Product } from '@ghostfolio/common/interfaces'; |
|
|
import { Product } from '@ghostfolio/common/interfaces'; |
|
|
import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools'; |
|
|
import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools'; |
|
|
import { publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
import { publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
@ -14,7 +14,7 @@ import { |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { ActivatedRoute, RouterModule } from '@angular/router'; |
|
|
import { ActivatedRoute, RouterModule } from '@angular/router'; |
|
|
|
|
|
|
|
|
import { ResolvedProduct } from './interfaces/interfaces'; |
|
|
import { ResolvedProduct, ResolvedRegion } from './interfaces/interfaces'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
@ -58,9 +58,9 @@ export class GfProductPageComponent { |
|
|
// 'Ukrainian (Українська)'
|
|
|
// 'Ukrainian (Українська)'
|
|
|
], |
|
|
], |
|
|
name: 'Ghostfolio', |
|
|
name: 'Ghostfolio', |
|
|
origin: getCountryName({ code: 'CH' }), |
|
|
origin: this.getResolvedCountry('CH'), |
|
|
platforms: this.getSortedTranslations(['ANDROID', 'WEB']), |
|
|
platforms: this.getSortedTranslations(['ANDROID', 'WEB']), |
|
|
regions: [$localize`Global`], |
|
|
regions: [{ name: $localize`Global` }], |
|
|
slogan: 'Open Source Wealth Management', |
|
|
slogan: 'Open Source Wealth Management', |
|
|
useAnonymously: true |
|
|
useAnonymously: true |
|
|
})); |
|
|
})); |
|
|
@ -75,20 +75,16 @@ export class GfProductPageComponent { |
|
|
name: product?.name ?? '', |
|
|
name: product?.name ?? '', |
|
|
...product, |
|
|
...product, |
|
|
categories: this.getSortedTranslations(product?.categories), |
|
|
categories: this.getSortedTranslations(product?.categories), |
|
|
platforms: this.getSortedTranslations(product?.platforms) |
|
|
origin: product?.origin |
|
|
}; |
|
|
? this.getResolvedCountry(product.origin) |
|
|
|
|
|
: undefined, |
|
|
if (mappedProduct.origin) { |
|
|
platforms: this.getSortedTranslations(product?.platforms), |
|
|
mappedProduct.origin = getCountryName({ code: mappedProduct.origin }); |
|
|
regions: product?.regions?.map((region) => { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (mappedProduct.regions) { |
|
|
|
|
|
mappedProduct.regions = mappedProduct.regions.map((region) => { |
|
|
|
|
|
return region === 'Global' |
|
|
return region === 'Global' |
|
|
? translate(region) |
|
|
? { name: translate(region) } |
|
|
: getCountryName({ code: region }); |
|
|
: this.getResolvedCountry(region); |
|
|
}); |
|
|
}) |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
return mappedProduct; |
|
|
return mappedProduct; |
|
|
}); |
|
|
}); |
|
|
@ -122,7 +118,7 @@ export class GfProductPageComponent { |
|
|
...(categories ?? []), |
|
|
...(categories ?? []), |
|
|
...(platforms ?? []), |
|
|
...(platforms ?? []), |
|
|
name, |
|
|
name, |
|
|
origin |
|
|
origin?.name |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
), |
|
|
), |
|
|
@ -175,6 +171,13 @@ export class GfProductPageComponent { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getResolvedCountry(code: string): ResolvedRegion { |
|
|
|
|
|
return { |
|
|
|
|
|
emojiFlag: getEmojiFlag(code), |
|
|
|
|
|
name: getCountryName({ code }) |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private getSortedTranslations(values?: string[]) { |
|
|
private getSortedTranslations(values?: string[]) { |
|
|
return values |
|
|
return values |
|
|
?.map((value) => { |
|
|
?.map((value) => { |
|
|
|