'use client'; import clsx from 'clsx'; interface ActionTooltipProps { widgetData: { attributes: Record; name: string; template: string; slug: string; }; selectedWidget: any; designMode: boolean; onDelete?: () => void; onMoveUp?: () => void; onMoveDown?: () => void; onCopy?: () => void; } export function ActionTooltip({ widgetData, selectedWidget, designMode, onDelete, onMoveUp, onMoveDown, onCopy }: ActionTooltipProps) { if (!widgetData?.attributes) { return null; } const componentId = Object.keys(widgetData.attributes)[0]; const attributes = widgetData.attributes[componentId]; if (!attributes) { return null; } const isRootContainer = !attributes.parentId; if (isRootContainer) { return null; } const isContainer = ['container'].includes(attributes.type); const isCollectionItem = selectedWidget?.id?.includes('-'); const isSelected = isCollectionItem ? selectedWidget?.id === componentId : selectedWidget?.id?.split('-')[0] === componentId?.split('-')[0]; if (!designMode || !selectedWidget || !isSelected) { return null; } return (
); }