import { HelpCircle } from "lucide-react"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { getGlossaryTerm } from "@/lib/glossary"; import { cn } from "@/lib/utils"; interface TermTooltipProps { term: string; children: React.ReactNode; inline?: boolean; showIcon?: boolean; } export function TermTooltip({ term, children, inline = false, showIcon = true }: TermTooltipProps) { const glossaryEntry = getGlossaryTerm(term); if (!glossaryEntry) { return <>{children}; } return ( {children} {showIcon && ( )}
{glossaryEntry.term}

{glossaryEntry.category.replace('-', ' ')}

{glossaryEntry.definition}

{glossaryEntry.example && (

Example: {glossaryEntry.example}

)} {glossaryEntry.relatedTerms && glossaryEntry.relatedTerms.length > 0 && (

See also: {glossaryEntry.relatedTerms.map(t => getGlossaryTerm(t)?.term || t ).join(', ')}

)}
); }