diff --git a/locales/en.json b/locales/en.json index 94e291aaa..ceb662fbb 100644 --- a/locales/en.json +++ b/locales/en.json @@ -991,7 +991,7 @@ "pos.views.Order.printInvoice": "Print Invoice", "pos.views.Settings.PointOfSale.authWarning": "Warning: no password or PIN set", "pos.views.Settings.PointOfSale.backendWarning": "Warning: currently only LND nodes are able to mark orders as paid", - "pos.views.Settings.PointOfSale.currencyError": "Error: currency must be set first", + "pos.views.Settings.PointOfSale.currencyMustBeEnabledError": "Error: currency must be enabled first", "pos.print.taxReceipt": "Receipt", "pos.print.invoice": "Invoice", "views.Settings.NodeConfiguration.createMainnetWallet": "Create mainnet wallet", diff --git a/views/Settings/Currency.tsx b/views/Settings/Currency.tsx index e16bb8a0e..22d0ec14f 100644 --- a/views/Settings/Currency.tsx +++ b/views/Settings/Currency.tsx @@ -134,79 +134,89 @@ export default class Currency extends React.Component< /> - - { - this.setState({ fiatRatesSource: value }); - const newSettings: any = { - fiatRatesSource: value - }; - if ( - !CURRENCY_KEYS.find( - (c) => c.value === selectedCurrency - )?.supportedSources.includes(value) - ) { - newSettings.fiat = DEFAULT_FIAT; - this.setState({ - selectedCurrency: DEFAULT_FIAT - }); - } - await updateSettings(newSettings); - }} - values={FIAT_RATES_SOURCE_KEYS} - /> - - this.navigateToSelectCurrency()} - > - - + + { + this.setState({ + fiatRatesSource: value + }); + const newSettings: any = { + fiatRatesSource: value + }; + if ( + !CURRENCY_KEYS.find( + (c) => + c.value === selectedCurrency + )?.supportedSources.includes(value) + ) { + newSettings.fiat = DEFAULT_FIAT; + this.setState({ + selectedCurrency: DEFAULT_FIAT + }); + } + await updateSettings(newSettings); + }} + values={FIAT_RATES_SOURCE_KEYS} + /> + + this.navigateToSelectCurrency()} > - {localeString( - 'views.Settings.Currency.selectCurrency' - ) + ` (${selectedCurrency})`} - - - - - navigation.navigate('CurrencyConverter')} - > - - + + {localeString( + 'views.Settings.Currency.selectCurrency' + ) + ` (${selectedCurrency})`} + + + + + + navigation.navigate('CurrencyConverter') + } > - {localeString( - 'views.Settings.CurrencyConverter.title' - )} - - - - + + + {localeString( + 'views.Settings.CurrencyConverter.title' + )} + + + + + + )} ); diff --git a/views/Settings/CurrencyConverter.tsx b/views/Settings/CurrencyConverter.tsx index e0c52102c..c105f78ba 100644 --- a/views/Settings/CurrencyConverter.tsx +++ b/views/Settings/CurrencyConverter.tsx @@ -26,7 +26,7 @@ import { Row } from '../../components/layout/Row'; import { themeColor } from '../../utils/ThemeUtils'; import { localeString } from '../../utils/LocaleUtils'; import FiatStore from '../../stores/FiatStore'; -import SettingsStore, { CURRENCY_KEYS } from '../../stores/SettingsStore'; +import { CURRENCY_KEYS } from '../../stores/SettingsStore'; import Add from '../../assets/images/SVG/Add.svg'; import Edit from '../../assets/images/SVG/Pen.svg'; @@ -36,7 +36,6 @@ import BitcoinIcon from '../../assets/images/SVG/bitcoin-icon.svg'; interface CurrencyConverterProps { navigation: StackNavigationProp; FiatStore?: FiatStore; - SettingsStore?: SettingsStore; route: Route<'CurrencyConverter', { selectedCurrency: string }>; } @@ -52,7 +51,7 @@ const EMOJI_REPLACEMENTS = { XAG: 'Ag' }; -@inject('FiatStore', 'SettingsStore') +@inject('FiatStore') @observer export default class CurrencyConverter extends React.Component< CurrencyConverterProps, @@ -361,10 +360,8 @@ export default class CurrencyConverter extends React.Component< }; render() { - const { navigation, SettingsStore, FiatStore } = this.props; + const { navigation, FiatStore } = this.props; const { inputValues, editMode, fadeAnim } = this.state; - const { settings }: any = SettingsStore; - const { fiatEnabled } = settings; const { fiatRates, loading, getFiatRates } = FiatStore!; let ratesNotFetched; @@ -438,14 +435,12 @@ export default class CurrencyConverter extends React.Component<
- {Object.keys(inputValues).length > 2 && ( - - )} - - - ) + + {Object.keys(inputValues).length > 2 && ( + + )} + + } centerComponent={{ text: localeString( @@ -458,230 +453,211 @@ export default class CurrencyConverter extends React.Component< }} navigation={navigation} /> - {!fiatEnabled ? ( - - - - ) : ( - - - {loading && ( - - - - )} - {ratesNotFetched && !loading && ( - { - getFiatRates(); - }} - > - - - )} - + + {loading && ( + + + + )} + {ratesNotFetched && !loading && ( + { + getFiatRates(); }} > - item} - scrollEnabled={false} - renderItem={({ - item, - onDragStart, - onDragEnd - }: DragListRenderItemInfo) => { - const { inputValues } = this.state; - return ( - - - {editMode && - item !== 'BTC' && - item !== 'sats' && ( - - this.handleDeleteCurrency( - item - ) - } - > - - - - - )} - - - - {[ - 'BTC', - 'sats' - ].includes(item) ? ( - - ) : ( - - - {getFlagEmoji( - item - )} - - - )} - - - - this.handleInputChange( - value, + + + )} + + item} + scrollEnabled={false} + renderItem={({ + item, + onDragStart, + onDragEnd + }: DragListRenderItemInfo) => { + const { inputValues } = this.state; + return ( + + + {editMode && + item !== 'BTC' && + item !== 'sats' && ( + + this.handleDeleteCurrency( item ) } - autoCapitalize="none" - /> - + > + + + + + )} - {editMode && + + + {[ + 'BTC', + 'sats' + ].includes(item) ? ( + + ) : ( + - - - - + {getFlagEmoji( + item + )} + + )} - + + + + this.handleInputChange( + value, + item + ) + } + autoCapitalize="none" + /> + + + {editMode && + item !== 'BTC' && + item !== 'sats' && ( + + + + + + )} - ); - }} - /> - - - - )} + + ); + }} + /> + + + ); } diff --git a/views/Settings/PointOfSale.tsx b/views/Settings/PointOfSale.tsx index 70d8cf13c..7a0a30b28 100644 --- a/views/Settings/PointOfSale.tsx +++ b/views/Settings/PointOfSale.tsx @@ -145,7 +145,7 @@ export default class PointOfSale extends React.Component< {!fiatEnabled && posEnabled === 'square' && ( )}