diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a35e673c..63dded11b 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 + +- Extended the landing page by a global heat map of subscribers + ### Changed - Improved the form of the import dividends dialog (disable while loading) diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index 810611375..911243057 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -7,6 +7,7 @@ import { PropertyService } from '@ghostfolio/api/services/property/property.serv import { TagService } from '@ghostfolio/api/services/tag/tag.service'; import { DEMO_USER_ID, + PROPERTY_COUNTRIES_OF_SUBSCRIBERS, PROPERTY_IS_READ_ONLY_MODE, PROPERTY_SLACK_COMMUNITY_USERS, PROPERTY_STRIPE_CONFIG, @@ -92,6 +93,10 @@ export class InfoService { if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { globalPermissions.push(permissions.enableSubscription); + info.countriesOfSubscribers = + ((await this.propertyService.getByKey( + PROPERTY_COUNTRIES_OF_SUBSCRIBERS + )) as string[]) ?? []; info.stripePublicKey = this.configurationService.get('STRIPE_PUBLIC_KEY'); } diff --git a/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts b/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts index 22e4adc66..ef49eebde 100644 --- a/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts +++ b/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts @@ -16,8 +16,8 @@ import svgMap from 'svgmap'; styleUrls: ['./world-map-chart.component.scss'] }) export class WorldMapChartComponent implements OnChanges, OnDestroy, OnInit { - @Input() baseCurrency: string; - @Input() countries: { [code: string]: { name: string; value: number } }; + @Input() countries: { [code: string]: { name?: string; value: number } }; + @Input() format: string; @Input() isInPercent = false; public isLoading = true; @@ -71,7 +71,7 @@ export class WorldMapChartComponent implements OnChanges, OnDestroy, OnInit { applyData: 'value', data: { value: { - format: this.isInPercent ? `{0}%` : `{0} ${this.baseCurrency}` + format: this.format } }, values: this.countries diff --git a/apps/client/src/app/pages/landing/landing-page.component.ts b/apps/client/src/app/pages/landing/landing-page.component.ts index f8c2c6a23..f4a80c652 100644 --- a/apps/client/src/app/pages/landing/landing-page.component.ts +++ b/apps/client/src/app/pages/landing/landing-page.component.ts @@ -13,10 +13,14 @@ import { Subject } from 'rxjs'; templateUrl: './landing-page.html' }) export class LandingPageComponent implements OnDestroy, OnInit { + public countriesOfSubscribersMap: { + [code: string]: { value: number }; + } = {}; public currentYear = format(new Date(), 'yyyy'); public demoAuthToken: string; public deviceType: string; public hasPermissionForStatistics: boolean; + public hasPermissionForSubscription: boolean; public hasPermissionToCreateUser: boolean; public statistics: Statistics; public testimonials = [ @@ -48,13 +52,25 @@ export class LandingPageComponent implements OnDestroy, OnInit { private dataService: DataService, private deviceService: DeviceDetectorService ) { - const { globalPermissions, statistics } = this.dataService.fetchInfo(); + const { countriesOfSubscribers, globalPermissions, statistics } = + this.dataService.fetchInfo(); + + for (const country of countriesOfSubscribers) { + this.countriesOfSubscribersMap[country] = { + value: 1 + }; + } this.hasPermissionForStatistics = hasPermission( globalPermissions, permissions.enableStatistics ); + this.hasPermissionForSubscription = hasPermission( + globalPermissions, + permissions.enableSubscription + ); + this.hasPermissionToCreateUser = hasPermission( globalPermissions, permissions.createUserAccount diff --git a/apps/client/src/app/pages/landing/landing-page.html b/apps/client/src/app/pages/landing/landing-page.html index 0c8f20bce..64f943f3c 100644 --- a/apps/client/src/app/pages/landing/landing-page.html +++ b/apps/client/src/app/pages/landing/landing-page.html @@ -269,6 +269,21 @@ +