diff --git a/web/cashtab/src/components/Common/EnhancedInputs.js b/web/cashtab/src/components/Common/EnhancedInputs.js
--- a/web/cashtab/src/components/Common/EnhancedInputs.js
+++ b/web/cashtab/src/components/Common/EnhancedInputs.js
@@ -17,6 +17,7 @@
color: ${props => props.theme.forms.addonForeground} !important;
}
input.ant-input,
+ .ant-select-selection,
.ant-select-selection {
background-color: ${props =>
props.theme.forms.selectionBackground} !important;
@@ -115,6 +116,7 @@
onMax,
inputProps,
selectProps,
+ activeFiatCode,
...otherProps
}) => {
const { Option } = Select;
@@ -123,7 +125,10 @@
value: currency.ticker,
label: currency.ticker,
},
- { value: 'USD', label: 'USD' },
+ {
+ value: activeFiatCode ? activeFiatCode : 'USD',
+ label: activeFiatCode ? activeFiatCode : 'USD',
+ },
];
const currencyOptions = currencies.map(currency => {
return (
@@ -246,6 +251,46 @@
);
};
+export const CurrencySelectDropdown = selectProps => {
+ const { Option } = Select;
+
+ // Build select dropdown from currency.fiatCurrencies
+ const currencyMenuOptions = [];
+ const currencyKeys = Object.keys(currency.fiatCurrencies);
+ for (let i = 0; i < currencyKeys.length; i += 1) {
+ const currencyMenuOption = {};
+ currencyMenuOption.value =
+ currency.fiatCurrencies[currencyKeys[i]].slug;
+ currencyMenuOption.label = `${
+ currency.fiatCurrencies[currencyKeys[i]].name
+ } (${currency.fiatCurrencies[currencyKeys[i]].symbol})`;
+ currencyMenuOptions.push(currencyMenuOption);
+ }
+ const currencyOptions = currencyMenuOptions.map(currencyMenuOption => {
+ return (
+
+ );
+ });
+
+ return (
+
+ );
+};
+
export const AddressValidators = () => {
const { BCH } = useBCH();
diff --git a/web/cashtab/src/components/Common/Ticker.js b/web/cashtab/src/components/Common/Ticker.js
--- a/web/cashtab/src/components/Common/Ticker.js
+++ b/web/cashtab/src/components/Common/Ticker.js
@@ -24,6 +24,14 @@
useBlockchainWs: false,
txHistoryCount: 5,
hydrateUtxoBatchSize: 20,
+ defaultSettings: { fiatCurrency: 'usd' },
+ settingsValidation: { fiatCurrency: ['usd', 'idr', 'krw', 'cny'] },
+ fiatCurrencies: {
+ usd: { name: 'US Dollar', symbol: '$', slug: 'usd' },
+ idr: { name: 'Indonesian Rupiah', symbol: 'Rp', slug: 'idr' },
+ krw: { name: 'Korean Won', symbol: '₩', slug: 'krw' },
+ cny: { name: 'Chinese Yuan', symbol: '元', slug: 'cny' },
+ },
};
export function isValidCashPrefix(addressString) {
diff --git a/web/cashtab/src/components/Configure/Configure.js b/web/cashtab/src/components/Configure/Configure.js
--- a/web/cashtab/src/components/Configure/Configure.js
+++ b/web/cashtab/src/components/Configure/Configure.js
@@ -10,7 +10,10 @@
} from '@ant-design/icons';
import { WalletContext } from '@utils/context';
import { StyledCollapse } from '@components/Common/StyledCollapse';
-import { AntdFormWrapper } from '@components/Common/EnhancedInputs';
+import {
+ AntdFormWrapper,
+ CurrencySelectDropdown,
+} from '@components/Common/EnhancedInputs';
import PrimaryButton, {
SecondaryButton,
SmartButton,
@@ -20,6 +23,7 @@
CashLoadingIcon,
ThemedCopyOutlined,
ThemedWalletOutlined,
+ ThemedDollarOutlined,
} from '@components/Common/CustomIcons';
import { ReactComponent as Trashcan } from '@assets/trashcan.svg';
import { ReactComponent as Edit } from '@assets/edit.svg';
@@ -172,6 +176,8 @@
deleteWallet,
validateMnemonic,
getSavedWallets,
+ cashtabSettings,
+ changeCashtabSettings,
} = ContextValue;
const [savedWallets, setSavedWallets] = useState([]);
const [formData, setFormData] = useState({
@@ -582,6 +588,22 @@
>
)}
+