// Copyright 2017-2026 @pezkuwi/app-coretime authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { ChainInformation, ChainWorkTaskInformation } from '@pezkuwi/react-hooks/types'; import type { RelayName } from './types.js'; import React from 'react'; import { ExpandButton } from '@pezkuwi/react-components'; import { useToggle } from '@pezkuwi/react-hooks'; import Row from './Row.js'; interface Props { chain: ChainInformation regionEnd: number regionBegin: number lastCommittedTimeslice: number relayName: RelayName } function TeyrchainTableRow ({ chain, lastCommittedTimeslice, regionBegin, regionEnd, relayName }: Props): React.ReactElement { const [isExpanded, toggleIsExpanded] = useToggle(false); const info = chain.workTaskInfo; const firstRecord = chain.workTaskInfo[0]; const multiple = info.length > 1; const expandedContent = info.slice(1); if (!firstRecord) { return <>; } const renderRow = (record: ChainWorkTaskInformation, idx: number, highlight = false) => <> {idx === 0 && {!!multiple && } } ; return ( <> {renderRow(firstRecord, 0)} {isExpanded && expandedContent?.map((infoRow, idx) => {renderRow(infoRow, idx + 1, true)} )} ); } export default React.memo(TeyrchainTableRow);