import { Flex, HStack, StackProps, Text, Tooltip } from '@chakra-ui/react' import { BlockType, DraggableBlockType } from 'models' import { useBlockDnd } from 'contexts/GraphDndContext' import React, { useEffect, useState } from 'react' import { BlockIcon } from './BlockIcon' import { BlockTypeLabel } from './BlockTypeLabel' export const BlockCard = ({ type, onMouseDown, isDisabled = false, }: { type: DraggableBlockType isDisabled?: boolean onMouseDown: (e: React.MouseEvent, type: DraggableBlockType) => void }) => { const { draggedBlockType } = useBlockDnd() const [isMouseDown, setIsMouseDown] = useState(false) useEffect(() => { setIsMouseDown(draggedBlockType === type) }, [draggedBlockType, type]) const handleMouseDown = (e: React.MouseEvent) => onMouseDown(e, type) return ( {!isMouseDown ? ( <> ) : ( Placeholder )} ) } export const BlockCardOverlay = ({ type, ...props }: StackProps & { type: BlockType }) => { return ( ) }