import React, { Fragment } from 'react'; import { getClientInfo, getAutoClientInfo, normalizeWhois } from './helpers'; import { WHOIS_ICONS } from './constants'; const getFormattedWhois = (whois, t) => { const whoisInfo = normalizeWhois(whois); return ( Object.keys(whoisInfo).map((key) => { const icon = WHOIS_ICONS[key]; return ( {icon && (   )}{whoisInfo[key]} ); }) ); }; export const formatClientCell = (value, clients, autoClients, t) => { const clientInfo = getClientInfo(clients, value) || getAutoClientInfo(autoClients, value); const { name, whois } = clientInfo; let whoisContainer = ''; let nameContainer = value; if (name) { nameContainer = ( {name} ({value}) ); } if (whois) { whoisContainer = (
{getFormattedWhois(whois, t)}
); } return ( {nameContainer} {whoisContainer} ); };