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
[countries]="countries"
[format]="worldMapChartFormat"
[isInPercent]="showValuesInPercentage()"
[isInPercentage]="showValuesInPercentage()"
[locale]="user?.settings?.locale"
/>
</div>

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

@ -154,7 +154,7 @@
<gf-world-map-chart
format="{0}%"
[countries]="countries"
[isInPercent]="true"
[isInPercentage]="true"
/>
</div>
<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}`,
isInPercent: false
isInPercentage: false
}
};
@ -52,6 +52,6 @@ export const InPercentage: Story = {
args: {
countries: VWRL_COUNTRY_ALLOCATION,
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 {
@Input() countries: { [code: string]: { name?: string; value: number } };
@Input() format: string;
@Input() isInPercent = false;
@Input() isInPercentage = false;
@Input() locale = getLocale();
public isLoading = true;
@ -47,7 +47,7 @@ export class GfWorldMapChartComponent implements OnChanges, OnDestroy {
}
private initialize() {
if (this.isInPercent) {
if (this.isInPercentage) {
// Convert value of countries to percentage
let sum = 0;
Object.keys(this.countries).map((country) => {

Loading…
Cancel
Save