From cf22b94c9107565b4a7240d961e9c2605b0ab6a3 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 21 Feb 2024 10:40:13 +0100 Subject: [PATCH] Add support for hiding all fiat values --- .changelog/1281.feature.md | 1 + .env | 1 + .env.production | 1 + src/app/components/Account/index.tsx | 4 ++-- src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx | 4 ++-- src/app/pages/RuntimeTransactionDetailPage/index.tsx | 5 +++-- src/config.ts | 2 ++ src/global.d.ts | 1 + 8 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .changelog/1281.feature.md diff --git a/.changelog/1281.feature.md b/.changelog/1281.feature.md new file mode 100644 index 0000000000..6530d5b803 --- /dev/null +++ b/.changelog/1281.feature.md @@ -0,0 +1 @@ +Add support for hiding all fiat values diff --git a/.env b/.env index 57ada427b6..fe601435e0 100644 --- a/.env +++ b/.env @@ -25,3 +25,4 @@ REACT_APP_STAGING_URLS=https://explorer.stg.oasis.io REACT_APP_SHOW_BUILD_BANNERS=true # REACT_APP_FIXED_NETWORK=testnet # REACT_APP_FIXED_LAYER=sapphire +REACT_APP_SHOW_FIAT_VALUES=true diff --git a/.env.production b/.env.production index 99b926670c..160a2da182 100644 --- a/.env.production +++ b/.env.production @@ -20,3 +20,4 @@ REACT_APP_STAGING_URLS=https://explorer.stg.oasis.io REACT_APP_SHOW_BUILD_BANNERS=true # REACT_APP_FIXED_NETWORK=testnet # REACT_APP_FIXED_LAYER=sapphire +REACT_APP_SHOW_FIAT_VALUES=true diff --git a/src/app/components/Account/index.tsx b/src/app/components/Account/index.tsx index 3e4073054e..3658ba25de 100644 --- a/src/app/components/Account/index.tsx +++ b/src/app/components/Account/index.tsx @@ -22,7 +22,7 @@ import { AccountAvatar } from '../AccountAvatar' import { RuntimeBalanceDisplay } from '../Balance/RuntimeBalanceDisplay' import { calculateFiatValue } from '../Balance/hooks' import { FiatMoneyAmount } from '../Balance/FiatMoneyAmount' -import { getFiatCurrencyForScope, getTokensForScope } from '../../../config' +import { getFiatCurrencyForScope, getTokensForScope, showFiatValues } from '../../../config' type AccountProps = { account?: RuntimeAccount @@ -115,7 +115,7 @@ export const Account: FC = ({ account, token, isLoading, tokenPric - {!fiatValueInfo.loading && fiatValueInfo.hasValue && ( + {showFiatValues && !fiatValueInfo.loading && fiatValueInfo.hasValue && ( <>
{t('common.fiatValue')}
diff --git a/src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx b/src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx index b3825838b8..c734b7336f 100644 --- a/src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx +++ b/src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx @@ -7,7 +7,7 @@ import { ActiveAccounts } from './ActiveAccounts' import { ChartDuration } from '../../utils/chart-utils' import { useTranslation } from 'react-i18next' import { useConstant } from '../../hooks/useConstant' -import { getTokensForScope } from '../../../config' +import { getTokensForScope, showFiatValues } from '../../../config' import { getLayerLabels } from '../../utils/content' import { TestnetFaucet } from './TestnetFaucet' import { SearchScope } from '../../../types/searchScope' @@ -53,7 +53,7 @@ export const ParaTimeSnapshot: FC<{ scope: SearchScope }> = ({ scope }) => { - {!mainToken.free && } + {showFiatValues && !mainToken.free && } {faucetLink && } diff --git a/src/app/pages/RuntimeTransactionDetailPage/index.tsx b/src/app/pages/RuntimeTransactionDetailPage/index.tsx index daec75fbbe..55cbeed5c8 100644 --- a/src/app/pages/RuntimeTransactionDetailPage/index.tsx +++ b/src/app/pages/RuntimeTransactionDetailPage/index.tsx @@ -38,7 +38,7 @@ import { LongDataDisplay } from '../../components/LongDataDisplay' import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat' import { base64ToHex } from '../../utils/helpers' import { DappBanner } from '../../components/DappBanner' -import { getFiatCurrencyForScope } from '../../../config' +import { getFiatCurrencyForScope, showFiatValues } from '../../../config' type TransactionSelectionResult = { wantedTransaction?: RuntimeTransaction @@ -327,7 +327,8 @@ export const RuntimeTransactionDetailView: FC<{ : t('common.missing')}
- {transaction.amount !== undefined && + {showFiatValues && + transaction.amount !== undefined && !!tokenPriceInfo && !tokenPriceInfo.isLoading && !tokenPriceInfo.isFree && diff --git a/src/config.ts b/src/config.ts index 6cd9c4bfa0..16c2178f57 100644 --- a/src/config.ts +++ b/src/config.ts @@ -197,3 +197,5 @@ export const getTokensForScope = (scope: SearchScope | undefined): NativeTokenIn export const getFiatCurrencyForScope = (scope: SearchScope | undefined) => (scope ? paraTimesConfig[scope.layer]?.[scope.network]?.fiatCurrency : undefined) ?? 'usd' + +export const showFiatValues = process.env.REACT_APP_SHOW_FIAT_VALUES === 'true' diff --git a/src/global.d.ts b/src/global.d.ts index eb21230755..ac5ddfab98 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -25,6 +25,7 @@ declare global { REACT_APP_STAGING_URLS?: string REACT_APP_FIXED_NETWORK?: string REACT_APP_FIXED_LAYER?: string + REACT_APP_SHOW_FIAT_VALUES?: string } } }