Browse Source

Improve icons, localize label

pull/3077/head
Thomas Kaul 2 years ago
parent
commit
302d3f9ad9
  1. 8
      libs/common/src/lib/helper.ts
  2. 5
      libs/ui/src/lib/benchmark/benchmark.component.html
  3. 8
      libs/ui/src/lib/i18n.ts

8
libs/common/src/lib/helper.ts

@ -1,3 +1,5 @@
import { translate } from '@ghostfolio/ui/i18n';
import * as currencies from '@dinero.js/currencies';
import { NumberParser } from '@internationalized/number';
import { DataSource, MarketData } from '@prisma/client';
@ -389,10 +391,10 @@ export function resolveMarketCondition(
aMarketCondition: Benchmark['marketCondition']
) {
if (aMarketCondition === 'ALL_TIME_HIGH') {
return { emoji: '🎉' };
return { emoji: '🎉', label: translate(aMarketCondition) };
} else if (aMarketCondition === 'BEAR_MARKET') {
return { emoji: '🐻' };
return { emoji: '🐻', label: translate(aMarketCondition) };
} else {
return { emoji: '⚪' };
return { emoji: undefined, label: undefined };
}
}

5
libs/ui/src/lib/benchmark/benchmark.component.html

@ -102,7 +102,10 @@
<th *matHeaderCellDef mat-header-cell></th>
<td *matCellDef="let element" class="px-0" mat-cell>
@if (element?.marketCondition) {
<div class="text-center" [title]="element?.marketCondition">
<div
class="text-center"
[title]="resolveMarketCondition(element.marketCondition).label"
>
{{ resolveMarketCondition(element.marketCondition).emoji }}
</div>
}

8
libs/ui/src/lib/i18n.ts

@ -35,14 +35,14 @@ const locales = {
LIABILITY: $localize`Liability`,
SELL: $localize`Sell`,
// enum AssetClass
// AssetClass (enum)
CASH: $localize`Cash`,
COMMODITY: $localize`Commodity`,
EQUITY: $localize`Equity`,
FIXED_INCOME: $localize`Fixed Income`,
REAL_ESTATE: $localize`Real Estate`,
// enum AssetSubClass
// AssetSubClass (enum)
BOND: $localize`Bond`,
CRYPTOCURRENCY: $localize`Cryptocurrency`,
ETF: $localize`ETF`,
@ -51,6 +51,10 @@ const locales = {
PRIVATE_EQUITY: $localize`Private Equity`,
STOCK: $localize`Stock`,
// Benchmark
ALL_TIME_HIGH: 'All time high',
BEAR_MARKET: 'Bear market',
// Continents
Africa: $localize`Africa`,
Asia: $localize`Asia`,

Loading…
Cancel
Save