'use client'
import { CheckCircle2, Circle } from 'lucide-react'
import { useLanguage } from '@/lib/i18n'
import { DashboardWidgetShell } from '@/components/dashboard-catalog-widgets'
export interface DailyReviewItem {
key: string
label: string
done: boolean
count?: number
onClick: () => void
}
export function DashboardDailyReview({
items,
loading,
}: {
items: DailyReviewItem[]
loading?: boolean
}) {
const { t } = useLanguage()
return (
}
title={t('homeDashboard.widgets.daily-review')}
compact
>
{loading ? (
) : (
{items.map(item => (
-
))}
)}
{t('homeDashboard.dailyReviewHint')}
)
}
export function DashboardOpenLoops({
loops,
loading,
onSelect,
}: {
loops: Array<{ id: string; title: string | null; notebookId: string | null; daysStale: number }>
loading?: boolean
onSelect: (id: string, notebookId: string | null) => void
}) {
const { t } = useLanguage()
return (
}
title={t('homeDashboard.widgets.open-loops')}
compact
>
{loading ? (
) : loops.length === 0 ? (
{t('homeDashboard.openLoopsEmpty')}
) : (
{loops.map(loop => (
))}
)}
)
}
export function DashboardDailyNoteWidget({
loading,
onOpen,
}: {
loading?: boolean
onOpen: () => void
}) {
const { t } = useLanguage()
return (
}
title={t('homeDashboard.widgets.daily-note')}
compact
>
{loading ? (
) : (
)}
)
}
export function DashboardLinkSuggestions({
paths,
loading,
onAction,
}: {
paths: Array<{ id: string; title: string; description: string; score?: number }>
loading?: boolean
onAction: (id: string) => void
}) {
const { t } = useLanguage()
return (
}
title={t('homeDashboard.widgets.link-suggestions')}
>
{loading ? (
) : paths.length === 0 ? (
{t('homeDashboard.linkSuggestionsEmpty')}
) : (
{paths.map(p => (
))}
)}
)
}
export function DashboardBridgesWidget({
suggestions,
loading,
actingKey,
onCreate,
onDismiss,
}: {
suggestions: Array<{
clusterAId: number
clusterBId: number
clusterAName: string
clusterBName: string
suggestedTitle: string
justification: string
}>
loading?: boolean
actingKey?: string | null
onCreate: (s: { clusterAId: number; clusterBId: number; clusterAName: string; clusterBName: string; suggestedTitle: string; suggestedContent: string; justification: string }) => void
onDismiss: (s: { clusterAId: number; clusterBId: number }) => void
}) {
const { t } = useLanguage()
return (
}
title={t('homeDashboard.widgets.bridges')}
>
{loading ? (
) : suggestions.length === 0 ? (
{t('homeDashboard.bridgesEmpty')}
) : (
{suggestions.slice(0, 3).map(s => {
const key = `${s.clusterAId}-${s.clusterBId}`
return (
{s.suggestedTitle}
{t('homeDashboard.suggestedBridge', { clusterA: s.clusterAName, clusterB: s.clusterBName })}
{s.justification}
)
})}
)}
)
}