From 302d3f9ad98362c4dc2c12b0dda0a4f67dae4bc6 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 1 Mar 2024 19:22:07 +0100 Subject: [PATCH] Improve icons, localize label --- libs/common/src/lib/helper.ts | 8 +++++--- libs/ui/src/lib/benchmark/benchmark.component.html | 5 ++++- libs/ui/src/lib/i18n.ts | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index c6a15e22e..894804287 100644 --- a/libs/common/src/lib/helper.ts +++ b/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 }; } } diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index 2e5c819e7..913105faa 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -102,7 +102,10 @@ @if (element?.marketCondition) { -
+
{{ resolveMarketCondition(element.marketCondition).emoji }}
} diff --git a/libs/ui/src/lib/i18n.ts b/libs/ui/src/lib/i18n.ts index 53c2d3a77..9687f461c 100644 --- a/libs/ui/src/lib/i18n.ts +++ b/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`,