feat: MVP-4 Sprint 2 - Co-usage sidebar and search cache

- Add co-usage display to NoteConnections (notas vistas juntas)
- Add search results cache with 50 entry limit and FIFO eviction
- Improve contextual sidebar with usage-based suggestions
This commit is contained in:
2026-03-22 17:37:40 -03:00
parent 9af25927b7
commit e57927e37d
3 changed files with 41 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
import Link from 'next/link'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
import { ArrowRight, Link2, RefreshCw, ExternalLink } from 'lucide-react'
import { ArrowRight, Link2, RefreshCw, ExternalLink, Users } from 'lucide-react'
interface BacklinkInfo {
id: string
@@ -30,6 +30,7 @@ interface NoteConnectionsProps {
backlinks: BacklinkInfo[]
outgoingLinks: BacklinkInfo[]
relatedNotes: RelatedNote[]
coUsedNotes: { noteId: string; title: string; type: string; weight: number }[]
}
function ConnectionGroup({
@@ -84,9 +85,10 @@ export function NoteConnections({
backlinks,
outgoingLinks,
relatedNotes,
coUsedNotes,
}: NoteConnectionsProps) {
const hasAnyConnections =
backlinks.length > 0 || outgoingLinks.length > 0 || relatedNotes.length > 0
backlinks.length > 0 || outgoingLinks.length > 0 || relatedNotes.length > 0 || coUsedNotes.length > 0
if (!hasAnyConnections) {
return null
@@ -136,6 +138,18 @@ export function NoteConnections({
}))}
emptyMessage="No hay notas relacionadas"
/>
{/* Co-used notes - often viewed together */}
<ConnectionGroup
title="Co-usadas"
icon={Users}
notes={coUsedNotes.map((cu) => ({
id: cu.noteId,
title: cu.title,
type: cu.type,
}))}
emptyMessage="No hay notas co-usadas"
/>
</CardContent>
</Card>
)