Browse Source

Task/refactor input in world map chart component (#6692)

Refactor input to isInPercentage
pull/6695/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
cebf15284e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      apps/client/src/app/pages/portfolio/allocations/allocations-page.html
  2. 2
      apps/client/src/app/pages/public/public-page.html
  3. 4
      libs/ui/src/lib/world-map-chart/world-map-chart.component.stories.ts
  4. 4
      libs/ui/src/lib/world-map-chart/world-map-chart.component.ts

2
apps/client/src/app/pages/portfolio/allocations/allocations-page.html

@ -204,7 +204,7 @@
<gf-world-map-chart <gf-world-map-chart
[countries]="countries" [countries]="countries"
[format]="worldMapChartFormat" [format]="worldMapChartFormat"
[isInPercent]="showValuesInPercentage()" [isInPercentage]="showValuesInPercentage()"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
/> />
</div> </div>

2
apps/client/src/app/pages/public/public-page.html

@ -154,7 +154,7 @@
<gf-world-map-chart <gf-world-map-chart
format="{0}%" format="{0}%"
[countries]="countries" [countries]="countries"
[isInPercent]="true" [isInPercentage]="true"
/> />
</div> </div>
<div class="row"> <div class="row">

4
libs/ui/src/lib/world-map-chart/world-map-chart.component.stories.ts

@ -44,7 +44,7 @@ export const Default: Story = {
}) })
), ),
format: `{0} ${DEFAULT_CURRENCY}`, format: `{0} ${DEFAULT_CURRENCY}`,
isInPercent: false isInPercentage: false
} }
}; };
@ -52,6 +52,6 @@ export const InPercentage: Story = {
args: { args: {
countries: VWRL_COUNTRY_ALLOCATION, countries: VWRL_COUNTRY_ALLOCATION,
format: '{0}%', format: '{0}%',
isInPercent: true isInPercentage: true
} }
}; };

4
libs/ui/src/lib/world-map-chart/world-map-chart.component.ts

@ -21,7 +21,7 @@ import svgMap from 'svgmap';
export class GfWorldMapChartComponent implements OnChanges, OnDestroy { export class GfWorldMapChartComponent implements OnChanges, OnDestroy {
@Input() countries: { [code: string]: { name?: string; value: number } }; @Input() countries: { [code: string]: { name?: string; value: number } };
@Input() format: string; @Input() format: string;
@Input() isInPercent = false; @Input() isInPercentage = false;
@Input() locale = getLocale(); @Input() locale = getLocale();
public isLoading = true; public isLoading = true;
@ -47,7 +47,7 @@ export class GfWorldMapChartComponent implements OnChanges, OnDestroy {
} }
private initialize() { private initialize() {
if (this.isInPercent) { if (this.isInPercentage) {
// Convert value of countries to percentage // Convert value of countries to percentage
let sum = 0; let sum = 0;
Object.keys(this.countries).map((country) => { Object.keys(this.countries).map((country) => {

Loading…
Cancel
Save