From 1caf0b17f2cea4df7f5810b852f0b9da0ce4b647 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 20 Sep 2022 17:28:09 -0300 Subject: [PATCH 1/2] Ref: add selected values for language and currency --- .../tabs/settings/components/General.tsx | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/navigation/tabs/settings/components/General.tsx b/src/navigation/tabs/settings/components/General.tsx index b99094504..32f1f288f 100644 --- a/src/navigation/tabs/settings/components/General.tsx +++ b/src/navigation/tabs/settings/components/General.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect, useState} from 'react'; import Button from '../../../../components/button/Button'; import AngleRight from '../../../../../assets/img/angle-right.svg'; import ToggleSwitch from '../../../../components/toggle-switch/ToggleSwitch'; @@ -12,6 +12,7 @@ import {RootState} from '../../../../store'; import {useAppDispatch} from '../../../../utils/hooks/useAppDispatch'; import {useTranslation} from 'react-i18next'; import {SettingsComponent} from '../SettingsRoot'; +import {LanguageList} from '../../../../constants/LanguageSelectionList'; import { ActiveOpacity, Hr, @@ -24,10 +25,23 @@ const General = () => { const showPortfolioValue = useAppSelector( ({APP}: RootState) => APP.showPortfolioValue, ); + const selectedAltCurrency = useAppSelector( + ({APP}: RootState) => APP.defaultAltCurrency, + ); + const appLanguage = useAppSelector(({APP}) => APP.defaultLanguage); + const [appLanguageName, setAppLanguageName] = useState(''); const dispatch = useAppDispatch(); const {t} = useTranslation(); + useEffect(() => { + LanguageList.forEach(lng => { + if (lng.isoCode === appLanguage) { + setAppLanguageName(lng.name); + } + }); + }, [appLanguage]); + return ( { }) }> {t('Display Currency')} - +
{/*----------------------------------------------------------------------*/} @@ -87,7 +109,15 @@ const General = () => { navigation.navigate('GeneralSettings', {screen: 'LanguageSettings'}) }> {t('Language')} - +
{/*----------------------------------------------------------------------*/} From 402e7439d0183777816a1f7e90b6083d65027aba Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 20 Sep 2022 17:28:51 -0300 Subject: [PATCH 2/2] Ref: hide advanced info. Click on it to show --- .../tabs/settings/components/Crypto.tsx | 94 +++++++++++-------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/src/navigation/tabs/settings/components/Crypto.tsx b/src/navigation/tabs/settings/components/Crypto.tsx index a0bf25f55..17d01fa2e 100644 --- a/src/navigation/tabs/settings/components/Crypto.tsx +++ b/src/navigation/tabs/settings/components/Crypto.tsx @@ -1,5 +1,5 @@ import {SettingsComponent} from '../SettingsRoot'; -import React from 'react'; +import React, {useState} from 'react'; import { InfoTriangle, Info, @@ -30,6 +30,10 @@ const Crypto = () => { const enableReplaceByFee = useAppSelector( ({WALLET}) => WALLET.enableReplaceByFee, ); + const [showInfoUnconfirmed, setShowInfoUnconfirmed] = useState(false); + const [showInfoCustomizeEth, setShowInfoCustomizeEth] = useState(false); + const [showInfoEthQueued, setShowInfoEthQueued] = useState(false); + const [showInfoEnableRbf, setShowInfoEnableRbf] = useState(false); const navigation = useNavigation(); return ( @@ -46,7 +50,9 @@ const Crypto = () => {
- + setShowInfoUnconfirmed(!showInfoUnconfirmed)}> {t('Use Unconfirmed Funds')} { @@ -60,16 +66,20 @@ const Crypto = () => { isEnabled={useUnconfirmedFunds} /> - - - - {t( - 'If enabled, wallets will also try to spend unconfirmed funds. However, unconfirmed funds are not allowed for spending with merchants, BitPay Card loads, or BitPay in-app gift card purchases.', - )} - - + {showInfoUnconfirmed ? ( + + + + {t( + 'If enabled, wallets will also try to spend unconfirmed funds. However, unconfirmed funds are not allowed for spending with merchants, BitPay Card loads, or BitPay in-app gift card purchases.', + )} + + + ) : null}
- + setShowInfoCustomizeEth(!showInfoCustomizeEth)}> {t('Customize ETH Nonce')} { @@ -83,16 +93,20 @@ const Crypto = () => { isEnabled={customizeNonce} /> - - - - {t( - 'If enabled, the transaction nonce could be changed on the confirm view. This is an advanced feature, use cautiously.', - )} - - + {showInfoCustomizeEth ? ( + + + + {t( + 'If enabled, the transaction nonce could be changed on the confirm view. This is an advanced feature, use cautiously.', + )} + + + ) : null}
- + setShowInfoEthQueued(!showInfoEthQueued)}> {t('ETH Queued transactions')} @@ -101,16 +115,20 @@ const Crypto = () => { isEnabled={queuedTransactions} /> - - - - {t( - 'If enabled, your eth transactions will be queued if there is a pending transaction with a lower account nonce. This is an advanced feature, use cautiously.', - )} - - + {showInfoEthQueued ? ( + + + + {t( + 'If enabled, your eth transactions will be queued if there is a pending transaction with a lower account nonce. This is an advanced feature, use cautiously.', + )} + + + ) : null}
- + setShowInfoEnableRbf(!showInfoEnableRbf)}> {t('Enable BTC Replace-By-Fee')} { @@ -124,14 +142,16 @@ const Crypto = () => { isEnabled={enableReplaceByFee} /> - - - - {t( - 'If enabled, your transactions will be marked as non-final, and you will have the possibility, while they are unconfirmed, to replace them with transactions that pay higher fees. Note that some merchants do not accept non-final transactions until they are confirmed.', - )} - - + {showInfoEnableRbf ? ( + + + + {t( + 'If enabled, your transactions will be marked as non-final, and you will have the possibility, while they are unconfirmed, to replace them with transactions that pay higher fees. Note that some merchants do not accept non-final transactions until they are confirmed.', + )} + + + ) : null}
); };