'use client' import Link from 'next/link' import { useRouter } from 'next/navigation' import { Note } from '@/types/note' import { Card, CardContent } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' 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 function NoteCard({ note }: { note: Note }) { const router = useRouter() const preview = note.content.slice(0, 100) + (note.content.length > 100 ? '...' : '') const typeColor = typeColors[note.type] || typeColors.note const handleMouseEnter = () => { // Prefetch on hover for faster navigation router.prefetch(`/notes/${note.id}`) } return (

{note.title}

{note.isPinned && 📌} {note.isFavorite && ❤️}
{note.type} {new Date(note.updatedAt).toLocaleDateString('en-CA')}

{preview}

{note.tags && note.tags.length > 0 && (
{note.tags.map(({ tag }) => ( {tag.name} ))}
)}
) }