import React from 'react'; import cx from 'classnames'; import { NavLink } from 'react-router-dom'; import { TopicWithDetailedInfo } from 'redux/interfaces'; const ListItem: React.FC = ({ name, internal, partitions, }) => { const outOfSyncReplicas = React.useMemo(() => { if (partitions === undefined || partitions.length === 0) { return 0; } return partitions.reduce((memo: number, { replicas }) => { const outOfSync = replicas?.filter(({ inSync }) => !inSync) return memo + (outOfSync?.length || 0); }, 0); }, [partitions]) return ( {name} {partitions?.length} {outOfSyncReplicas}
{internal ? 'Internal' : 'External'}
); } export default ListItem;