import React from 'react'; import { 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 = (row, t, isDetailed = false) => { const { value, original: { info } } = row; let whoisContainer = ''; let nameContainer = value; if (info) { const { name, whois_info } = info; if (name) { nameContainer = isDetailed ? {value} :
{name} {' '} {`(${value})`}
; } if (whois_info) { whoisContainer = (
{getFormattedWhois(whois_info, t)}
); } } return (
<> {nameContainer} {whoisContainer}
); };