diff --git a/frontend/src/components/PaymentMethods/StringAsIcons.tsx b/frontend/src/components/PaymentMethods/StringAsIcons.tsx index d343e7d2..8b6b871c 100644 --- a/frontend/src/components/PaymentMethods/StringAsIcons.tsx +++ b/frontend/src/components/PaymentMethods/StringAsIcons.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import PaymentIcon from './Icons'; import { Tooltip } from '@mui/material'; @@ -7,15 +7,22 @@ import { fiatMethods, swapMethods } from './MethodList'; const ns = [{ name: 'not specified', icon: 'notspecified' }]; const methods = ns.concat(swapMethods).concat(fiatMethods); -const StringAsIcons: React.FC = (props) => { +interface Props { + othersText: string; + verbose: boolean; + size: number; + text: string; +} + +const StringAsIcons: React.FC = ({ othersText, verbose, size, text }: Props) => { const { t } = useTranslation(); - const parseText = () => { + const parsedText = useMemo(() => { const rows = []; - let custom_methods = props.text; + let custom_methods = text; // Adds icons for each PaymentMethod that matches methods.forEach((method, i) => { - if (props.text.includes(method.name)) { + if (text.includes(method.name)) { custom_methods = custom_methods.replace(method.name, ''); rows.push( {
- +
, ); @@ -52,24 +59,24 @@ const StringAsIcons: React.FC = (props) => { key={'pushed'} placement='top' enterTouchDelay={0} - title={props.verbose ? props.othersText : props.othersText + ': ' + custom_methods} + title={verbose ? othersText : othersText + ': ' + custom_methods} >
- +
, ); } - if (props.verbose) { + if (verbose) { return ( <> {rows}{' '} @@ -82,10 +89,10 @@ const StringAsIcons: React.FC = (props) => { } else { return rows; } - }; + }, []); return ( -
{parseText()}
+
{parsedText}
); }; diff --git a/frontend/src/contexts/AppContext.tsx b/frontend/src/contexts/AppContext.tsx index 21c85353..bc960e32 100644 --- a/frontend/src/contexts/AppContext.tsx +++ b/frontend/src/contexts/AppContext.tsx @@ -335,11 +335,9 @@ export const AppContextProvider = ({ useEffect(() => { if (open.stats || open.coordinator || info.coordinatorVersion == 'v?.?.?') { - if (window.NativeRobosats === undefined) { - fetchInfo(); - } + fetchInfo(); } - }, [open.stats, open.coordinator]); + }, [open.stats, open.coordinator, open.exchange]); useEffect(() => { // Sets Setting network from coordinator API param if accessing via web