'use client' import { FileText, Lightbulb, StickyNote } from 'lucide-react' import { Badge } from '@/components/ui/badge' import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' interface ContextIndicatorProps { sourcesInsights: number sourcesFull: number notesCount: number tokenCount?: number charCount?: number className?: string } // Helper function to format large numbers with K/M suffixes function formatNumber(num: number): string { if (num >= 1000000) { return `${(num / 1000000).toFixed(1)}M` } if (num >= 1000) { return `${(num / 1000).toFixed(1)}K` } return num.toString() } export function ContextIndicator({ sourcesInsights, sourcesFull, notesCount, tokenCount, charCount, className }: ContextIndicatorProps) { const hasContext = (sourcesInsights + sourcesFull) > 0 || notesCount > 0 if (!hasContext) { return (
No sources or notes included in context. Toggle icons on cards to include them.
) } return (
Context:
{sourcesInsights > 0 && ( {sourcesInsights}

Insights for {sourcesInsights} source{sourcesInsights !== 1 ? 's' : ''}

)} {sourcesFull > 0 && ( {sourcesFull}

{sourcesFull} full source{sourcesFull !== 1 ? 's' : ''}

)}
{notesCount > 0 && ( <> {(sourcesInsights > 0 || sourcesFull > 0) && ( )} {notesCount}

{notesCount} full note{notesCount !== 1 ? 's' : ''}

)}
{(tokenCount !== undefined || charCount !== undefined) && (
{tokenCount !== undefined && tokenCount > 0 && ( {formatNumber(tokenCount)} tokens )} {tokenCount !== undefined && charCount !== undefined && tokenCount > 0 && charCount > 0 && ( / )} {charCount !== undefined && charCount > 0 && ( {formatNumber(charCount)} chars )}
)}
) }