// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { BN } from '@pezkuwi/util'; import React, { useMemo } from 'react'; import { Badge } from '@pezkuwi/react-components'; import { useAccounts } from '@pezkuwi/react-hooks'; import MaxBadge from '../../MaxBadge.js'; interface Props { isChilled?: boolean; isElected: boolean; isMain?: boolean; isPara?: boolean; isRelay?: boolean; nominators?: { nominatorId: string }[]; onlineCount?: false | BN; onlineMessage?: boolean; } const NO_NOMS: { nominatorId: string }[] = []; function Status ({ isChilled, isElected, isMain, isPara, isRelay, nominators = NO_NOMS, onlineCount, onlineMessage }: Props): React.ReactElement { const { allAccounts } = useAccounts(); const blockCount = onlineCount && onlineCount.toNumber(); const isNominating = useMemo( () => nominators.some(({ nominatorId }) => allAccounts.includes(nominatorId)), [allAccounts, nominators] ); return ( <> {isNominating ? ( ) : ( ) } {isRelay && ( isPara ? ( ) : ( ) )} {isChilled ? ( ) : isElected ? ( ) : ( ) } {isMain && ( blockCount ? ( ) : onlineMessage ? ( ) : ( ) )} ); } export default React.memo(Status);