'use client' import { motion } from 'motion/react' import { Loader2 } from 'lucide-react' import { ArrowRight, GitBranch, Lightbulb, Link2, BookOpen, Inbox, GraduationCap, Compass, Plus, Sparkles, PenLine, } from 'lucide-react' import type { LucideIcon } from 'lucide-react' import { useLanguage } from '@/lib/i18n' import { DashboardWidgetTitleRow } from '@/components/dashboard-widget-title-row' import type { DashboardPath, DashboardPathType } from '@/lib/dashboard/path-types' const TYPE_META: Record = { continue: { Icon: PenLine, accent: 'text-brand-accent' }, connect: { Icon: Link2, accent: 'text-brand-accent' }, 'add-link': { Icon: Plus, accent: 'text-brand-accent' }, bridge: { Icon: GitBranch, accent: 'text-brand-accent' }, research: { Icon: Sparkles, accent: 'text-brand-accent' }, explore: { Icon: Compass, accent: 'text-brand-accent' }, organize: { Icon: Inbox, accent: 'text-brand-accent' }, review: { Icon: GraduationCap, accent: 'text-brand-accent' }, resurface: { Icon: Lightbulb, accent: 'text-brand-accent' }, daily: { Icon: BookOpen, accent: 'text-brand-accent' }, } export interface DashboardNextPathsProps { paths: DashboardPath[] loading?: boolean enriching?: boolean focusNoteTitle?: string | null onAction: (path: DashboardPath) => void prefersReducedMotion?: boolean } export function DashboardNextPaths({ paths, loading, enriching, focusNoteTitle, onAction, prefersReducedMotion, }: DashboardNextPathsProps) { const { t, language } = useLanguage() const rtl = language === 'ar' || language === 'fa' if (loading) { return (
{focusNoteTitle && (

{t('homeDashboard.pathsFromNote', { title: focusNoteTitle })}

)}

{t('homeDashboard.pathsLoading')}

) } if (paths.length === 0) { return (

{t('homeDashboard.pathsEmpty')}

) } const hero = paths[0] const rest = paths.slice(1, 5) const HeroIcon = TYPE_META[hero.type].Icon const reduced = !!prefersReducedMotion const ease = [0.16, 1, 0.3, 1] as const return (
{t('homeDashboard.pathsEnriching')} ) : undefined} /> {focusNoteTitle && (

{t('homeDashboard.pathsFromNote', { title: focusNoteTitle })}

)}
onAction(hero)} whileHover={reduced ? undefined : { y: -1 }} key={hero.id} initial={reduced ? false : { clipPath: rtl ? 'inset(0 0 0 72%)' : 'inset(0 72% 0 0)', opacity: 0.55 }} animate={{ clipPath: 'inset(0 0% 0 0)', opacity: 1 }} transition={{ duration: reduced ? 0 : 0.48, ease }} className="w-full text-start px-5 py-4 hover:bg-brand-accent/[0.03] transition-colors border-b border-border/10" >

{t(`homeDashboard.pathTypes.${hero.type}`)} {hero.score ? ` ยท ${hero.score}%` : ''}

{hero.title}

{hero.description}

{t(`homeDashboard.pathActions.${hero.actionKey}`)}
{rest.length > 0 && (
{rest.map((path, idx) => { const meta = TYPE_META[path.type] const Icon = meta.Icon return ( onAction(path)} initial={reduced ? false : { opacity: 0, x: rtl ? -10 : 10 }} animate={{ opacity: 1, x: 0 }} transition={{ duration: reduced ? 0 : 0.28, delay: reduced ? 0 : Math.min(0.08 + idx * 0.04, 0.2), ease }} className="w-full flex items-center gap-3 px-5 py-3 text-start hover:bg-stone-50/80 dark:hover:bg-zinc-950/40 transition-colors" >

{path.title}

{path.description}

{t(`homeDashboard.pathActions.${path.actionKey}`)}
) })}
)}
) }