diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index adb971d3..ae3a284d 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -7,7 +7,7 @@ import currencyDict from '../../static/assets/currencies.json'; import MediaQuery from 'react-responsive' import Image from 'material-ui-image' -import getFlags from './getFlags' +import FlagWithProps from './FlagWithProps' import { pn } from "../utils/prettyNumbers"; import PaymentText from './PaymentText' @@ -137,7 +137,11 @@ class BookPage extends Component { )}}, { field: 'currency', headerName: t("Currency"), width: 100, renderCell: (params) => {return ( -
{params.row.currency+" "}{getFlags(params.row.currency)}
) +
+ {params.row.currency+" "} + +
+ ) }}, { field: 'payment_method', headerName: t("Payment Method"), width: 180 , renderCell: (params) => {return ( @@ -234,7 +238,10 @@ class BookPage extends Component { { field: 'currency', headerName: t("Currency"), width: 85, renderCell: (params) => {return ( // -
{params.row.currency+" "}{getFlags(params.row.currency)}
+
+ {params.row.currency+" "} + +
//
)} }, { field: 'payment_method', headerName: t("Payment Method"), width: 180, hide:'true'}, @@ -395,10 +402,10 @@ class BookPage extends Component { style: {textAlign:"center"} }} onChange={this.handleCurrencyChange} - >
{getFlags('ANY')}{" "+t("ANY_currency")}
+ >
{" "+t("ANY_currency")}
{ Object.entries(currencyDict) - .map( ([key, value]) =>
{getFlags(value)}{" "+value}
) + .map( ([key, value]) =>
{" "+value}
) } diff --git a/frontend/src/components/FlagWithProps/FlagWithProps.tsx b/frontend/src/components/FlagWithProps/FlagWithProps.tsx new file mode 100644 index 00000000..e7bb493d --- /dev/null +++ b/frontend/src/components/FlagWithProps/FlagWithProps.tsx @@ -0,0 +1,89 @@ +import Flags from 'country-flag-icons/react/3x2' +import SwapCallsIcon from '@mui/icons-material/SwapCalls'; +import GoldIcon from '../icons/GoldIcon'; +import EarthIcon from '../icons/EarthIcon' + +type Props = { + code: string; +} + +const FlagWithProps = ({ code }: Props): JSX.Element => { + const defaultProps = { + width: 20, + height: 20, + }; + + let flag: JSX.Element | null = null; + + if(code === 'AUD') flag = ; + if(code === 'ARS') flag = ; + if(code === 'BRL') flag = ; + if(code === 'CAD') flag = ; + if(code === 'CHF') flag = ; + if(code === 'CLP') flag = ; + if(code === 'CNY') flag = ; + if(code === 'EUR') flag = ; + if(code === 'HRK') flag = ; + if(code === 'CZK') flag = ; + if(code === 'DKK') flag = ; + if(code === 'GBP') flag = ; + if(code === 'HKD') flag = ; + if(code === 'HUF') flag = ; + if(code === 'INR') flag = ; + if(code === 'ISK') flag = ; + if(code === 'JPY') flag = ; + if(code === 'KRW') flag = ; + if(code === 'MXN') flag = ; + if(code === 'NOK') flag = ; + if(code === 'NZD') flag = ; + if(code === 'PLN') flag = ; + if(code === 'RON') flag = ; + if(code === 'RUB') flag = ; + if(code === 'SEK') flag = ; + if(code === 'SGD') flag = ; + if(code === 'VES') flag = ; + if(code === 'TRY') flag = ; + if(code === 'USD') flag = ; + if(code === 'ZAR') flag = ; + if(code === 'COP') flag = ; + if(code === 'PEN') flag = ; + if(code === 'UYU') flag = ; + if(code === 'PYG') flag = ; + if(code === 'BOB') flag = ; + if(code === 'IDR') flag = ; + if(code === 'ANG') flag = ; + if(code === 'CRC') flag = ; + if(code === 'CUP') flag = ; + if(code === 'DOP') flag = ; + if(code === 'GHS') flag = ; + if(code === 'GTQ') flag = ; + if(code === 'ILS') flag = ; + if(code === 'JMD') flag = ; + if(code === 'KES') flag = ; + if(code === 'KZT') flag = ; + if(code === 'MYR') flag = ; + if(code === 'NAD') flag = ; + if(code === 'NGN') flag = ; + if(code === 'AZN') flag = ; + if(code === 'PAB') flag = ; + if(code === 'PHP') flag = ; + if(code === 'PKR') flag = ; + if(code === 'QAR') flag = ; + if(code === 'SAR') flag = ; + if(code === 'THB') flag = ; + if(code === 'TTD') flag = ; + if(code === 'VND') flag = ; + if(code === 'XOF') flag = ; + if(code === 'TWD') flag = ; + if(code === 'TZS') flag = ; + if(code === 'XAF') flag = ; + if(code === 'ANY') flag = ; + if(code === 'XAU') flag = ; + if(code === 'BTC') flag = ; + + return ( +
{flag}
+ ); +}; + +export default FlagWithProps; diff --git a/frontend/src/components/FlagWithProps/index.ts b/frontend/src/components/FlagWithProps/index.ts new file mode 100644 index 00000000..815f70ae --- /dev/null +++ b/frontend/src/components/FlagWithProps/index.ts @@ -0,0 +1 @@ +export { default } from "./FlagWithProps"; diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js index dfb56c98..1d02d695 100644 --- a/frontend/src/components/MakerPage.js +++ b/frontend/src/components/MakerPage.js @@ -6,7 +6,7 @@ import { LocalizationProvider, TimePicker} from '@mui/lab'; import DateFnsUtils from "@date-io/date-fns"; import { Link as LinkRouter } from 'react-router-dom' -import getFlags from './getFlags'; +import FlagWithProps from './FlagWithProps'; import AutocompletePayments from './AutocompletePayments'; import currencyDict from '../../static/assets/currencies.json'; @@ -57,7 +57,12 @@ class MakerPage extends Component { minAmount: null, maxAmount: null, loadingLimits: true, + amount: "", + badPaymentMethod: false, + } } + + componentDidMount() { this.getLimits() } @@ -319,7 +324,7 @@ class MakerPage extends Component { onChange={this.handleCurrencyChange}> {Object.entries(currencyDict) .map( ([key, value]) => -
{getFlags(value)}{" "+value}
+
{" "+value}
)} @@ -404,7 +409,7 @@ class MakerPage extends Component { /> - + {(this.state.is_explicit ? t("Order rate:"): t("Order current rate:"))+" "+pn(this.priceNow())+" "+this.state.currencyCode+"/BTC"} diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js index 56687d98..78e2eee1 100644 --- a/frontend/src/components/OrderPage.js +++ b/frontend/src/components/OrderPage.js @@ -9,7 +9,7 @@ import { Link as LinkRouter } from 'react-router-dom' import PaymentText from './PaymentText' import TradeBox from "./TradeBox"; -import getFlags from './getFlags' +import FlagWithProps from './FlagWithProps' import { t } from "i18next"; // icons @@ -588,7 +588,7 @@ class OrderPage extends Component {
- {getFlags(this.state.currencyCode)} +
{this.state.has_range & this.state.amount == null ? diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index e64e176f..44638be9 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -11,7 +11,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react" + "jsx": "react-jsx", }, "include": ["src"] }