'use client' import { Inbox, GraduationCap, Mail, Pin, Bot, BarChart3 } from 'lucide-react' import { useLanguage } from '@/lib/i18n' import { RevisionHeatmap } from '@/components/flashcards/revision-heatmap' import { UsageMeter } from '@/components/usage-meter' import { DashboardWidgetTitleRow } from '@/components/dashboard-widget-title-row' import type { DashboardWidgetId } from '@/lib/dashboard/layout' interface DashboardWidgetShellProps { widgetId: DashboardWidgetId icon: React.ReactNode title: string children: React.ReactNode compact?: boolean headerActions?: React.ReactNode } export function DashboardWidgetShell({ widgetId, icon, title, children, compact, headerActions, }: DashboardWidgetShellProps) { return (
{children}
) } export function DashboardInboxWidget({ count, loading, onOpen, }: { count: number loading: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.inbox')} compact > {loading ? (
) : ( )} ) } export function DashboardRevisionWidget({ dueCount, loading, onOpen, }: { dueCount: number loading: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.review')} compact > {loading ? (
) : ( )} ) } export function DashboardStatsWidget({ clusterCount, bridgeCount, noteCount, loading, onOpen, }: { clusterCount: number bridgeCount: number noteCount: number loading: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.stats')} compact > {loading ? (
{[0, 1, 2].map(i =>
)}
) : ( )} ) } export function DashboardAgentActivityWidget({ actions, loading, onOpen, }: { actions: { id: string; agentName: string; result: string | null; createdAt: string }[] loading: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.agent-activity')} compact > {loading ? (
) : actions.length === 0 ? (

{t('homeDashboard.widgetAgentActivityEmpty')}

) : (
{actions.slice(0, 3).map(a => ( ))}
)} ) } export function DashboardGmailWidget({ connected, recentCaptures, loading, onOpen, }: { connected: boolean recentCaptures: number loading: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.gmailCaptures')} compact > {loading ? (
) : connected ? ( ) : ( )} ) } export function DashboardPinnedWidget({ notes, loading, onSelect, }: { notes: { id: string; title: string | null; notebookId: string | null }[] loading: boolean onSelect: (id: string, notebookId: string | null) => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.pinned')} compact > {loading ? (
) : notes.length === 0 ? (

{t('homeDashboard.widgetPinnedEmpty')}

) : (
{notes.map(n => ( ))}
)} ) } export function DashboardActivityWidget({ data, loading, }: { data: { date: string; count: number }[] loading: boolean }) { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.activity')} > {loading ? (
) : ( )}

{t('homeDashboard.widgetActivityHint')}

) } export function DashboardUsageWidget() { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.usage')} compact >

{t('homeDashboard.widgetUsageHint')}

) } export function DashboardFlashcardsProgressWidget({ retentionRate, streak, totalCards, loading, onOpen, }: { retentionRate: number streak: number totalCards: number loading?: boolean onOpen: () => void }) { const { t } = useLanguage() return ( } title={t('homeDashboard.widgets.flashcards-progress')} compact > {loading ? (
) : ( )} ) }