import { prisma } from '@/lib/prisma' import { notFound } from 'next/navigation' import { RelatedNotes } from '@/components/related-notes' import { getRelatedNotes } from '@/lib/related' import { MarkdownContent } from '@/components/markdown-content' import { DeleteNoteButton } from '@/components/delete-note-button' import { TrackNoteView } from '@/components/track-note-view' import Link from 'next/link' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { ArrowLeft, Edit, Heart, Pin } from 'lucide-react' import { NoteType } from '@/types/note' const typeColors: Record = { command: 'bg-green-100 text-green-800', snippet: 'bg-blue-100 text-blue-800', decision: 'bg-purple-100 text-purple-800', recipe: 'bg-orange-100 text-orange-800', procedure: 'bg-yellow-100 text-yellow-800', inventory: 'bg-gray-100 text-gray-800', note: 'bg-slate-100 text-slate-800', } export default async function NoteDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params const note = await prisma.note.findUnique({ where: { id }, include: { tags: { include: { tag: true } } }, }) if (!note) { notFound() } const related = await getRelatedNotes(id, 5) const noteType = note.type as NoteType return ( <>

{note.title}

{noteType} {note.isFavorite && } {note.isPinned && } Actualizada: {new Date(note.updatedAt).toLocaleDateString('en-CA')}
{note.tags.length > 0 && (
{note.tags.map(({ tag }) => ( {tag.name} ))}
)}
{related.length > 0 && ( )}
) }