'use client' import { Heart } from 'lucide-react' import type { LucideIcon } from 'lucide-react' import { useLanguage } from '@/lib/i18n' import { DashboardWidgetTitleRow } from '@/components/dashboard-widget-title-row' interface EmotionMeta { Icon: LucideIcon color: string } export interface DashboardSentimentChipProps { available: boolean loading?: boolean dominantEmotion?: string summary?: string emotions?: Record emotionMeta: Record } export function DashboardSentimentChip({ available, loading, dominantEmotion, summary, emotions, emotionMeta, }: DashboardSentimentChipProps) { const { t } = useLanguage() if (loading) { return (
) } return (
} title={t('homeDashboard.sentiment')} /> {!available || !dominantEmotion ? (

{t('homeDashboard.notEnoughNotes')}

) : (
{(() => { const meta = emotionMeta[dominantEmotion] || emotionMeta.reflective const Icon = meta?.Icon return (
{Icon && }
) })()}

{t(`homeDashboard.emotions.${dominantEmotion}`)}

{t('homeDashboard.sentimentDominant')}

{summary && (

{summary}

)} {emotions && (
{Object.entries(emotions) .sort(([, a], [, b]) => b - a) .slice(0, 4) .map(([key, val]) => { const em = emotionMeta[key] return (
{t(`homeDashboard.emotions.${key}`)}
) })}
)}
)}
) }