import React, { useState } from 'react'; import { HiCube, HiXMark, HiDocumentDuplicate, HiPencil, HiTrash, HiEllipsisVertical } from 'react-icons/hi2'; import { Button } from '../../../ui/Button'; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '../../../ui/dropdown-menu'; import { cn } from '../../../../lib/utils'; import { WorkingBlock } from '../../../../types/block-tester.types'; import { Logger } from '@hashgraphonline/standards-sdk'; const logger = new Logger({ module: 'BlockTab' }); /** * Props for the BlockTab component */ export interface BlockTabProps { block: WorkingBlock; index: number; isActive: boolean; isDirty: boolean; onClick: () => void; onClose?: () => void; onDuplicate: () => void; } /** * Individual block tab component with context menu and dirty state */ const BlockTab: React.FC = ({ block, index, isActive, isDirty, onClick, onClose, onDuplicate }) => { const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick(); } }; return (
{/* Main tab */}
{/* Block icon */} {/* Block name with dirty indicator */} {block.name} {isDirty && "*"} {/* Dirty state dot indicator */} {isDirty && (
)}
{/* Tab actions */}
{/* Context menu dropdown */} Duplicate Block { logger.info('Rename block', { blockId: block.id }); }} > Rename Block {onClose && ( Close Block )} {/* Close button */} {onClose && ( )}
); }; export default BlockTab;