import React from 'react'; import Icon from 'Components/Icon'; import VirtualTableRowCell from 'Components/Table/Cells/TableRowCell'; import Popover from 'Components/Tooltip/Popover'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import { IndexerStatus } from 'Indexer/Indexer'; import translate from 'Utilities/String/translate'; import DisabledIndexerInfo from './DisabledIndexerInfo'; import styles from './IndexerStatusCell.css'; function getIconKind(enabled: boolean, redirect: boolean) { if (enabled) { return redirect ? kinds.INFO : kinds.SUCCESS; } return kinds.DEFAULT; } function getIconName(enabled: boolean, redirect: boolean) { if (enabled) { return redirect ? icons.REDIRECT : icons.CHECK; } return icons.BLOCKLIST; } function getIconTooltip(enabled: boolean, redirect: boolean) { if (enabled) { return redirect ? translate('EnabledRedirected') : translate('Enabled'); } return translate('Disabled'); } interface IndexerStatusCellProps { className: string; enabled: boolean; redirect: boolean; status?: IndexerStatus; longDateFormat: string; timeFormat: string; component?: React.ElementType; } function IndexerStatusCell(props: IndexerStatusCellProps) { const { className, enabled, redirect, status, longDateFormat, timeFormat, component: Component = VirtualTableRowCell, ...otherProps } = props; return ( {status ? ( } title={translate('IndexerDisabled')} body={
} position={tooltipPositions.BOTTOM} /> ) : null}
); } export default IndexerStatusCell;