// @flow import * as ICONS from 'constants/icons'; import React from 'react'; import classnames from 'classnames'; import Icon from 'component/common/icon'; import LbcSymbol from 'component/common/lbc-symbol'; import Tooltip from 'component/common/tooltip'; import CreditAmount from 'component/common/credit-amount'; type Props = { channelClaim: ChannelClaim, amount: number, level: number, large?: boolean, inline?: boolean, hideTooltip?: Boolean, }; function getChannelIcon(level: number): string { const icons = { '1': ICONS.CHANNEL_LEVEL_1, '2': ICONS.CHANNEL_LEVEL_2, '3': ICONS.CHANNEL_LEVEL_3, '4': ICONS.CHANNEL_LEVEL_4, '5': ICONS.CHANNEL_LEVEL_5, }; return icons[level] || ICONS.CHANNEL_LEVEL_1; } function ChannelStakedIndicator(props: Props) { const { channelClaim, amount, level, large = false, inline = false, hideTooltip } = props; if (!channelClaim || !channelClaim.meta) { return null; } const isControlling = channelClaim && channelClaim.meta.is_controlling; const icon = getChannelIcon(level); if (!hideTooltip) { return (
{__('Level %current_level%', { current_level: level })}
} size={14} />
} >
); } else { return (
); } } type LevelIconProps = { isControlling: boolean, icon: string, large?: boolean, }; function LevelIcon(props: LevelIconProps) { const { large, isControlling, icon } = props; return ( icon && ( ) ); } export default ChannelStakedIndicator;