import React, { Component } from 'react'; import { withTranslation } from 'react-i18next'; import PaymentIcon from './payment-methods/Icons'; import { Tooltip } from '@mui/material'; import { paymentMethods, swapDestinations } from './payment-methods/Methods'; const ns = [{ name: 'not specified', icon: 'notspecified' }]; const methods = ns.concat(swapDestinations).concat(paymentMethods); class PaymentText extends Component { constructor(props) { super(props); } parseText() { const { t } = this.props; const rows = []; let custom_methods = this.props.text; // Adds icons for each PaymentMethod that matches methods.forEach((method, i) => { if (this.props.text.includes(method.name)) { custom_methods = custom_methods.replace(method.name, ''); rows.push(
, ); } }); // Adds a Custom icon if there are words that do not match const chars_left = custom_methods .replace(' ', '') .replace(' ', '') .replace(' ', '') .replace(' ', '') .replace(' ', ''); if (chars_left.length > 0) { rows.push(
, ); } if (this.props.verbose) { return ( <> {rows}{' '}
{' '} {custom_methods}
); } else { return rows; } } render() { return (
{this.parseText()}
); } } export default withTranslation()(PaymentText);