From db8ae4666d080ea1d42a13ffef68a8d4af449d84 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 21 Feb 2024 10:39:20 +0100 Subject: [PATCH 1/3] Add "mailto:" as a valid protocol --- src/app/utils/url.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/utils/url.ts b/src/app/utils/url.ts index ee974686a..ec0ac05e4 100644 --- a/src/app/utils/url.ts +++ b/src/app/utils/url.ts @@ -1,4 +1,4 @@ -const validProtocols = ['http:', 'https:', 'ftp:', 'ipfs:', 'data:'] +const validProtocols = ['http:', 'https:', 'ftp:', 'ipfs:', 'data:', 'mailto:'] export const hasValidProtocol = (url: string | undefined): boolean => { if (!url) { From 175edaee172bb802f74abd6d46e1131a4cc803e6 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 21 Feb 2024 10:39:45 +0100 Subject: [PATCH 2/3] Fix Pontus-X test token faucet configuration --- src/app/utils/faucet-links.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/utils/faucet-links.ts b/src/app/utils/faucet-links.ts index 1d473e68a..0f222ed50 100644 --- a/src/app/utils/faucet-links.ts +++ b/src/app/utils/faucet-links.ts @@ -9,7 +9,9 @@ const faucetLinks: Partial Date: Wed, 21 Feb 2024 10:40:13 +0100 Subject: [PATCH 3/3] 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 000000000..6530d5b80 --- /dev/null +++ b/.changelog/1281.feature.md @@ -0,0 +1 @@ +Add support for hiding all fiat values diff --git a/.env b/.env index 57ada427b..fe601435e 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 99b926670..160a2da18 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 3e4073054..3658ba25d 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 b3825838b..c734b7336 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 daec75fbb..55cbeed5c 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 6cd9c4bfa..16c2178f5 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 eb2123075..ac5ddfab9 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 } } }