'use client'; import { useExplainMode } from '@/contexts/ExplainModeContext'; interface ExplainTooltipProps { explanation: string; children: React.ReactNode; inline?: boolean; } // Wraps an element. When Explain Mode is on, renders a small annotation // directly below `children` describing what the wrapped element means. // When off, renders children unchanged with no DOM cost. export default function ExplainTooltip({ explanation, children, inline = false }: ExplainTooltipProps) { const { explainMode } = useExplainMode(); if (!explainMode) return <>{children}; const wrapperTag = inline ? 'span' : 'div'; const Wrapper = wrapperTag as 'span'; return ( {children} {explanation} ); }