- Add auto tag suggestions to note form with debounced API calls - Rename related notes to "También podrías necesitar" in detail view - Create NoteConnections component showing backlinks, outgoing links, and related notes - Add tests for backlinks module and tags/suggest API endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
import { Badge } from '@/components/ui/badge'
|
|
|
|
interface RelatedNote {
|
|
id: string
|
|
title: string
|
|
type: string
|
|
tags: string[]
|
|
score: number
|
|
reason: string
|
|
}
|
|
|
|
export function RelatedNotes({ notes }: { notes: RelatedNote[] }) {
|
|
if (notes.length === 0) return null
|
|
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle className="text-lg">También podrías necesitar</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<div className="space-y-3">
|
|
{notes.map((note) => (
|
|
<Link key={note.id} href={`/notes/${note.id}`}>
|
|
<div className="p-3 rounded-lg border hover:bg-gray-50 transition-colors">
|
|
<div className="flex items-center justify-between mb-1">
|
|
<span className="font-medium text-sm">{note.title}</span>
|
|
<Badge variant="outline" className="text-xs">{note.type}</Badge>
|
|
</div>
|
|
<p className="text-xs text-gray-500 line-clamp-1">{note.reason}</p>
|
|
{note.tags.length > 0 && (
|
|
<div className="flex gap-1 mt-1">
|
|
{note.tags.slice(0, 3).map((tag) => (
|
|
<Badge key={tag} variant="secondary" className="text-xs">
|
|
{tag}
|
|
</Badge>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
} |