'use client' import { EyeOff, Lightbulb, FileText } from 'lucide-react' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' import { ContextMode } from '@/app/(dashboard)/notebooks/[id]/page' interface ContextToggleProps { mode: ContextMode hasInsights?: boolean // For sources - determines if 'insights' mode is available onChange: (mode: ContextMode) => void className?: string } const MODE_CONFIG = { off: { icon: EyeOff, label: 'Not included in chat', color: 'text-muted-foreground', bgColor: 'hover:bg-muted' }, insights: { icon: Lightbulb, label: 'Insights only', color: 'text-amber-600', bgColor: 'hover:bg-amber-50' }, full: { icon: FileText, label: 'Full content', color: 'text-primary', bgColor: 'hover:bg-primary/10' } } as const export function ContextToggle({ mode, hasInsights = false, onChange, className }: ContextToggleProps) { const config = MODE_CONFIG[mode] const Icon = config.icon // Determine available modes based on whether item has insights const availableModes: ContextMode[] = hasInsights ? ['off', 'insights', 'full'] : ['off', 'full'] const handleClick = (e: React.MouseEvent) => { e.stopPropagation() // Prevent card click // Cycle to next mode const currentIndex = availableModes.indexOf(mode) const nextIndex = (currentIndex + 1) % availableModes.length onChange(availableModes[nextIndex]) } return (

{config.label}

Click to cycle

) }